jira-nunit-test-results-import
v1.0.1
Published
Upload test results to Jira using PAT.
Downloads
5
Readme
Jira Test Results Upload Script
This script allows you to upload test results in NUnit XML format to Jira using the Raven for Jira REST API.
Prerequisites
- Jira Personal Access Token (PAT): You need to have a Jira Personal Access Token (
JIRA_PAT) set as an environment variable. - Jira Instance: You need access to a Jira instance where Raven for Jira is installed.
- Node.js: The script is written in JavaScript and requires Node.js to run.
Installation
- Clone or download this repository to your local machine.
- Install dependencies using npm:
npm install axios form-data
Usage
Set the JIRA_PAT environment variable with your Jira Personal Access Token.
For Linux/macOS:
export JIRA_PAT="your-jira-personal-access-token"For Windows (Command Prompt):
set JIRA_PAT=your-jira-personal-access-tokenOr, you can add it to your
.envfile (using a package likedotenvif needed).Use the script to upload the test results. Run the script with the following parameters:
jiraUrl: The base URL of your Jira instance (e.g.,http://localhost:8080).projectKey: The Jira project key (e.g.,CALC).filePath: The path to the NUnit XML file to upload.
Example usage:
const uploadTestResults = require('./uploadTestResults'); const jiraUrl = 'https://your-jira-instance.atlassian.net'; const projectKey = 'YOUR_PROJECT_KEY'; const filePath = './TestResults.xml'; uploadTestResults(jiraUrl, projectKey, filePath);The script will authenticate with Jira using the Personal Access Token and upload the NUnit test results to the specified Jira project.
Error Handling
- If the
JIRA_PATenvironment variable is not set, the script will throw an error. - Any errors during the upload process will be logged to the console.
