Configuration for JUnit test execution on multiple environments Configuration for JUnit test execution on multiple environments jenkins jenkins

Configuration for JUnit test execution on multiple environments


The precondition for running a single test is having a Run Configuration for each test case that will specify the default execution environment. Please note that this setting has to be done locally per test case.

In the Eclipse Arguments tab/VM Arguments filed the VM parameter has to be specified:

-DappConfig=src/test/resources/pp1.environment.properties

It holds the path to the respective property file having the environment login details.

There are five property files defined under src/test/resources source folder of the project:

environment1.propertiesenvironment2.propertiesenvironment3.propertiesenvironment4.propertiesenvironment5.properties


WHITE BOX TESING:

UnitTests should test the unit of work and not depend on dependencies. The general rule is to mock dependencies and stub external systems so you have a safe environment to test.

IntegrationTests should somehow inject the real dependencies in a safe environement and do their tests.

BLACK BOX TESTING:

FunctionalTests is what i suppose you want to achieve. Usually you can use the same config from the integration tests, bundle all the automated tests in the projects pom and on every mvn clean isntall execute atomaticly the tests. The general flow is to startup a servlet container in the pre-integration-test phase and do your test against it. You should always test from the user perspective.