Ever since i started working with CircleCi at Sauce it bothered me that we don’t use what it has to offer to the fullest and this is especially so with tests circleCi has this really neat way of showing test results as shown below
despite how nice doing this looks it also has another really useful feature it allows you to do splitting and parallelism on jobs this means jobs but specifically, a test can be split across say 4 machines and split up by the time it took to run the tests.
When you perform tests and deliver the data to CircleCi it will in such a way that you get the nicely presented test page it will also send a test duration and filename to CircleCi that can be reused by a CircleCi’s Virtual Machines to generate a list of test files where each list should approximately take the same amount of time to complete this means that the tests can be completed within a lot shorter amount of time on average.
<testcase
file="test/acceptance/authentication/session_creation_acceptance_test.exs"
classname="Elixir.Acceptance.SessionCreationAcceptanceTest"
name="test Will provide an authenticated user if a correct email "
time="2.6037"
/>
This can be done with all languages with the simple usage of the store_test_results
step in circle ci as demonstrated below however ive taken some time to create a Orb for CircleCI that should do all the heavy lifting for you, you can find all the information about this in the further reading section of the article however be aware that this Orb is WIP
- store_test_results:
path: _build/test/lib/<< parameters.project-name >>
Elixir Sadly doesn’t natively support the generation of JUnit style test results however there is a brilliant library by victorolinasc
called junit_formatter
that has a lot of amazing features with very little effort to configure a guide on how to do this can be found here however it should be noted that the config for the formatter should be at least set up as shown below at the least
config :junit_formatter,
print_report_file: true,
include_filename?: true
all that now needs doing is adding this to your workflow which is as simple as using the store_test_results
step this can all be found in more detail in the additional reading area to the right.
Hopefully, you more experienced developers found this as insightful as i did.
💻 Junior Developer 📞 The Support Team 🌐 Fluent in English and Python