kualitee_cypress v0.3.4-beta
kualitee_cypress
This package is for Kualitee users.
Core features
- To generate report on kualitee from cypress.
- Integration kualitee with cypress, execute the scenario from kualitee and map the status if you are using cucumber in cypress.
Table of Contents
Install kualitee_cypress
:
NPM
npm install kualitee_cypress
Post Report to Kualitee
If you are using Kualitee testing tool then you can generate the execution cycle on Kualitee by following these steps.
Step 1: Configure the kualiteeConfigs
to package.json
"kualiteeConfigs": {
"token": 'userToken',
"projectId": 'projectId',
"reportPath": 'path/to/report'
}
kualiteeConfigs
token: string The user token you can get from the Kualitee tool you are using.
projectId: string Project id on Kualitee tool with which the tests are associated.
reportPath: string The path in the cypress project where reports generate like cypress/e2e/reports
.
Step 2: Import or require the postResult from kualitee_cypress
import
or require
(as your project demand) the postResult
method in cypress.config.js
.
const { postReport } = require("kualitee_cypress");
module.exports = defineConfig({
//implement testing logics here
})
Usage
Now the package is ready to use in your project. You can use either with e2e
testing or with component testing
.
End-to-End Testing
Under youre2e
setupNodeEvents
method, call cypress APIon("after: run", () => { })
and call the method with returnpostResult()
.
const { postReport } = require("kualitee_cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on("after:run", () => {
return postReport();
});
},
},
});
After configuration run the cypress
in terminal (npx cypress run
) or your custom command.
Component Testing
const { postReport } = require("kualitee_cypress");
module.exports = defineConfig({
component: {
setupNodeEvents(on, config) {
on("after:run", () => {
return postReport();
});
},
},
});
After configuration run the cypress
in terminal (npx cypress run --component
) or your custom command.
Outputs
On completion of cypress run, you will get the Successfull
or Error
message in terminal.
Execute scenario from kualitee and map the results
First, you need to Integrate Kualitee with Cypress, This integration involves configuring Kualitee to run Cypress tests and receive results. So, you need to follow these steps.
Prerequisites
- Installed
kualitee_cypress
in your Cypress project. - Cypress must have a Cucumber integeration.
- Scenerios must be written in BDD format
- Able to run a single scenario by using tag in cypress.
- You need to add a unique tag for both Feature
(test scenario in kualitee)
and Scenario(test case in kualitee)
.
Step 1: Add tags
You need to add a unique tag for both feature and scenario with a prefix @kts_ and @ktc_ respectively. For example @kts_login
instead of @login for a feature and for scenario add tag like @ktc_success_login
instead of using only @success_login and these should be the same as in Kualitee.
Step 2: Host your cypress project on a server
This is mandatory to host your cypress project on the server by which you can run your scenarios from Kualitee by tags.
Step 3: Set up an express server
Set up a server and expose an API. Following is the example of an express server you can use it as template.
const express = require('express')
var cors = require('cors');
var bodyParser = require('body-parser')
const app = express()
app.use(cors());
app.use(bodyParser.json())
const port = 3000
const hostname = 'localhost';
app.post('/script-run', (req, res) => {
});
app.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`)
})
note:- Here you need to design proper route in app.post() function and use it in integration Kualitee with Cypress.
Step 4: Include kualitee_cypress
If you are working in CommonJS environment then include in server file like
const {executeTestCase} = require("kualitee_cypress")
If you are working in ES6 (ECMAScript 2015) module system then include in server file like
import { executeTestCase } from 'kualitee_cypress';
Step 5: Call the method in kualitee_cypress
You need to call the method executeTestCase in express app.post() function routes (which you used in kualitee to integrate kualitee with cypress) with three arguments.
app.post('/script-run', (req, res) => {
executeTestCase(req, res, 'path/to/report')
});
Arguments
req: It is the request body and it will pass as it is req.
res: It is the response body and it will pass as it is res.
path/to/report: string The path in the cypress project where reports generate like cypress/e2e/reports
.
Now you can execute the Scenario from Kualitee tool.
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago