Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

Selenium JavaScript - How to set test id in Jest test cases

I want to set an id to each test in Jest so that I can uniquely identify them.

It is something similar to @TestParamters/ @Parameters in TestNG.

Here - https://www.gurock.com/testrail/docs/api/reference/results#addresult . If you look the end-point given here, it ask for :test_id.

So, I also want to give an id to each of my test cases and fetch that id in TestRail.

question from:https://stackoverflow.com/questions/65670729/selenium-javascript-how-to-set-test-id-in-jest-test-cases

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check @jest-reporters/testrail plugin. It is a TestRail module for Jest. Helps to create test runs on TestRail for multiple suites and send results.

First, install the plugin

npm i @jest-reporters/testrail

Second, update jest.config.js

module.exports = {
  ...
  reporters: [
    ["testrail", {
      project_id: "1"
    }]
  ]
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...