Skip to main content

Selenium Integration with TestCollab in CI/CD Process

Integrate Selenium test reports with TestCollab in a CI/CD pipeline

Updated over a week ago

⚠️ This article is deprecated. The custom Selenium integration scripts have been replaced by the TestCollab CLI (@testcollab/cli), which works with any test framework that outputs JUnit XML — including Selenium with JUnit/TestNG/pytest reporters. Please refer to Uploading Test Results Using TestCollab CLI for the new approach, along with ready-to-use pipeline examples for GitHub Actions, GitLab CI/CD, Jenkins, Azure Pipelines, and Bitbucket Pipelines.


In this article we will learn how to integrate Selenium and TestCollab in CI/CD pipeline using our Github repo.

Prepare your TestCollab instance

We recommend creating a tag named 'ci' or with a similar name, to cluster all test cases that are part of your CI/CD pipeline. Apply this tag to required test cases. These are the test cases which will be included in your report for every build.

  1. Select a project > Click 'Tags' under test cases tab on left

  2. Create a tag

  3. Keep a note of the tag id, from "..." and hovering edit link (you will need this later)

Also obtain your

  • project id,

  • company id, and

  • user id that these test report will be assigned to.

In case of CI/CD pipelines, although the test execution is fully autonomous, but TestCollab still requires an assignee to be present. This could be your own user id.

Setup

  • Initialize env file

    cp sample.env .env

  • Fill all the related values in .env

    NODE_ENV=production
    TESTCOLLAB_API_KEY=
    TESTCOLLAB_PROJECT_ID=
    TESTCOLLAB_CI_TAG_ID=
    TESTCOLLAB_ASSIGNEE_ID=
    TESTCOLLAB_COMPANY_ID=

Firing a test run

Let's trigger our selenium test cases now (this will open chrome)

npm run test

Next, we'll create a test plan in your TestCollab project.

npm run createTestPlan

At this point you'll be able to see this new test plan under Test Plans menu. However, all test cases will show up as 'Unexecuted' as shown in image below:

Unexecuted test plan created in TestCollab using createTestPlan command

After all the test cases are done, you'll see the report file: ./mochawesome-report/mochawesome.json

Now, finally, we will send the results to TestCollab:

npm run report

Test plan gets finished status in TestCollab
Did this answer your question?