& Integration with
Selenium
What is Jenkins? • Jenkins is one of the best open-source continuous integration tool produced by Hudson lab. • It is cross-platform and can be used on Windows, Linux, Mac OS and Solaris environments. • Jenkins is written in Java. • Jenkin's is mainly used to monitor any job which can be SVN checkout, cron or any application states. • It fires pre-configured actions when a particular step occurs in jobs.
Features of Jenkins? Email integration
Easy Configuration
Easy Installation
Multiple VMs
Permanent Links
Change Support
TestNG test
Project build
Features
Plugins Configuration
What is Maven? •Maven is an automation and control tool produced by Apache Software Foundation. • Maven is a strong build automation tool specially used for Java projects. • Maven is based on the theory of a Project Object Model(POM) that combines project and configuration information like construction or source directory, province, test source list, plugins, etc.
Why Jenkins & Maven with Selenium? • Selenium WebDriver is a famous tool for browser automation. • But, when we use selenium for testing and building a test framework, it seems underpowered. • Maven integration with Selenium gives the below advantages: Maven is used to determining project structure, provinces, build, and test management. Maven automatically downloads the required files from the container while developing the project. Using Maven you can configure dependencies required for building testing and running code. Apache Maven gives support for running the entire lifecycle of a test project.
Maven with TestNg in Selenium Installation • Here we will use Eclipse (Juno) IDE for Java Developers integration • Also to do the build process and generate pom.xml file, we require to add an m2eclipse plugin to Eclipse Add m2eclipse plugins to Eclipse
In Eclipse IDE, choose Menu >> Help >> Install New Software
Now in the Install dialog box, add the below URL http://download.eclipse.org/technology/m2e/releases/.
Choose work with and m2e plugins and click on Next and then Finish Button.
Maven Configuration with Eclipse
1
2
Continue…
3
Continue…
4
Add WebdriverTest in Group Id: and Artifact Id: and then click on finish button
Continue…
5 Eclipse will form WebdriverTest as shown below:
6
Eclipse will form WebdriverTest as shown below:
Continue…
7 From Project Explorer, choose pom.xml
Continue‌
8
In the <project> node, add the Selenium, Maven, TestNG, Junit dependencies
Continueâ&#x20AC;¦
9
Now create a New TestNG Class and add "example" in Package name and "NewTest" in the Name: textbox and then click on the Finish button
It will create a NewTest class
Continueâ&#x20AC;¦ 10
In NewTest class, add below code:
Continueâ&#x20AC;¦ 11
In NewTest class, add below code:
Continueâ&#x20AC;Ś 12
On the WebdriverTest, right click and choose TestNG >> Convert to TestNG. Eclipse will generate testng.xml which states that you require to run only NewTest.
Continueâ&#x20AC;Ś 13
Now we require to run a test by this testng.xml. So, go to the Run Configurations and create a new launch TestNG, choose the project and field Suite as testng.xml and click Run
Continue… 14
Also, we require to add below files and plugins, • maven-compiler-plugin • maven-surefire-plugin • testng.xml • to pom.xml.
Continueâ&#x20AC;Ś 15
Now, to run the tests in the Maven lifecycle, on the WebdriverTest , right-click and choose Run As >> Maven test. Maven will execute test from the project.
Conclusion • So here we learn about what is the Maven and Jenkins? • Also learn the integration process of Maven and Jenkins with Selenium. • As a Fresher or experiences Software Tester, it will help you to perform this integration task step by step here. References: Integrating Maven & Jenkins with Selenium Maven & Jenkins Integration with Selenium: Complete Tu torial
Contact Us
info@nexsoftsys.com
+1-646-971-0799 www.nexsoftsys.com