My own testrail reporter.
- The goal of this project is parse data from junit reporter and send results of tests to Tetsrail API via Axios.
- Requirements are only send passed/failed with possible feature extensions in the future.
- All essential magic takes place in node events and with hooks in cypress.config.js file.
- Results are parsed, merged and preprocessed in /results folder
- notice: It works well in headless mode, but in interactive mode it should don´t works well due to experimental mode with - experimentalInteractiveRunEvents, see: plugins documentation.
- Cypress is most popular JS/TS test framework for writing automated tests.
- Testrail is most popular test management tool with many functions.
- Motivation for make this project are improvement myself in coding in javascript and try to make very first open source project.
- check your project ID and set up it in .env file ... and others configuration in .env setup: .env setup
# project ID:
TR_PROJECT_ID = <ID number of your Testrail project>
- You have enabled api:
- Testcases with Case ID´s are created:
- Valid structures:
describe('Test suite 1', () => {
before(() => {
cy.visit('https://<myTestPage.com>')
})
it('C1 - h1 is visible test', () => {
cy.get('h1').should('be.visible')
})
it('C2 - anchor with caption "Ahoj!" test', () => {
cy.get('a').contains('Ahoj!').should('be.visible')
})
it('C3 - Button with caption "GO!" test', () => {
cy.get('button').contains('GO!').should('be.visible')
})
})
- or nested context/describe
describe('Test suite 1', () => {
before(() => {
cy.visit('https://<myTestPage.com>')
})
it('C1 - h1 is visible test', () => {
cy.get('h1').should('be.visible')
})
context('Other section', () => {
it('C2 - anchor with caption "Ahoj!" test', () => {
cy.get('a').contains('Ahoj!').should('be.visible')
})
it('C3 - Button with caption "GO!" test', () => {
cy.get('button').contains('GO!').should('be.visible')
})
})
})
-
Testrail installation with test cases corellates with case ID´s.
-
Cypress version >= 10.x.x
-
Tested on node version: v18.18.1, npm version 9.8.1
-
Create in folder /cypress/e2e/*.cy.js tests which exists in your Testrail installation with case ID like: Cxxxx, which x means Testrail ID number.
clonning repo:
git clone https://github.com/miroslavmyrha/cypress-testrail-turbo-reporter.git
cd /<project>
npm install
npm cypress run
optional you can use npx
npx cypress run
Create .env file in root of the project
# credetials:
TR_USERNAME = "<email>"
TR_PASSWORD = "<password>"
# project ID:
TR_PROJECT_ID = <ID number of your Testrail project>
# name of new testrun:
TR_NAME = "<Name of your automated testrun, it´s fully up to you how you want to name it>"
# description of testrun:
TR_DESCRIPTION = "<Description of your automated testrun, it´s fully up to you how you want to name it>"
# create testrun:
TR_URL = "https://<your Testrail installation>.testrail.io/index.php?/api/v2/add_run/"
# get last testrun id:
TR_GET_TESTRUN_ID = "https://<your Testrail installation>.testrail.io/index.php?/api/v2/get_runs/"
# push results:
TR_RESULTS = "https://<your Testrail installation>.testrail.io/index.php?/api/v2/add_results_for_cases/"
# close testrun:
TR_CLOSE_TESTRUN = "https://<your Testrail installation>.testrail.io/index.php?/api/v2/close_run/"
TO-DO
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Grab some issue and fix it :) Issues