Skip to content

tkachoff/reportportal-client-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#ReportPortal js client

Library used only for implementors of custom listeners for ReportPortal

Allready implemented listeners:

  • EMPTY

Installation

The latest stable version will be available on npm soon:

npm install reportportal-client

Usage

Main classes are:

  • RPClient

Basic usage example:

var Service = require("reportportal-client");

function now() {
    return new Date().getTime();
}

var rpConfig = {
    endpoint: "http://your_reportportal_url",
    project: "project",
    token: "your_reportportal_token"
};

var rp = new Service(rpConfig);

var startLaunchRQ = {
    name: "JSLaunchName",
    description: "Some LaunchDescription",
    tags: ["tag1", "tag2"],
    start_time: now(),
    mode: null
};

var startLaunchResponse = rp.startLaunch(startLaunchRQ);

var launchId;

startLaunchResponse.then(function (response) {
    var startTestItemRQ = {
        name: "Suite1",
        description: "SuiteDescription",
        tags: ["suite_tag1", "suite_tag2"],
        start_time: now(),
        launch_id: response.id,
        type: "SUITE"
    };
    var startSuiteResponse = rp.startTestItem(null, startTestItemRQ);
    startSuiteResponse.then(function (data) {
        var finishTestItemRQ = {
            end_time: now(),
            status: status.PASSED
        };
        rp.finishTestItem(data.id, finishTestItemRQ).then(function (data) {
            var finishExecutionRQ = {
                end_time: now(),
                status: status.PASSED
            };

            startLaunchResponse.then(function (response) {
                console.log(response.id);
                rp.finishLaunch(response.id, finishExecutionRQ)
                    .then(function (data) {
                        console.log(data);
                    })
            }, function (err) {
                console.log(err);
            });
        });
    })
});

Copyright Notice

Licensed under the GPLv3 license (see the LICENSE.txt file).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published