/node-cuanto

Primary LanguageJavaScriptMIT LicenseMIT

node-cuanto

Client library for Cuanto, based on Cuanto JSON API.

NPM

Usage

var cuanto = require('cuanto')('http://your.server/cuanto');
var project = new cuanto.type.Project('MyProject', 'MYP');
cuanto.project.add(project, function(err, res) {
  if (err) { /* Error */ }
  var testRun = new cuanto.type.TestRun(project.projectKey, new Date());
  cuanto.testRun.add(testRun, function(err, res) {
    if (err) { /* Error */ }
    console.log(res.id); // TestRun's Id
  });
});

API

Types

Project

var project = new cuanto.type.Project(<Name>, <ProjectKey>);
project.setProjectGroup(String);
project.setTestType(String);

TestRun

var testRun = new cuanto.type.TestRun(projectKey, dateExecuted);
testRun.setTestProperties({'Name': 'Value', 'Name2': 'Value2'});
testRun.setLinks({'Link1', 'Link2'});
testRun.setNote(String);
testRun.setValid(Boolean);
testRun.setId(Number);

TestCase

var testCase = new cuanto.type.TestCase(testName, packageName);
testCase.setDescription(String);
testCase.setParameters(String);
testCase.setId(Number);

TestOutcome

var testOutcome = new cuanto.type.TestOutcome(projectKey, testRun, testCase);
testOutcome.setResult(String);
testOutcome.setFailureStatusChanged(Boolean);
testOutcome.setStartedAt(Date);
testOutcome.setDuration(Number);
testOutcome.setAnalysisState(String);
testOutcome.setTestOutput(String);
testOutcome.setFinishedAt(Date);
testOutcome.setOwner(String);
testOutcome.setNote(String);
testOutcome.setId(Number);

Clients

Project

cuanto.project.exists(projectKey, function(err, Boolean) {});
cuanto.project.get(projectKey, function(err, ProjectJSON) {});
cuanto.project.add(Project, function(err, ProjectJSON) {});
cuanto.project.remove(projectKey, function(err) {});
cuanto.project.list(function(err, projects) {});
cuanto.project.getAllTestRuns(projectKey, function(err, testRuns) {});

TestRun

cuanto.testRun.get(testRunId, function(err, TestRunJSON) {});
cuanto.testRun.add(TestRun, function(err, TestRunJSON) {});
cuanto.testRun.remove(testRunId, function(err) {});
cuanto.testRun.getTestOutcomes(testRunId, [opts,] function(err, testOutcomes) {});
  Valid opts are: sort, order, max and offset

TestOutcome

cuanto.testOutcome.get(testOutcomeId, function(err, TestOutcomeJSON) {});
cuanto.testOutcome.getTestOutput(testOutcomeId, function(err, TestOutputString) {});
cuanto.testOutcome.add(TestOutcome, function(err, TestOutcomeJSON) {});