Skip to content

Combined collaboration for workflows using Jira and Postman

License

Notifications You must be signed in to change notification settings

DeadmanXXXII/Pat-s_Xray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Pat-s_Xray

Combined collaboration for workflows using Jira and Postman

Here’s how you can set it up:

Using Postman and Jira Xray Integration:

Postman Collection: Create and manage your API tests within Postman. Make sure your tests are well-organized and include assertions that determine pass/fail status.

Export Postman Results: Postman can run collections and export results in different formats (e.g., JSON). You can use the Postman command-line tool, Newman, to run your collections and generate reports.

Xray REST API: Xray provides a REST API that allows you to import test results. You can use this API to create test cases, test runs, and report results back to Jira.

Steps to Integrate:

  1. Set Up Xray in Jira:

    • Ensure you have the Xray plugin installed in your Jira instance.
    • Set up the necessary project and test configurations in Xray.
  2. Run Postman Collections via Newman:

    • Install Newman: npm install -g newman.
    • Run your Postman collection and export the results in JSON format:
      Newman run your-collection.postman_collection.json -r json –reporter-json-export output.json
  3. Process Postman Results:

    • Parse the Newman JSON output to extract test results.
    • Transform the test results into a format acceptable by the Xray API.
  4. Use Xray REST API to Import Results:

    • Authenticate with the Xray API using an API token or Jira credentials.
    • Upload the test results:
      Curl -H “Content-Type: multipart/form-data” \
           -u your-jira-user:your-jira-api-token \
           -F file=@output.json \
           -X POST https://your-jira-instance/rest/raven/1.0/import/execution

Example Script to Upload Results:

Here’s an example script using Node.js to automate the upload of Postman results to Jira Xray:

Const fs = require(‘fs’);
Const axios = require(‘axios’);

Const jiraUser = ‘your-jira-user’;
Const jiraToken = ‘your-jira-api-token’;
Const jiraUrl = ‘https://your-jira-instance/rest/raven/1.0/import/execution’;
Const postmanResults = ‘output.json’;

Async function uploadResults() {
    Const file = fs.readFileSync(postmanResults);

    Const formData = new FormData();
    formData.append(‘file’, file, ‘output.json’);

    try {
        const response = await axios.post(jiraUrl, formData, {
            auth: {
                username: jiraUser,
                password: jiraToken
            },
            Headers: formData.getHeaders()
        });
        Console.log(‘Results uploaded successfully:, response.data);
    } catch (error) {
        Console.error(‘Error uploading results:, error);
    }
}

uploadResults();

Alternative: CI/CD Integration

You can also integrate this process into your CI/CD pipeline (e.g., Jenkins, GitLab CI) to automate the running of Postman collections and uploading of results to Jira Xray after each build or deployment.

Summary

Integrating Postman with Jira Xray involves running your Postman tests, exporting the results, and using the Xray REST API to upload these results to Jira. This process can be automated using scripts and incorporated into your CI/CD pipeline for continuous testing and reporting.

About

Combined collaboration for workflows using Jira and Postman

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published