Coder Social home page Coder Social logo

jasmine-testrail-reporter's Introduction

jasmine-testrail-reporter

Reports Jasmine test results to TestRail

How to use

npm install jasmine-testrail-reporter --save-dev
or
yarn add jasmine-testrail-reporter --dev

Then the best way to pass parameters to the reporter is by environment variables:

TESTRAIL_USERNAME - used to form URL, like <username>.testrail.io
TESTRAIL_EMAIL
TESTRAIL_PASSWORD - API key
TESTRAIL_PROJECT_ID - number | 'first' | 'last', default = 'first' (the results will be saved to your first project in the TestRail project list)
TESTRAIL_SUITE_ID - optional
TESTRAIL_RUN_ID - number | 'first' | 'last', default = 'last' (the results will be saved to your last test run in the TestRail list)

For example, you can use env utility, like this:

env TESTRAIL_USERNAME=<...> TESTRAIL_EMAIL=<...> TESTRAIL_PASSWORD=<...> TESTRAIL_PROJECT_ID=first npm test  

protractor.conf.ts

import TestRailReporter from 'jasmine-testrail-reporter';
const trReporter = new TestRailReporter();  // all parameters are inside environment variables
// or
const trReporter = new TestRailReporter({   // all parameters are setup in the code
                    username: 'username',   // security warning: attention when commit to repository !
                    email: 'email',         // security warning: attention when commit to repository !
                    password: 'password',   // security warning: attention when commit to repository !
                    projectId: 1,
                    suiteId: 1,
                    runId: 30,
});

export const config = {

    onPrepare: () => {
        jasmine.getEnv().addReporter(trReporter);
    },
    onComplete: function() {
            return myReporter.publishResults()
                .then(results => { console.log('complete'); })
                .catch(err => { console.log(err.message); });
    },

}  

Thanks

TODO

  • [ ] fix TS installation errors
  • [ ] demonstrate error (if any) in async constructor more earlier;
  • [ ] add status matching in parameters;
  • [ ] store CustomReporterResult.failedExpectations, passedExpectations, pendingReason in the IAddResultsForCases.custom_step_results;
  • [ ] implement ‘create’ option for RunId;
  • [ ] implement createTestCases method;
  • [ ] ...

jasmine-testrail-reporter's People

Contributors

asnov avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

iseedeadcode

jasmine-testrail-reporter's Issues

Test cases in test rails are not getting updated with jasmine-test-rails api

I am trying to update test cases in test rails using the jasmine-test-rails-reporter api.

Here is my config :

   let TestRailReporter = require('jasmine-testrail-reporter').default;

   let trReporter = new TestRailReporter({
   domain: 'https://xxx.testrail.com/',
   email: '[email protected]',
   password: 'xxx',
   projectId: xx,
   suiteId: xx
  // runId: 30,
  });

My test spec looks some thing like :

it('C215 should xxxxxxx', async function()

C215 is the test case ID from test rails.

But the test case is not getting updated in test rails with pass or fail status. Am i missing some thing here ?

Appreciate your response.

Thanks

Package not working

here the spec
fit('(196:) should get alert on invalid password submission (<6 chars)', async function () { const oldFormat = await userSettings.selectedTimeFormat() await userSettings.switchTimeFormat() const newFormat = await userSettings.selectedTimeFormat() await expect(oldFormat).not.toEqual(newFormat) })

here the protractor.config.ts
`import { Config, browser } from 'protractor'
import TestRailReporter from 'jasmine-testrail-reporter';
import matchers = require('jasmine-protractor-matchers')

const trReporter = new TestRailReporter({ // all parameters are setup in the code
username: 'username', // security warning: attention when commit to repository !
email: ''email, // security warning: attention when commit to repository !
password: ' iW3FqXXYKdD.RkYrwvF3-HTnQCp31OwF3UoGncNUQ', // security warning: attention when commit to repository !
projectId: 3,
suiteId: 3,
runId: 3,
});

`

`export const config = {

directConnect: true,

capabilities: {
  browserName: 'chrome',
  chromeOptions: {
    //args: [ "--headless", "--disable-gpu", "--window-size=1280x1024" ]
  }
},

specs: [
  '../specs/**/*.spec.js',
  '../specs/*.spec.js'
],
baseUrl: ' https://dev.sendit.gl',

  

onPrepare: () => {
        // Adding nice console output. 
// Provided by: https://github.com/razvanz/jasmine2-reporter
let ConsoleReporter = require('jasmine2-reporter').Jasmine2Reporter
let console_reporter_options = {
  startingSpec: true
}
jasmine.getEnv().addReporter(new ConsoleReporter(console_reporter_options))

// Adding reporting that is applicable for Jenkins or other CI tool
// Provided by: https://github.com/larrymyers/jasmine-reporters
let JUnitXmlReporter = require('jasmine-reporters').JUnitXmlReporter
let junit_reporter_options = {
  savePath: '../test_results/',
  consolidateAll: true
}
jasmine.getEnv().addReporter(new JUnitXmlReporter(junit_reporter_options))
    jasmine.getEnv().addReporter(trReporter);
},

beforeEach: () => {
    jasmine.addMatchers(matchers);
},

afterEach: () => {
    //Clearing browser data after each test
    browser.manage().deleteAllCookies();
    browser.executeScript('window.sessionStorage.clear(); window.localStorage.clear();')
},

onComplete: function() {
        return trReporter.publishResults()
            .then(results => { console.log('complete'); })
            .catch(err => { console.log(err.message); });
},

} `

running npm tsc returns this error:
`npm run tsc
npm ERR! path C:\Users\simon\Desktop\Sendit - Automation\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\simon\Desktop\Sendit - Automation\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\simon\AppData\Roaming\npm-cache_logs\2017-12-04T21_47_32_396Z-debug.log`

Improving README.md

Could you please improve the read,me file so as it's easier to get started?

It would be nice to have some example of setup for basic scenario:
1- Setup ENV variables
2- How to write the Spec file to match Test Cases on TestRail and test run

Any other changes which are necessary.

Could provide an example of a working protractor.conf.ts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.