1. To Run Single test :
npx cypress open --config testFiles="/Users/rajeshvarma/Documents/CypressProj/cypress/integration/UIScripts/tc1.spec.js" ---------------------------------------------------------------------------------------------------------------------------
2. To run cypress multiple test cases option:
npx cypress open
---------------------------------------------------------------------------------------------------------------------------
3. crossbrowser testing:-
$ npx cypress run --browser chrome --spec “cypress/integration/examples/tests/e2e_test.spec.js”
update package.json file with below entries for crossbrowser:
| "scripts": { |
| "cy:run:chrome": "cypress run --browser chrome", |
| "cy:run:firefox": "cypress run --browser firefox" |
}
---------------------------------------------------------------------------------------------------------------------------
4. Cypress reporting:-
$ npm install mochawesome. OR. $ npm install junit
update cypress.json file with below entries :-
| { |
| "reporter": "mochawesome", |
| "reporterOptions": |
| { |
| "reportDir": "cypress/results", |
| "overwrite": false, |
| "html": true, |
| "json": true |
| } |
}
$ npx cypress run --reporter mochawesome --spec “cypress/integration/examples/tests/e2e_test.spec.js”
Cypress.json config file for JUnit:--
| { |
| "reporter": "junit", |
| "reporterOptions": |
| { |
| "reportDir": "cypress/results", |
| "mochaFile": "results/my-test-output.xml", |
| "toConsole": true |
| } |
}
$ npx cypress run --reporter junit \ --reporter-options “mochaFile=results/my-test-output.xml,toConsole=true”
---------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment