jasmine-allure-reporter vs mocha-allure-reporter
JavaScript Testing Framework Reporters
jasmine-allure-reportermocha-allure-reporterSimilar Packages:

JavaScript Testing Framework Reporters

Both Jasmine and Mocha are popular JavaScript testing frameworks, and their respective Allure reporters enhance the reporting capabilities of tests run with these frameworks. Jasmine is a behavior-driven development (BDD) framework that provides a clean syntax for writing tests, while Mocha is a flexible test framework that supports various styles of testing, including BDD and TDD. The Allure reporters for both frameworks allow for the generation of visually appealing and informative test reports that can help developers and QA teams understand test outcomes and failures more effectively. These reports can include detailed information about test execution, including steps, attachments, and statuses, making it easier to track down issues and improve the testing process.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
jasmine-allure-reporter034-239 years agoISC
mocha-allure-reporter04526.1 kB0-Apache-2.0

Feature Comparison: jasmine-allure-reporter vs mocha-allure-reporter

Integration

  • jasmine-allure-reporter:

    The jasmine-allure-reporter is specifically designed to integrate with Jasmine, allowing for easy setup and usage within Jasmine test suites. It captures Jasmine's test results and formats them into Allure reports without requiring extensive configuration.

  • mocha-allure-reporter:

    The mocha-allure-reporter integrates with Mocha, leveraging Mocha's hooks and test lifecycle events to capture detailed information about test execution. It can be easily configured to work with different Mocha setups, making it versatile for various testing environments.

Report Customization

  • jasmine-allure-reporter:

    This reporter allows for some level of customization in the generated Allure reports, enabling developers to include additional metadata, such as test descriptions and attachments, which can enhance the clarity and usefulness of the reports.

  • mocha-allure-reporter:

    Mocha-allure-reporter provides options for customizing the reporting output, allowing developers to specify how tests are grouped and displayed in the Allure report. This flexibility can help tailor reports to better fit project needs.

Output Format

  • jasmine-allure-reporter:

    The output generated by jasmine-allure-reporter is compatible with Allure's standard format, ensuring that reports can be easily viewed and analyzed using Allure's reporting tools. This standardization helps maintain consistency across different projects that may use various testing frameworks.

  • mocha-allure-reporter:

    Mocha-allure-reporter also outputs results in the standard Allure format, making it easy to integrate with existing Allure reporting tools. This ensures that regardless of the testing framework used, the reporting remains consistent and accessible.

Community Support

  • jasmine-allure-reporter:

    As part of the Jasmine ecosystem, jasmine-allure-reporter benefits from a community that actively maintains and updates the package. This support can be crucial for troubleshooting and ensuring compatibility with the latest Jasmine versions.

  • mocha-allure-reporter:

    Mocha-allure-reporter is supported by the broader Mocha community, which is known for its active development and extensive documentation. This community support can help users quickly resolve issues and adopt best practices.

Ease of Use

  • jasmine-allure-reporter:

    The setup process for jasmine-allure-reporter is straightforward, making it easy for developers to start generating Allure reports with minimal configuration. This ease of use is particularly beneficial for teams looking to quickly enhance their testing process.

  • mocha-allure-reporter:

    Mocha-allure-reporter is also designed for ease of use, with clear documentation and examples that help developers integrate it into their Mocha test suites without significant overhead.

How to Choose: jasmine-allure-reporter vs mocha-allure-reporter

  • jasmine-allure-reporter:

    Choose jasmine-allure-reporter if you are already using Jasmine for your testing needs and prefer a BDD style of writing tests. This reporter integrates seamlessly with Jasmine, providing a straightforward way to generate Allure reports that reflect the behavior-driven approach of your tests.

  • mocha-allure-reporter:

    Choose mocha-allure-reporter if you are using Mocha as your testing framework and require flexibility in your testing style. Mocha's support for various testing paradigms allows you to adopt a structure that best fits your project, and this reporter will enhance your test reports with detailed insights.

README for jasmine-allure-reporter

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. You can use Maven for that. Copy ready-to-use pom.xml from node_modules/jasmine-allure-reporter and run:

mvn site -Dallure.results_pattern=allure-results

It will put HTMLs into target/site/allure-maven-plugin folder. To serve them via localhost:1324 use:

mvn jetty:run -Djetty.port=1234

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