Jenkins Job Conf (Maven Project)

1.)Create New Item under Jenkins Home, (Top Left side).

2.)Under Maven project give Task name.

3.)Click OK and proceed to next window.

4.)Under Source Code management section select "Git" and provide Repository URL and User credentials.

5.)Select branch if you want to access code from branch other then master(default master).
If You select branch, Then Git Parameter should be setup on top of Job Conf, and for this Git Parameter Plug-In should be installed on Jenkins.

Select," This project is parameterized" , add "Git Parameter", and add Name as branch_selector, and Description(Optional) Select Parameter Type as Branch.

6.)Under Build Triggers section set Time by clicking on Build Periodically(Set time), If you want to build your project periodically.

7.)Under Build Environment  select 
A.)Start Xvfb before the build, and shut it down after.
B.)Set jenkins user build variables.

8.)Under Build --Set Build steps.
        A.) Root POM "pom.xml"
        B.)Goals and options "clean package"

9.)Under Post Steps
Add post-build step as Execute Shell and write the command.
java -cp /viaindex/jenkins/workspace/IN_B2B_AllProduct/target/via-test-automation-4.0.0-jar-with-dependencies.jar org.testng.TestNG /viaindex/jenkins/workspace/IN_B2B_AllProduct/src/main/resources/Agent/testng_B2B_AllProduct.xml

You can also set Post-buils Actions, for downstream,

For custom test result mail, You can first make package (jar) of your project, after in post build-step, you can run your             command using terminal by selecting Execute shell. (Please not use windows batch command, it creates temporary file         which will not execute many times showing error file not found.)
        Run testng xml the shell command is as follow:
                java -cp path_to_jar org.testng.TestNG path_to_testNG_xml

        All path must be absolute.
Now Save the configuration and build the project.

Comments

Popular posts from this blog

API Automation using Rest Assured

Security Testing

Manage Jenkins