Hi devs,
Right now we’re struggling with our functional tests, and especially with flickers. In the past and during STAMP I’ve tried to implement a strategy to handle flickers. It’s currently not working that great (known flickers are not recognized for example).
I’ve started listing some use cases that we may for the tests executing on our CI.
Use Cases
- UC1: List the slowest executing tests (so that we can work on the slowest and more generally monitor the speed of our test, by graphing their speed over time)
- UC2: List the most flickering tests (so that we can focus on them)
- UC3: List known flickering tests (those registered in JIRA and open)
- UC4: List discovered flickering tests (3 changes of state in the past 20 executions for example)
- UC5: List the slowest unit tests (to be sure we don’t have unit tests that take too long)
- UC6: Are there flickering tests which haven’t passed at least once during the current release timeframe (to help decide if we can release)?
Implementation
- Implement JUnit5
TestListener
and when a test succeeds or fails, log it in our Elastic Search instance (the one we currently use for ActiveInstalls ) under a different index of course). - Log the following information
- job name
- job number
- test id
- execution date
- execution time
- hostname
- is it a functional test or a unit test
- the exception if the test fails
- the console log if the test fails (found with system.out/err capture)
- is it a known flicker at time of execution
- Impl note: the jenkins info can be retrieved from java using system properties.
- Create some Kibana dashboard to implement the UC listed above.
This should allow us to keep a test database of all our test executions on the CI and see how it evolves. It allows to implement a lot more use cases than the ones listed, for example graph the number of tests executed over time, etc.
Other
- Jenkins has a Logstash plugin to send the job logs to an ES instance (https://plugins.jenkins.io/logstash/). However, 2 limitations with this (for test data);
- The data would be sent only when the maven build is finished (no realtime data)
- It’s going to take a lot of disk space (OTOH it could be interesting to have the job logs on ES for easier searching but in this case we might need a different ES instance).
- Regarding showing known flickers in the job UI on jenkins, we could also query the ES instance at the end of a build to update the UI accordingly and list the flickers.
WDYT?