CI/CD with Visual Builder Studio: publishing test results with JUnit, an example for Node.js language

Visual Builder Studio has builds, like Jenkins builds. In this post we are configuring junit to publish test results in the build job.

In the jobs details page we have several interesting icons, one of them is Tests.

When test code is in place in the git repo associated with the build job, test results can be published in the job and by clicking the Tests icon you’ll get details regarding the test performed by the test engine as shown below.

Configuring test execution

In the case of Node.js app we have selected one of the common technologies utilised for testing like Mocha.

To execute test add a Unix Shell step in the [Steps] section of the job configuration page and put the following:

npm install -g mocha mocha-junit-reporter
mocha test --reporter mocha-junit-reporter 

Therefore, if your git repo has a test directory with some test code stuff in it, testing will be performed

Configuring test results publishing

For the results publication part, goto [After Build] section of the job configuration and add a JUnit Publisher action. In the case of Mocha, results are produced in files with xml extension, therefore that is the pattern to include in the action configuration as shown below.

That’s all folks, hope it helps! 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.