Simplified version of XrayApp's playwright-junit-report to support Sonarqube's Generic Data Test Execution format.
Run the following commands:
npm install @bdellegrazie/playwright-sonar-reporter --save-dev
yarn add @bdellegrazie/playwright-sonar-reporter --dev
Most likely you want to write the report to an xml file. When running with --reporter=@bdellegrazie/playwright-sonar-reporter
, use PLAYWRIGHT_SONAR_OUTPUT_NAME
environment variable:
PLAYWRIGHT_SONAR_OUTPUT_NAME=results.xml npx playwright test --reporter=@bdellegrazie/playwright-sonar-reporter
set PLAYWRIGHT_SONAR_OUTPUT_NAME=results.xml
npx playwright test --reporter=@bdellegrazie/playwright-sonar-reporter
$env:PLAYWRIGHT_SONAR_OUTPUT_NAME="results.xml"
npx playwright test --reporter=@bdellegrazie/playwright-sonar-reporter
In configuration file, pass options directly:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [['@bdellegrazie/playwright-sonar-reporter', { outputFile: 'results.xml' }]],
});
The Sonar reporter has no options beyond the outputFile property.
- implement code coverage
Any questions related with this code, please raise issues in this GitHub project. Feel free to contribute and submit PR's.
Based on code from Playwright project and Xray-App's playwright-junit-report