On back-end, the tests are written using frameworks:
The former support for tests in [TestNG](http://testng.org/doc/index.html) has been removed to make tests writing more simple - the annotations testng vs. junit do not compete with each other. To write load tests, the product [jMeter](http://jmeter.apache.org/) or SoapUI may be used.
Tests classification (super classes are prepared for the individual types):
AbstractReadWriteDtoController
.DefaultFormService
⇒ DefaultFormServiceUnitTest
for unit tests, DefaultFormServiceIntegrationTest
for integration test. Make sure tested class is prefix and use test type as suffix. This provides better overview which test is related to which implementation.
Use TestHelper
for data preparing in integration on rest tests.
Maven has been configured to launch all types of tests.
In case the functionality has already been exactly defined, it is possible to define the tests the functionality will comply with (input, output) already before the implementation itself - the tests can fittingly complete the entering. When the developer submits the functionality for the test / external examination, a test covering the newly developed functionality must exist - the basis is a unit test completed, depending on its type, by integration / workflow or rest test.
On front-end, the tests are written using frameworks:
The tests are placed into the file `test` with the `-test` suffix. In case the functionality has already been exactly defined, it is possible to define the tests the functionality (component, service) should satisfy (input, output) already before the implementation itself - the tests can fittingly complete the entering. Before the developer submits the functionality for test / external examination, the following must exist:
-DdocumentationOnly=true
into maven command.
IdmIdentityDto owner = getHelper().createIdentity((GuardedString) null);
If you need to mock some method of your class, but not the whole class, you can use a Spy. Be careful to use Mockito.doReturn method instead of thenReturn, otherwise the original method will still be called and that can make a mess (see Spying with Mockito). Example of mocking the method "someMethod" of a class "SomeClass" return the "mockValue":
SomeClass partiallyMockedObject = Mockito.spy(new SomeClass()); doReturn(mockValue).when(partiallyMockedObject).someMethod();
To run concrete test class from cmd line run this command from module with tests:
mvn -Dtest=DefaultSchedulerManagerIntegrationTest test -DfailIfNoTests=false
If it's an integration test, it probably needs to run with the test profile:
mvn -Dtest=DefaultSchedulerManagerIntegrationTest test -DfailIfNoTests=false -Ptest -Dspring.profiles.active=test
You can run concrete test with separator # behind class name:
mvn -Dtest=DefaultSchedulerManagerIntegrationTest#testReferentialIntegrityAfterInitiatorDelete test -DfailIfNoTests=false
For all project is required made integration test for all java implementation (eq. processors, filter, service override, helpers, etd.). Frontend tests for overridden components, url isn't needed.
Backend coverage for java implementation is at least 80% of code. This percentage coverage is made by sonar.
After project implement required tests is needed create new project on jenkins.
If you want to run Sonar analysis for some other branch, you may use its tool by clicking on the Help icon (upper-right corner in sonar) → Tutorials → Analyze a new project → generate a token → Java → run the command locally in your command line.