1.0.2 • Published 4 years ago

testcafe-allure-reporter-video v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

testcafe-allure-reporter-video

This is the allure reporter plugin for TestCafe. This is used to generate allure visual reports for testcafe test execution.

This is an expansion of the npm package testcafe-reporter-allure created by Sintu Singh.

Install

npm install testcafe-allure-reporter-video

Usage

When you run tests from the command line, specify the reporter name by using the --reporter option:

testcafe chrome 'path/to/test/file.js' --reporter allure

When you use API, pass the reporter name to the reporter() method:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter('allure') // <-
    .run();

When you use static configuration file 'testcaferc.json':

"reporter": 
	[
		{ 
			"name": "json",
			"output": "Reports/report.json"
		},
		{
			"name": "xunit",
			"output": "Reports/report.xml"
		},
		{
			"name": "allure"
		}
],

Severities

The below severities are supported by this reporter.
blocker, critical, normal, minor, trivial

Test meta data

To specify id, severity, user story, story_url or description, use test meta options.

User story

I recommand always adding an user story as meta data. Cause this meta data will be shown in the allure reporter under 'Feature by story'. Therefore a user story is needed.

test
	.meta({ 
		ID: '1001',
		SEVERITY: 'critical',     
		USER_STORY: 'As an user I want to login, so I have access to the features.',
		STORY_URL: 'https://some_story_url.com/ID',
		DESCRIPTION: 'Description of the story'})
	("My Test", async (t) => {
			// testcode
	});

DESCRIPTION and USER_STORY in fixture meta

Metadata DESCRIPTION and USER_STORY can be specified in fixture meta. If user story or description is specified in fixture meta, it will discard the user story or description from test meta.

Environment

To add information to environment widget, just create environment.xml file to allure-results directory before report generation.

<environment>
    <parameter>
        <key>Browser</key>
        <value>Chrome</value>
    </parameter>
    <parameter>
        <key>Browser.Version</key>
        <value>63.0</value>
    </parameter>
    <parameter>
        <key>Stand</key>
        <value>Production</value>
    </parameter>
</environment>

Executor

To add an information about your test executor create a file executor.json in your allure-results:

{
  "name": "Jenkins",
  "type": "jenkins",
  "url": "http://example.org",
  "buildOrder": 1,
  "buildName": "allure-report_deploy#1", 
  "buildUrl": "http://example.org/build#1",
  "reportUrl": "http://example.org/build#1/AllureReport",
  "reportName": "Demo allure report"
}

Configuration

To override default configurationn, create a doc-allure-config.js file in the root directory of your project and put below content in that file.

const DOC_ALLURE_CONFIG = {
    CLEAN_REPORT_DIR: true,
    COPY_HISTORY: false,
    REMOVE_VIDEOS: true,
    RESULT_DIR: '/allure/allure-results',
    REPORT_DIR: '/allure/allure-report',
    META: {
        STORY_ID: 'STORY',
        TEST_ID: 'ID',
        SEVERITY: 'SEVERITY',
        USER_STORY: 'USER_STORY',
        STORY_URL: 'STORY_URL',
        DESCRIPTION: 'DESCRIPTION'
    },
    STORY_LABEL: 'Jira Story Link',
    TEST_LABEL: 'Test Link',
    TEST_URL: 'test_url.com/{{ID}}',
    VIDEO_PATH: 'Videos/',
    REPORTS_PATH: 'Reports/',
    labels: {
        screenshotLabel: 'Screenshot',
        videoLabel: 'Executie Video',
        reportsLabel: 'Reports',
        browserLabel: 'Browser',
        userAgentLabel: 'User Agent',
        allureStartMessage: 'Allure reporter started...',
        allureClosedMessage: 'Allure reporter closed...'
    }
};

module.exports = DOC_ALLURE_CONFIG;

There is now a choice to add videos to report. Change REMOVE_VIDEOS to true or false. If you use videos, please change the VIDEO_PATH to your corresponding video path, otherwise it will automatically search videos at 'Videos/'.

Also the videos only work if your video options are according to the following configurations:

"videoPath": "Videos/",
	"videoOptions": {
		"singleFile": false,
		"failedOnly": false,
		"pathPattern": "${DATE}_${TIME}/${TEST}/${USERAGENT}/${FILE_INDEX}.mp4"
	},

View report

After running testcafe tests, it should generate a folder allure/allure-results in your project root directory.

Install allure-commandline module to your project.

npm install -g allure-commandline

Run below command to view allure report.

allure generate allure/allure-results --clean -o allure/allure-report && allure open allure/allure-report

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago