Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
Upcoming SlideShare
Loading in...5
×
 

Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven

on

  • 4,508 views

The most difficult part to test is the WebUI. This part of an application only manually tested. With Selenium you are able to test WebUIs on a simple way. In this article we shows you how to ...

The most difficult part to test is the WebUI. This part of an application only manually tested. With Selenium you are able to test WebUIs on a simple way. In this article we shows you how to automating the test process.

Statistics

Views

Total Views
4,508
Views on SlideShare
3,635
Embed Views
873

Actions

Likes
1
Downloads
68
Comments
0

24 Embeds 873

http://www.thorsten-kamann.de 343
http://www.itemis.de 116
http://sqlandsiva.blogspot.com 107
http://sqlandsiva.blogspot.in 93
http://blog.kamann.info 87
http://www.itemis.com 59
http://sqlandsiva.blogspot.co.uk 15
http://www.slideshare.net 12
http://sqlandsiva.blogspot.ca 9
http://www.blogger.com 8
https://onion.net 6
http://sqlandsiva.blogspot.com.br 4
http://sqlandsiva.blogspot.com.au 2
http://sqlandsiva.blogspot.ie 2
http://209.85.129.132 1
http://sqlandsiva.blogspot.co.nz 1
http://sqlandsiva.blogspot.de 1
http://sqlandsiva.blogspot.no 1
http://sqlandsiva.blogspot.com.es 1
http://sqlandsiva.blogspot.sk 1
http://webcache.googleusercontent.com 1
http://sqlandsiva.blogspot.tw 1
http://209.85.135.132 1
http://sqlandsiva.blogspot.fr 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven Presentation Transcript

  • Thorsten Kamann Software-Architekt, Coach 25.05.2009
  • Webtest? Tools Setup & Run
  • Pitfalls Automatic Tests
  • Only manual Tests Click-Through Testing Different Browser? Only new/changed pages will be tested
  • Execute Test „anywhere and anytime“ Repeatable Tests Avoid the factor „Forgotten“ Old Feature are always tested Non-breakable Features
  • Usable for direct testing of Web-UIs Selenium RemoteControl starts the commands direct in the browser No Java-Implementation of a Browser-Engine Create tests with the Selenium-IDE Export the Testskripts with JavaScript in any target language
  • Dynamic language for the Java-Platform Seamless Integration with jUnit and TestNG Powerful Syntax Easy Learning Toolsupport (Eclipse, Maven, Ant, …)
  • Testframework for Integrationstesting Annotation-based Configuration Parameterized Tests Datasource-Support for creation of testdata Toolsupport (Eclipse, Maven, Ant, …)
  • Buildtool Supports automatically testing Integration of Testframeworks Deklarative Toolsupport(Eclipse, Netbeans, IntelliJ, Konsole)
  • Architecture Usecases Projectsetup Execution of Tests Extensions
  • Tomcat petclinic.war HSQL DB Selenium
  • Run Tests Start Selenium Deploy Webapp Start Tomcat Compile
  • Usecase-driven Tests Definition of every User-Action Definition of Inputdata Definition of Return Values Recording with Selenium-IDE
  • m2Eclipse GroovyIDE TestNG
  • Java-Project Maven DM Groovy
  • DM: Groovy DM: TestNG
  • Groovy <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>1.5.6</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.5</version> <classifier>jdk15</classifier> <optional>true</optional> <scope>test</scope> </dependency> TestNG with JDK5 Annotation-Support
  • testsuite.xml Grouping of Tests • Packages • Groups • Include/Excludes Definition of Parameter
  • Parameter <suite name=„webtest-reloadedquot;> <test name=„firefox-testsquot; annotations=quot;JDKquot;> <parameter name=quot;browserquot; value=quot;firefoxquot;/> <groups> <run> <include name=quot;it-testquot;></include> </run> </groups> Groups <packages> <package name=quot;selenium.groovy.testngquot;/> </packages> </test> </suite> Packages
  • Export of Testcases PHP, C#, Java JavaScript for Export Language Any Target Language is supported
  • function assertTrue(expression) { return quot;AssertJUnit.assertTrue(quot; + expression.toString() + quot;)quot;; } function assignToVariable(type, variable, expression) { return type + quot; quot; + variable + (expression)? quot; = quot; + expression.toString(): quot;quot;; }
  • public class NewTest { Selenium selenium String baseUrl = quot;ENTER_BASEURL_HEREquot; @BeforeClass(groups=[quot;it-testquot;]) public void beforeClass(){…} @BeforeMethod(groups=[quot;it-testquot;]) public void startSelenium(){…} @AfterMethod(groups=[quot;it-testquot;]) public void stopSelenium(){…} @Test(groups=[quot;it-testquot;]) public void executeIntegrationTest { … } }
  • Maven Surefire-Plugin • Deactivate Lifecycle test • Activate Lifecycle integration-test • Integrate TestNG‘s testsuite.xml
  • Deactivate Lifecycle test <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> Activate <executions> Lifecycle integration-test <execution> <phase>integration-test</phase> <configuration> <skip>false</skip> <suiteXmlFiles> <suiteXmlFile>src/test/config/it-suite.xm</suiteXmlFile> </suiteXmlFiles> </configuration> </execution> Integrate </executions> testsuite </plugin>
  • pre-integration-test Deploy Start Tomcat Webapp post-integration-test Undeploy Stop Tomcat Webapp
  • <<Sourcecode too long… please see the sample project>>
  • pre-integration-test Optional: start-server Prepare Firexox profile post-integration-test stop-server
  • Start Selenium-Server <plugin> <artifactId>selenium-maven-plugin</artifactId> <executions> <execution> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <background>true</background> <firefoxProfileTemplate> Prepared Firefox … Profile </firefoxProfileTemplate> </configuration> </execution> </executions> </plugin>
  • mvn –e surefire-report:report-only mvn –e clean integration-test
  • Run As -> TestNG Test Start Selenium Standalone
  • Different Browser Different OS Virtualizing
  • SpringAOP Performance of Methods Performance of Views Stresstests
  • http://selenium.openqa.org/ http://testng.org/ http://groovy.codehaus.org/ http://maven.apache.org/ http:/www.thorsten- kamann.de/weblog/publications/webtests- reloaded-webtests-mit-selenium-testng- groovy-und-maven