Skip to main content

Install Jenkins and configure it to Run Maven with TestNg Selenium

Steps to Install Jenkins and configure it to Run Maven with TestNg Selenium


Installation
Step 1) Go to http://jenkins-ci.org/and download correct package for your OS. Install Jenkins.
Step 2) Unzip Jenkins to specified folder. Run exe file as shown in following screenshot:
Step 3) In Jenkins 1.607 Setup window click on Next button.
Step 4) Click on Install button in the end.
Step 5) Once installation is done, navigate to the Jenkins Dashboard (http://localhost:8080 by default) in the browser window.
Step 6) Click on the New Item link to create a CI job.
Step 7) Select the Maven project radio button as shown in the following screenshot:
Using the Build a Maven Project option, Jenkins supports building and testing Maven projects.
Step 6) Click on OK button. A new job with name "WebdriverTest" is created in Jenkins Dashboard.
Step 7) Go to Manage Jenkins => Configure System as shown in the following screenshot.
Click on JDK installations and configure JDK as in the following screenshot:

Step 8) Go to the Build section of new job.
  • In the Root POM textbox, enter full path to pom.xmlin
  • In Goals and options section, enter "clean test"

Step 9) Click on Apply button.
Step 10) On the WebdriverTest project page, click on the Build Now link.
Maven will build the project. It will then have TestNG execute the test cases.
Step 11) Once the build process is completed, in Jenkins Dashboard click on the WebdriverTest project
Step 12) The WebdriverTest project page displays the build history and links to the results as shown in the following screenshot:
Step 13) Click on the "Latest Test Result" link to view the test results as shown in the following screenshot:
Step 14). Select specific build, and you will see the current status by clicking on "console output".

Scheduling Jenkins for automatic execution.

Scheduling builds(Selenium Tests) is one of the important features of Jenkins where it automatically triggers the build, based on defined criteria. Jenkins provides multiple ways to trigger the build process under the Build Trigger configuration.
For example:
Enter 0 23 * * * in the Schedule textbox as shown in the following screenshot. This will trigger the build process every day at 11 p.m.

Using Jenkings without Maven

To run pure TestNg script in Jenkins, enter the following in build
D:>java -cp "Pathtolibfolder\lib\*;Pathtobinfolder\bin" org.testng.TestNG testng.xml
  • Click on Save button.
  • Note: The actual path of lib and bin folder need to add in above command.
  • After saving the command, Jenkins will build project in predefined time, and this command will be run using TestNG.
  • Result will be stored in custom report HTML file that can be sent via email with a Jenkin configuration
  • Output of the code will be

Benefits of using Jenkins

  1. Early issue finding – Bug can be detected in early phase of the software development
  2. Automatic integration – no separate effort required to integrate all changes
  3. Installer – a deployable system available at any point of development
  4. Records – part build records maintained
  5. Support and Plugins: One of the reasons for Jenkin's popularity is the availability of large community support. Also, lots of ready-made plugins are available which help you expand its functionality.

Comments

Popular posts from this blog

Testing Types

         Installation testing Main article: Installation testing An installation test assures that the system is installed correctly and working at actual customer's hardware. Compatibility testing Main article: Compatibility testing A common cause of software failure (real or perceived) is a lack of its compatibility with other application software, operating systems (or operating system versions, old or new), or target environments that differ greatly from the original (such as a terminal or GUI application intended to be run on the desktop now being required to become a web application, which must render in a web browser). For example, in the case of a lack of backward compatibility, this can occur because the programmers develop and test software only on the latest version of the target environment, which not all users may be running. This results in the unintended cons...

Software Testing Basics - Software Testing Interview Questions and Answers

1. Can you explain the PDCA cycle and where testing fits in? Software testing is an important part of the software development process. In normal software development there are four important steps, also referred to, in short, as the PDCA (Plan, Do, Check, Act) cycle. Let's review the four steps in detail. Plan:  Define the goal and the plan for achieving that goal. Do/Execute:  Depending on the plan strategy decided during the plan stage we do execution accordingly in this phase. Check:  Check/Test to ensure that we are moving according to plan and are getting the desired results. Act:  During the check cycle, if any issues are there, then we take appropriate action accordingly and revise our plan again. So developers and other stakeholders of the project do the "planning and building," while testers do the check part of the cycle. Therefore, software testing is done in check part of the PDCA cyle. 2. What is the difference between white box,...

New to software testing? Want to learn more about your craft? Come and join us at the Software Testing Club

Software testing Software testing  is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects). Software testing can be stated as the process of validating and verifying that a computer program/application/product: Meets the requirements that guided its design and development,  works as expected, can be implemented with the same characteristics,  and satisfies the needs of stakeholders. Software testing, depending on the testing method employed, can be implemented at any time in the development process. Traditionall...