report-factory-mocha

Mocha reporter for ReportFactory

MIT License

Stars
0
Committers
2

ReportFactory Mocha reporter

ReportFactory helps you save each of your test runs so that they are always available for reports and analytics. It consists of three parts:

  1. A rails server that provides an interface via JSON API and saves your test runs in a DB;
  2. A web dashboard which gives you an easy way to configure your test projects and reports;
  3. And a test reporter that automatically sends reports to the server. This repo is the reporter for Mocha.

Getting Started

Follow these instructions to get Report Factory running with Docker. The configuration is ready for production.

Installation

Install with npm as a development dependency:

$ npm install --save-dev report-factory-mocha

Usage

Before you start using this reporter, make sure you have the ReportFactory server deployed and running.

To setup this reporter to work with your Mocha tests, you need to configure it first. You can set up a root-level hook that will cause the callback to run before all your tests. For example:

const reportFactory = require('report-factory-mocha');

before(function() {
  reportFactory.configure({
    baseUrl: "The url of the ReportFactory server. It's 'http://0.0.0.0:3000' if you're running locally",
    projectName: "The name of the project that you are testing. Needs to be previously created in ReportFactory",
    tags: ['Tags', 'to', 'help', 'you', 'group', 'your', 'reports'],
    authToken: "Your user X_API_KEY. Can be found in ReportFactory in your user information"
  });
});

Then you can just simply run your mocha tests with --reporter report-factory-mocha and your reports will be available on the server after each test run. You can use mocha-multi-reporters to run it in parallel with other reporters.

Development

After checking out the repo, run npm install to install dependencies.

Run tests with npm run test.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/igor-starostenko/report-factory-mocha. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The package is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the report-factory-mocha project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.