Skip to content

Latest commit

 

History

History
105 lines (57 loc) · 2.73 KB

Step3.md

File metadata and controls

105 lines (57 loc) · 2.73 KB

click here to go back to the main README.

Step 3 - Create Unit Test Job

Table of Contents


create Unit Test job

../Back to ToC

Now that our code compiles we would like to run some tests. For Maven we can request to perform a standard set of Unit tests. Other languages might have a different implementation

Go back to your Jenkins Dashboard if not already there.

Go to "New item".

alt text

Enter “Test” as the item name and choose "Freestyle project"

Go to tab Source Code Managemet

alt text

Enter https://github.com/__username__/bootcamp-jenkins-example.git in the field "Repository URL".

Make sure you use your own username

alt text

Go to "Build" and select "ADD BUILD STEP". Choose "Invoke top-level Maven targets".

alt text

Select "M3" in the "Maven Version" dropdown menu.

Enter "clean test" in the "Goals" field.\

Click on "Save"


Run Unit Test job

../Back to ToC

alt text

Now we are going to execute the unit test. Click "Build Now" to start the job.

alt text

Take a look at the outcome.

alt text

Go to the console output and take a look at the error


Fix Code

../Back to ToC

Fix the java code until the job completes

alt text

Note: In order for jenkins to register your new code you need to edit the file locally, commit the changes and push them to your repository. Ask help from one of the instructors if you need If you can't wait for help or can't figure out what went wrong you can follow the alternative Path


Alternative Path

../Back to ToC

Alternatively you can change the branch in the job to one where we fixed the code for you

alt text

Go to Source Code Management.

alt text

in the "Source Code management" tab to "*/step3".

alt text

Re-run the job and take a look at the outcome.


Back to top

click here to go back to the main README.