API coverage visualizer tool. Creates an easily readable html report based upon the executed API test cases.
Maven:
<dependency>
<groupId>io.github.osvalda</groupId>
<artifactId>Pitaya</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
Gradle:
dependencies {
testCompile("io.github.osvalda:Pitaya:1.2.2")
}
Create a text file in your resource directory and add lines in the following format:
DELETE /posts/{post_id}, Posts
GET /posts/{post_id}/comments, Comments
GET /comments/{post_id}, Comments
# comment line
# a star marks the endpoint to be ignored
* GET /posts/{post_id}/pics, Pictures
GET /posts/{post_id}/pics, Pictures
...
Copy the open api file (json or yaml) to resources directory or use its URL
Create a pitaya.properties
file into the root of your resources directory and
add the following properties to it:
Key | Value | Mandatory |
---|---|---|
application.name | The name of your SUT | Yes |
endpoint.list.input | The endpoint list file's relative path or Open API file URL | Yes |
To use Pitaya with TestNG add the reporter to the listeners in your test class(es):
@Listeners({PitayaCoverageReporter.class})
public class YourTestNGTestClass {
// ...
}
To use Pitaya with JUnit5 add the extension to the extensions in your test class(es):
@ExtendWith(PitayaCoverageExtension.class)
public class YourJUnit5TestClass {
// ...
}
Annotate all your test methods which you want to include in the report:
@Test
@TestCaseSupplementary(api = {GET + "/one_of_your_endpoint"})
public void yourTestMethod() {
// ...
}
If Jenkins fails to display css, then run the following command in Manage Jenkins
/ Script console
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")