Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
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 Vigges Developer Community for programmer and developer-Open, Learning and Share
...