dox Executable Documentation

Test report

The status (passing|failing|pending) of each scenario can be sent from a CI server and is represented by color coding the scenario (green|red|orange).

Push report in tap format

Given the request has the body ' TAP version 13 ok 1 - spec/folder/some/folder/SomeSpecificationTest::testSomeScenario ok 2 - spec\\folder\\some\\folder\\SomeSpecificationTest::testOtherScenario not ok 3 - Failure: spec/folder/FailingTest::testBadScenario --- message: \'Some message\' severity: fail ... ok 4 - spec/folder/FailingTest::testGoodScenario not ok 5 - spec/folder/FailingTest::testPendingScenario # TODO Incomplete Test 1..5'
When I send a 'post' request to 'projects/myProject/reports'
Then the response should be 'OK - report saved for [myProject]'
Then scenario 'SomeScenario' of 'some/folder/SomeSpecification' in project 'myProject' should be marked Report::STATUS_PASSING
Then scenario 'OtherScenario' of 'some/folder/SomeSpecification' in project 'myProject' should be marked Report::STATUS_PASSING
Then scenario 'BadScenario' of 'Failing' in project 'myProject' should be marked Report::STATUS_FAILING
Then scenario 'GoodScenario' of 'Failing' in project 'myProject' should be marked Report::STATUS_PASSING
Then scenario 'PendingScenario' of 'Failing' in project 'myProject' should be marked Report::STATUS_PENDING
Then scenario 'notExisting' of 'NoWhere' in project 'myProject' should be marked Report::STATUS_UNKNOWN
Then 'Saved status report of [myProject]' should be logged

Push report in invalid format

Given the request has the body 'Invalid format'
When I try to send a 'post' request to 'projects/myProject/reports'
Then an exception should be thrown containing 'Format not recognized'
Then 'Failed saving status in [myProject]' should be logged

Show status of scenario

Given the project 'project'
Given the file 'user/projects/project/spec/SpecificationTest.php' with content ' <?php class SpecificationTest { public function testPassingScenario() {} public function testFailingScenario() {} public function testPendingScenario() {} public function testUnknownScenario() {} }'
Given scenario 'PassingScenario' of 'Specification' in 'project' has the status Report::STATUS_PASSING
Given scenario 'FailingScenario' of 'Specification' in 'project' has the status Report::STATUS_FAILING
Given scenario 'PendingScenario' of 'Specification' in 'project' has the status Report::STATUS_PENDING
Given scenario 'UnknownScenario' of 'Specification' in 'project' has the status Report::STATUS_UNKNOWN
When I request the resource at 'projects/project/specs/Specification'
Then 'specification/scenario/0/status' should be 'passing'
Then 'specification/scenario/1/status' should be 'failing'
Then 'specification/scenario/2/status' should be 'pending'
Then 'specification/scenario/3/status' should be 'unknown'

Status summary on project page

Given the project 'project'
Given the file 'user/projects/project/spec/OtherTest.php' with content '<?php class OtherTest { public function testOne() {} }'
Given the file 'user/projects/project/spec/SomeTest.php' with content '<?php class SomeTest { public function testOne() {} public function testTwo() {} public function testThree() {} public function testFour() {} public function testFive() {} }'
Given scenario 'One' of 'Some' in 'project' has the status Report::STATUS_UNKNOWN
Given scenario 'Two' of 'Some' in 'project' has the status Report::STATUS_FAILING
Given scenario 'Three' of 'Some' in 'project' has the status Report::STATUS_PENDING
Given scenario 'Four' of 'Some' in 'project' has the status Report::STATUS_FAILING
Given scenario 'Five' of 'Some' in 'project' has the status Report::STATUS_PASSING
When I request the resource at 'projects/project'
Then 'navigation/specification/0/name' should be 'Other'
Then 'navigation/specification/0/failingCount' should be null
Then 'navigation/specification/0/pendingCount' should be null
Then 'navigation/specification/0/passingCount' should be null
Then 'navigation/specification/1/name' should be 'Some'
Then 'navigation/specification/1/failingCount' should be 2
Then 'navigation/specification/1/pendingCount' should be 1
Then 'navigation/specification/1/passingCount' should be 1

Non existent status file

Given the project 'project'
Given the file 'user/projects/project/spec/SpecificationTest.php' with content ' <?php class SpecificationTest { public function testSomeScenario() {} }'
When I request the resource at 'projects/project/specs/Specification'
Then 'specification/scenario/0/status' should be 'unknown'

background

Given the project 'myProject'
Given the project 'myProject' has the spec folder 'spec/folder'