SlideShare ist ein Scribd-Unternehmen logo
1 von 27
- Selenium - Browser-Based Automated Testing of Grails Apps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda Different Ways To Test a Grails App Unit, Integration, Functional Selenium Demo of IDE Architecture Alternatives (Canoo WebTest) Automating Testing Using Selenium Maven Cargo  Viewing Test Results Lab 1 – maven project Alternative Automation Strategies grails-selenium-rc plugin Lab 2 – using selenium-rc plugin How to write functional tests with Selenium KEY TAKE-AWAYS How to set up Selenium Testing  On Grails Apps  In Continuous  Integration The fast way, using the grails-  selenium-rc plug-in The long way – using Maven ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Different Ways To Test a Grails App Real http requests Separate client Mock http requests Client requests from same process Real Hibernate Mock Hibernate Functionality Package or class level scope Launch Grails container increasingly  coarse  grained  components  under  test
Manual Steps Involved In Running Selenium ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Launching Selenium
Recording New Selenium Tests
Exporting test commands to 3GL (Java, etc.)
Individual tests referenced by the suite are recorded using their paths relative to the suite. For simplicity put your suite and all tests in the same directory (to start) Saving New or Modified Selenium Tests
Selenium Components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Selenium Client Side Library & Server In Action HTTP Selenium-server.jar Source: http://seleniumhq.org/docs/05_selenium_rc.html Reports back  results of test to client HTTP (javascript) (client side java script / Ajax portion of application under Test – originates from  here ) Application  under test (server side)
Selenium RC Server Acting As Proxy To Avoid Same Origin Policy Restrictions What happens when a test suite starts ? 1) client/driver establishes  connection w.selenium-RC  2)  Selenium-RC server launches a browser (or reuses an old one) with URL that injects Selenium-Core’s javascript into browser-loaded web page. 3) client-driver passes a Selenese command to the server e.g.: open command 4) Server interprets the command and then triggers the corresponding javascript execution to execute that command within the browser (say open page in app under test)s 5) Request to open the page is routed through proxy server 6) 7) Proxy forwards request to app  server App server returns response
Functional Test Alternatives: Canoo vs Selenium ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Canoo Web Test Reports Canoo's reports show overall test results and let you drill down into any test
Canoo Web Test Reports (cont.) Click to review a copy of the response HTML page corresponding to the first test step that failed
Gluing together the steps in your build process ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
deploy Compile Unit Test  Integration Test Package .war file Download And Install Tomcat
Maven Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Maven Nested Module Structure, Dependencies and Shared Repo mvn install Maven Repository Lives in $HOME/.m2/repostitory or  /Docuemts and Settings/<user>/.m2/repository declares the artifact it produces to be  org.example:demo:1.1 declares a a dependency on org.example:demo:1.1 org.example:demo:1.1
Maven pom.xml – Nested Module Structure
Maven pom.xml – Dependency Relationships Maven Repository org.example:demo:1.1
Hooking Maven Plug-ins Maven Into the Build Life Cycle  Build Life Cycle Phases validate  generate/process-sources process-sources  generate/process-resources  compile test prepare-package  package pre-integration-test integration-test  post-integration-test  verify  install  deploy pom.xml
Cargo  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<target name=&quot;functional-test&quot; > <cargo containerId=&quot;tomcat6x&quot; action=&quot;start&quot;  …  > <zipurlinstaller installurl=&quot;http://somewhere/tomcat-6.0.zip&quot;/> <configuration type=&quot;standalone&quot; home=&quot;${tomcatdir}&quot;> <deployable type=&quot;war&quot; file=&quot;foo.war&quot;/> </configuration> </cargo> <plugin> ... <artifactId>cargo-maven2-plugin</artifactId> <config> <wait>false</wait> <container> <containerId>tomcat6x</containerId> <zipUrlInstaller> <url>http://somewhere/tomcat-6.0.zip</url> ... Installer installer =  new URL(&quot;http://somewhere/tomcat-6.0.zip&quot;)); installer.iZipURLInstaller(new nstall(); LocalConfiguration configuration =  new DefaultConfigurationFactory().createConfiguration(&quot;tomcat6x&quot;)...) container = new DefaultContainerFactory() .createContainer(&quot;tomcat6x&quot;....); container.setHome(installer.getHome()); WAR deployable = new WAR(&quot;foo.war);  deployable.setContext(&quot;ROOT&quot;); configuration.addDeployable(deployable);
Grails Selenium-rc Plugin ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Lab 2: Grails Selenium-rc Plugin ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],You can copy and paste the commands, and the  Groovy code for the test class.  Please go to this page for the text to copy -> http://buildchimp.com/wordpress/?p=241
Lab 2: Grails Selenium-rc Plugin ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Thank You  !
Content Licensing Terms for This Work You may present, distribute, copy, or incorporate into your own work, any and all portions of this presentation as long as such copies, or derivative works are made available without charge. If you would like to redistribute this work on any type of fee-for-use or subscription basis, or if you wish incorporate any or all portions of this work into content which you charge for, please contact info <at> buildlackey.com to discuss licensing terms.

Weitere ähnliche Inhalte

Was ist angesagt?

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
Vadym Lotar
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
Carlos Sanchez
 

Was ist angesagt? (20)

Selenium Handbook
Selenium HandbookSelenium Handbook
Selenium Handbook
 
Maven Overview
Maven OverviewMaven Overview
Maven Overview
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ Codeception
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeception
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 

Ähnlich wie Selenium-Browser-Based-Automated-Testing-for-Grails-Apps

Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
vstorm83
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
elliando dias
 

Ähnlich wie Selenium-Browser-Based-Automated-Testing-for-Grails-Apps (20)

Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 
Using Maven2
Using Maven2Using Maven2
Using Maven2
 
Qa process
Qa processQa process
Qa process
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Qa process
Qa processQa process
Qa process
 
Sel
SelSel
Sel
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance Testing
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in
 
Selenium
SeleniumSelenium
Selenium
 
Codeception
CodeceptionCodeception
Codeception
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
jDriver Presentation
jDriver PresentationjDriver Presentation
jDriver Presentation
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Selenium-Browser-Based-Automated-Testing-for-Grails-Apps

  • 1.
  • 2.
  • 3.
  • 4.
  • 7. Exporting test commands to 3GL (Java, etc.)
  • 8. Individual tests referenced by the suite are recorded using their paths relative to the suite. For simplicity put your suite and all tests in the same directory (to start) Saving New or Modified Selenium Tests
  • 9.
  • 10. Selenium Client Side Library & Server In Action HTTP Selenium-server.jar Source: http://seleniumhq.org/docs/05_selenium_rc.html Reports back results of test to client HTTP (javascript) (client side java script / Ajax portion of application under Test – originates from here ) Application under test (server side)
  • 11. Selenium RC Server Acting As Proxy To Avoid Same Origin Policy Restrictions What happens when a test suite starts ? 1) client/driver establishes connection w.selenium-RC 2) Selenium-RC server launches a browser (or reuses an old one) with URL that injects Selenium-Core’s javascript into browser-loaded web page. 3) client-driver passes a Selenese command to the server e.g.: open command 4) Server interprets the command and then triggers the corresponding javascript execution to execute that command within the browser (say open page in app under test)s 5) Request to open the page is routed through proxy server 6) 7) Proxy forwards request to app server App server returns response
  • 12.
  • 13. Canoo Web Test Reports Canoo's reports show overall test results and let you drill down into any test
  • 14. Canoo Web Test Reports (cont.) Click to review a copy of the response HTML page corresponding to the first test step that failed
  • 15.
  • 16. deploy Compile Unit Test Integration Test Package .war file Download And Install Tomcat
  • 17.
  • 18. Maven Nested Module Structure, Dependencies and Shared Repo mvn install Maven Repository Lives in $HOME/.m2/repostitory or /Docuemts and Settings/<user>/.m2/repository declares the artifact it produces to be org.example:demo:1.1 declares a a dependency on org.example:demo:1.1 org.example:demo:1.1
  • 19. Maven pom.xml – Nested Module Structure
  • 20. Maven pom.xml – Dependency Relationships Maven Repository org.example:demo:1.1
  • 21. Hooking Maven Plug-ins Maven Into the Build Life Cycle Build Life Cycle Phases validate generate/process-sources process-sources generate/process-resources compile test prepare-package package pre-integration-test integration-test post-integration-test verify install deploy pom.xml
  • 22.
  • 23.
  • 24.
  • 25.
  • 27. Content Licensing Terms for This Work You may present, distribute, copy, or incorporate into your own work, any and all portions of this presentation as long as such copies, or derivative works are made available without charge. If you would like to redistribute this work on any type of fee-for-use or subscription basis, or if you wish incorporate any or all portions of this work into content which you charge for, please contact info <at> buildlackey.com to discuss licensing terms.

Hinweis der Redaktion

  1. Canoo’s test results reports really excel at providing you drill down capability into the exact step of a test that failed. With Canoo’s reports you see a clickable entries for each test run toward the bottom of the page together with a summary of tests run. (pass fail percentages of both tests and individual steps within tests). If you click on an entry for an individual test, you see a page…. (next slide)…
  2. That gives you the pass/fail status of each individual step within the test. You can go right to the failing test and view the resulting response page from the server.. Then you can figure out why the returned content did not match your assertions about what that content should have been.
  3. Canoo’s test results reports really excel at providing you drill down capability into the exact step of a test that failed. With Canoo’s reports you see a clickable entries for each test run toward the bottom of the page together with a summary of tests run. (pass fail percentages of both tests and individual steps within tests). If you click on an entry for an individual test, you see a page…. (next slide)…