0.0.2 • Published 5 years ago

wdio-test-results-service v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

WebdriverIO Test Results Service

WebdriverIO service that allows you to store test results to an external GraphQL server. Supports Mocha and Jasmine.

This will store results based on an entire spec file run.

This service is still a work in progress.

Requires that there is a GraphQL back-end setup with the mutations below.

Install

npm install --save-dev wdio-test-results-service

Todo

  • Add authentication

Recomended fields for back-end

Test Run

FieldTypeDescription
run_keyStringIdentifier of the overall test run
issue_keyStringJira issue, Jenkins job, etc.
suitesStringWebdriverIO suites that were ran
versionStringVersion of code the tests ran against
passedIntOverall test run passed
failedIntOverall test run failed
startTimestampRun start time
endTimestampRun end time

Test Run Result

FieldTypeDescription
test_run_idIntId of the current test run
spec_idStringFile name of the test
suite_titleStringName of the first describe block in the test file
durationIntHow long it took the test to complete in seconds
passedIntTest passed or not
failedIntTest failed or not
skippedIntTest skipped or not
retriesIntNumber of retries done

Enviroment variables

These can be set when running WebdriverIO and the data will be sent to the GraphQL endpoint

VariableDescription
GRAPHQL_ENDPOINTrequiredThe endpoint to your GraphQL server
TEST_RUN_TITLEoptionalThe title of the overall test run. If not specified it will default to the current timestamp
CODE_VERSIONoptionalThe version of the code that your tests are running against
ISSUE_KEYoptionalJira issue, Jenkins job, etc.

Mutations

type Mutation {
	testRunCreate(run_key: String, version: String, issue_key: String, suites: String) : TestRun,
	testRunComplete(id: Int) : TestRun,
	testResultAdd(test_run_id: Int, spec_id: String, suite_title: String, passed: Int, failed: Int, skipped: Int, duration: Int) : TestResult,
}

testRunCreate

FieldTypeDescription
run_keyStringIdentifier of the overall test run
versionStringVersion of code the tests ran against
issue_keyStringJira issue, Jenkins job, etc.
suitesStringWebdriverIO suites that were ran

testRunComplete

FieldTypeDescription
idIntId returned from testRunCreate

testResultAdd

FieldTypeDescription
test_run_idIntId of the current test run
spec_idStringFile name of the test
suite_titleStringName of the first describe block in the test file
passedIntTest passed or not
failedIntTest failed or not
skippedIntTest skipped or not
durationIntHow long it took the test to complete in seconds

Types

TestRun

type TestRun {
	id        : Int,
	run_key   : String,
	issue_key : String,
	suites    : String,
	passed    : Int,
	failed    : Int,
	duration  : Int,
	start     : String,
	end       : String,
	version   : String,
}

TestResult

type TestResult {
	id                 : Int,
	test_run_id        : Int,
	spec_id            : String,
	suite_title        : String,
	passed             : Int,
	failed             : Int,
	skipped            : Int,
	duration           : Int,
}