Assuming that you already use Maven for your Java project, you can configure a profile for each test scenario that later a Jenkins job will run.
Things you need before completing this mission:
- Your Java project(configured as Maven project) with some Junit tests
- Jenkins installed
- A Jenkins job configured to pull your test code using git or other SCM
Some explanations:
1. test is the maven goal and it should never be changed. It tells Jenkins to look for a profile id called "unitTests" (-P stands for Profile), and run all Junit tests that are included in the profile under the "Includes" section. (It is also possible to exclude test and do a lot more. for more info see surefire documentation.
2. As you can see, it is possible (and you should use for making your test framework more flexible and easy to configure between environments, browsers, etc) to send parameters from the job settings to the test themselves. In this job the parameters are: browser and remote machine. You can later access these parameters from the Java code using System.getProperty
1. test is the maven goal and it should never be changed. It tells Jenkins to look for a profile id called "unitTests" (-P stands for Profile), and run all Junit tests that are included in the profile under the "Includes" section. (It is also possible to exclude test and do a lot more. for more info see surefire documentation.
2. As you can see, it is possible (and you should use for making your test framework more flexible and easy to configure between environments, browsers, etc) to send parameters from the job settings to the test themselves. In this job the parameters are: browser and remote machine. You can later access these parameters from the Java code using System.getProperty