Nebulous Program Mechanic

    straal

    0.0.5 • Public • Published

    straal NPM version Build Status Dependency Status

    Wrapper for Xray's REST API

    Installation

    $ npm install --save straal

    Examples

    Create Xray Client

    const XrayApi = require('straal').XrayApi;
     
    var xray = new XrayApi('http', host, port, user, password, '1.0');

    Get Issue Information

    xray.getIssueInfo(issueIdOrKey, function(error, issue) {
        if(!error){
            console.log('Issue ID: ' + issue.id);
        }
    })

    Save Test Run

    const ZonedDateTime = require('js-joda').ZonedDateTime;
    const ChronoUnit = require('js-joda').ChronoUnit;
     
    function now() {
        return ZonedDateTime.now().withFixedOffsetZone().truncatedTo(ChronoUnit.SECONDS).toString();
    }
     
    var startDate = now();
     
    // perform test steps
     
    var finishDate = now();
     
    xray.saveTestRun(testExecutionKey, testKey, startDate, finishDate, status, comment, function(error, issue) {
        if(!error) {
            console.log('Test Exec Issue: ' + issue.testExecIssue.self);
        }
    });

    Import JUnit Test Results

    xray.importJUnitResults('test_report.xml', projectKey, testPlanKey, function(error, result) {
        if(!error) {
            console.log(result);
        }
    });

    Supported Actions

    • Get Project Info (/rest/api/2/project)
    • Get Issue Info (/rest/api/2/issue)
    • Get Test Run Info (rest/raven/1.0/api/testrun)
    • Create Xray Issues (/rest/api/2/issue)
      • Test
      • Test Set
      • Test Plan
      • Test Execution
    • Save Test Run (/rest/raven/1.0/import/execution)
    • Add Evidence to Test Run (/rest/raven/1.0/api/testrun/<TEST_RUN_ID>/attachment)
    • Import Test Results to JIRA
      • JSON Format (/rest/raven/1.0/import/execution)
      • JUnit XML (/rest/raven/1.0/import/execution/junit)
    • Export test results from JIRA (/rest/raven/1.0/testruns)
    • Run JQL queries (/rest/api/2/search)

    References

    License

    MIT License © João Galego

    Keywords

    Install

    npm i straal

    DownloadsWeekly Downloads

    2

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    27.5 kB

    Total Files

    6

    Last publish

    Collaborators

    • jgalego