Git Product home page Git Product logo

allure-jasmine's Introduction

[DEPRECATED]

Jasmine Allure Plugin

A plugin to generate an Allure report out of Jasmine tests.

Using Allure Reporter in Jasmine2

Add the lib into package.json and then configure the plugin:

// conf.js
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter({
  resultsDir: 'allure-results'
}));

Using Allure Reporter in Protractor

Put the above code into the onPrepare inside of your conf.js:

// conf.js
exports.config = {
  framework: 'jasmine2',
  onPrepare: function() {
    var AllureReporter = require('jasmine-allure-reporter');
    jasmine.getEnv().addReporter(new AllureReporter({
      resultsDir: 'allure-results'
    }));
  }
}

Generate HTML report from Allure results

The Reporter will generate xml files inside of a resultsDir, then we need to generate HTML out of them.

Using Allure Command Line Tool

Add the allure-commandline dependency in your current project by running the below command.

npm install allure-commandline --save-dev

After this, you can add "posttest": "allure generate allure-results --clean -o allure-report" section into your package.json. So when running the test by using npm test , the command mensioned in the posttest will help you to generate the report. You can refer a sample script section of package.json file.

"scripts": {
        "pretest": "rm -rf allure-report",
        "test": "protractor conf.js",
        "posttest": "allure generate allure-results --clean -o allure-report || true"
    }

Added the bash || operator in posttest to overcome this issue

Otherwise choose one of other ways to generate HTML.

Adding Screenshot in the end of each test

  onPrepare: function () {
    var AllureReporter = require('jasmine-allure-reporter');
    jasmine.getEnv().addReporter(new AllureReporter());
    jasmine.getEnv().afterEach(function(done){
      browser.takeScreenshot().then(function (png) {
        allure.createAttachment('Screenshot', function () {
          return new Buffer(png, 'base64')
        }, 'image/png')();
        done();
      })
    });
  }

Note done callback!

TBD

  • Currently attachments are added to the test case instead of the current step. This needs to be fixed in allure-js-commons.
  • Add support for Features.
  • Add support to Jasmine1. Right now only Jasmine2 is available (do we really need this?).
  • Add ability to use reflection for decoration method of page objects so that we don't need to write Allure-related boilerplate tying ourselves to one specific reporter.

For Developers

See the system tests to quickly check how the reporter works in real life: node_modules/protractor/bin/protractor ./test/system/conf.js

allure-jasmine's People

Contributors

baev avatar ctapobep avatar just-boris avatar psprogis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.