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
- Host: GitHub
- URL: https://github.com/prashanth-sams/qmetry-cucumber
- Owner: prashanth-sams
- License: mit
- Created: 2024-09-25T16:13:17.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-08T09:56:49.000Z (7 months ago)
- Last Synced: 2025-04-12T07:17:53.611Z (25 days ago)
- Topics: automation, bdd, cucumber, qmetry, qmetry-cucumber, qmetryintegration, qtm4j, report, reporter, reporting, results, test, testing
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/qmetry-cucumber/
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README

# qmetry-cucumber
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 successfullyExamples:
| 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
```