An open API service indexing awesome lists of open source software.

https://github.com/prashanth-sams/qmetry-cucumber

Sync cucumber automation test results with Qmetry Test Cycle
https://github.com/prashanth-sams/qmetry-cucumber

automation bdd cucumber qmetry qmetry-cucumber qmetryintegration qtm4j report reporter reporting results test testing

Last synced: 25 days ago
JSON representation

Sync cucumber automation test results with Qmetry Test Cycle

Awesome Lists containing this project

README

        

![NPM Version](https://img.shields.io/npm/v/qmetry-cucumber)
![NPM Downloads](https://img.shields.io/npm/dy/qmetry-cucumber)

# qmetry-cucumber
![qmetry-cucumber](https://github.com/user-attachments/assets/e2634d60-e8f6-4739-8d07-f67b90742376)

Sync cucumber automation test results with Qmetry Test Cycle

## Getting Started
```
npm install --save-dev qmetry-cucumber
```

## How to use

#### Case #1 Open API

> Create `qmetry.config.json` file in the test project's root folder and add the below configurations.

##### qmetry.config.json
```
{
"baseUrl": "https://",
"apiKey": "",
"authorization": "",
"projectId": ,
"testCycleId": ,
"summary": "",
"description": ""
}
```
Here, `testCycleId`, `summary` and `description` fields are optional.

##### Feature
```
Scenario: [PRO-TC-1] [PRO-TC-2] User logs in with valid credentials
When User login with the username "" and password ""
Then User should be logged in successfully

Examples:
| USERNAME | PASSWORD |
| admin | amin |
```

##### hooks.ts
```
import { updateQmetryStatus } from "qmetry-cucumber";

After(async function ({ pickle, result }){
updateQmetryStatus(pickle.name, result.status);
});
```

#### Case #2 Automation API

> Submit the Cucumber test output in JSON format to QMetry using the Automation API. To achieve this, create a `qmetry.config.json` file in the root directory of your test project and add the following configurations.

##### qmetry.config.json
```
{
"baseUrl": "https://",
"authorization": "",

"automationApiKey": "",
"automation": {
"format": "cucumber"
}
}
```
Here, `baseUrl`, `authorization`, `projectId`, `automationApiKey`, and `automation > format` are the only mandatory fields. For more optional fields, check below:

```
{
"baseUrl": "https://",
"authorization": "",
"projectId": 0,

"automationApiKey": "",
"automation": {
"format": "cucumber",
"attachFile": true,
"isZip":false,
"build":"",
"fields":{
"testCycle":{
"labels": [""],
"status":"Done",
"summary": "",
"description": "",
"customFields": [
{
"name": "",
"value": ""
}
]
},
"testCase":{
"labels": [""],
"description": "",
"customFields": [
{
"name": "",
"value": ""
}
]
}
}
}
}
```

##### .ts
Invoke the `sendTestResultToQmetry` function immediately after executing the cucumber tests.
```
import { sendTestResultToQmetry } from "qmetry-cucumber";

execSync(`npx cucumber-js --config=config/cucumber.js --tags "@smoke"`, { stdio: 'inherit' });
sendTestResultToQmetry(process.cwd() + '/test-result/reports/cucumber-report.json');
```

## Test
```
npm test
```