Custom tests

Set up and run custom tests as part of your build process

🚧

Advanced feature

Support for custom testing steps is an advanced feature of Nevercode and will require additional setup.

In addition to the tests automatically recognized and executed by Nevercode, you can run any other tests as part of your build process. The first step is to ensure that your test framework and any dependencies are installed in the VM during the build. If this does not already happen (e.g. as part of your build's npm install step, if you have it), add the necessary instructions to a post-clone script. To actually run the tests, you then need to add a post-build script with the necessary command(s).

Some test runners will return a non-zero exit code if any of the tests fail. Normally, Nevercode halts the build if any of the custom build steps produce such an error. To prevent this from happening in the post-build testing script, append || : to the command invoking the test runner. e.g.

run_my_tests || :

This way, the script will return the exit code of the null command, denoted by :, which is always 0.

Currently, Nevercode is able to parse results of custom test runs from XML output in the xUnit format. Consult the documentation for your testing framework to see how you can configure the test runner to yield such output. The XML file(s) must be created in the directory referenced by the $NEVERCODE_XUNIT_RESULTS_DIR environment variable. All together, your post-build testing script should look something like this:

run_my_tests --output-xUnit-XML --output-dir=$NEVERCODE_XUNIT_RESULTS_DIR || :

Some testing frameworks do not allow such level of configuration from the CLI. In these cases, you will need to make the necessary changes to the test runner config file and make sure that it is included in version control.

For a specific in-depth example of configuring custom testing steps, please see our documentation for Testing hybrid applications.

Updated 2 years ago

Custom tests


Set up and run custom tests as part of your build process

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.