/nxgreport

A simple light weighted gem 💎 to generate a beautiful e-mailable test report.

Primary LanguageRubyMIT LicenseMIT

Markdownify
Next Gen Report 💎

GitHub    Ruby Version    Gem Version

A simple light weighted gem to generate a beautiful e-mailable test report.

It displays a single view where tests (total, pass, fail) are grouped by functionality. The result is a single static HTML file with an option to switch between dark & light modes.

Demo • Installation • Usage • License

Demo

Markdownify
Markdownify

Installation

gem install nxgreport

Usage

require 'nxgreport'

$NxgReport.setup(location: "Absolute file path", title: "My Report")

$NxgReport.set_device(name: "iPhone X")
$NxgReport.set_os(name: "iOS 12.1")
$NxgReport.set_release(name: "M09 2020")
$NxgReport.set_app_version(no: "app0.9.1")
$NxgReport.set_environment(name: "QA")

$NxgReport.log_test(feature_name: "Feature Name",test_name: "This is a test", test_status: "Pass/Fail", comments: "Error message or additional comments about the test", tag: "critical")

$NxgReport.build()

Cucumber Ruby Usage

In env.rb add the below line

require 'nxgreport'

$NxgReport.setup(location: "Absolute file path", title: "My Report")

$NxgReport.set_device(name: "iPhone X")
$NxgReport.set_os(name: "iOS 12.1")
$NxgReport.set_release(name: "M09 2020")
$NxgReport.set_app_version(no: "app0.9.1")
$NxgReport.set_environment(name: "QA")

In hooks.rb add the below block of code.

After do |scenario|
    feature_name = scenario.feature.name
    scenario_pass = !scenario.failed?() ? "Pass" : "Fail"
    comments = scenario.exception.nil? ? "Success" : scenario.exception.message
    $NxgReport.log_test(feature_name: feature_name, test_name: scenario.name, test_status: scenario_pass, comments: comments, tag: "critical")
end

at_exit do
    $NxgReport.build()
end

Parameters Explaination

$NxgReport.setup(location, title)
  • location (optional): This is an absolute path where the report should be generated (ex: "C:\Report\index.hmtl). If not passed, the report will be generated in the root folder as NxgReport.html
  • title (optional): This is title of report displayed. If not passed, the report will be generated with a title "Features Summary"
$NxgReport.log_test("Feature Name", "Pass/Fail")
  • feature_name This is the feature name under the test should be logged ex:(Login with Biometrics)
  • test_status This is the status of the test, allowed values are Pass or Fail

Like it?

Click the star icon ✭ at the top-right corner of this page to show your appreciation.

Contributing

We're open to any contribution. It has to be tested properly though.

License

Copyright © 2020 MIT License