Skip to content

Commit

Permalink
Add and update documentation (#8 / #40)
Browse files Browse the repository at this point in the history
This PR adds general documentation and updates some mistakes of the documentation of the issue report.

related: #8 
PR: #40
  • Loading branch information
Bukama committed May 11, 2021
1 parent dacb19c commit 8be066c
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 32 deletions.
6 changes: 3 additions & 3 deletions docs/docs-nav.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# NOTE: The URLs need a trailing slash or the selected nav element
# won't be highlighted.
- title: Reports
- title: Test Report Features
children:
- title: "How To"
url: /docs/how-to-test-reports/
- title: "Issue Report"
url: /docs/issue-report/


30 changes: 30 additions & 0 deletions docs/how-to-test-reports.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
:page-title: How to use Test Reports
:page-description: Explains how to use test reports

== Usage

To make general use of this library just add the dependency to your project.
Don't forget to add the libraries version you want to use.

Maven:

[source,xml]
----
<dependency>
<groupId>org.junit-pioneer</groupId>
<artifactId>test-reports</artifactId>
<version><!-- ... --><version>
<scope>test</scope>
</dependency>
----

Gradle:

[source,groovy]
----
testCompile group: 'org.junit-pioneer', name: 'test-reports', version: /* ... */
----

How to use certain report provider, please take a look at the providers own page.


18 changes: 10 additions & 8 deletions docs/issue-report.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ At the end it will a report is generated and published.

== Usage

This section covers how to use the library.
This section covers how to use the Issue report provider.
Some things are configurable - see [configuration](#configuration) section for further details.

=== Provide list of issues
Expand Down Expand Up @@ -40,7 +40,7 @@ The report lists every issue provided by the issue list and extracted from the I
For each issue a summary of the test results and the tests itself (including their name and result) are listed.
The report (`issueReport.xml`) is always published in XML-format using JAXB under `target/report` (default) .

_Further formats, e.g. HTML, are planed and will then be configurable._
_Further formats, e.g. HTML, are planned and will then be configurable._

=== Example
This example shows a report which include:
Expand All @@ -49,7 +49,7 @@ This example shows a report which include:

```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<issueReport xmlns="https://com.github.bukama.ir/01.00">
<issueReport xmlns="https://org.junitpioneer.testreports.issuereport/01.00">
<issues>
<issue issueId="req222" description="Sample description" priority="HIGH">
<summary total="1" successful="1" failed="0" aborted="0"/>
Expand All @@ -71,9 +71,11 @@ This example shows a report which include:
Several values are configurable by system properties.
The following table shows the keys and default value (a `-` means no value is set).

|==========================
| Key | Default value | Description |
| --- | --- | --- |
| com.github.bukama.ir.issuelist.directory | - | Subdirectory of the issue list. The directory will be prefixed with "." and the the value of File.separator, together e.g "./". |
| com.github.bukama.ir.issuelist.filename | issuelist | Filename of the issue list without extension or path |
| com.github.bukama.ir.issuelist.extension | csv | File extension of the issue list |
| com.github.bukama.ir.report.directory | target/reports | Directory where the report is generated (without trailing slash). The directory will be prefixed with "." and the the value of File.separator, together e.g "./". |
| org.junitpioneer.testreports.issuereport.issuelist.directory | - | Subdirectory of the issue list. The directory will be prefixed with "." and the the value of File.separator, together e.g "./". |
| org.junitpioneer.testreports.issuereport.issuelist.filename | issuelist | Filename of the issue list without extension or path |
| org.junitpioneer.testreports.issuereport.issuelist.extension | csv | File extension of the issue list |
| org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline | false | Skip first line of the CSV file|
| org.junitpioneer.testreports.issuereport.report.directory | target/reports | Directory where the report is generated (without trailing slash). The directory will be prefixed with "." and the the value of File.separator, together e.g "./". |
|==========================
Empty file removed docs/keepDir
Empty file.
16 changes: 16 additions & 0 deletions docs/project-page.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
excerpt: 'Reports on tests. :)<br/> <small>Released on [GitHub](https://github.com/junit-pioneer/test-reports/releases), [JCenter](https://jcenter.bintray.com/org/junit-pioneer/test-reports/), and [Maven Central](https://mvnrepository.com/artifact/org.junit-pioneer/test-reports) under<br /><span class="coordinates">`org.junit-pioneer : test-reports : @tr:version`</span></small><br/><br/> {::nomarkdown}<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=junit-pioneer&repo=test-reports&type=watch&count=true&size=large&v=2" frameborder="0" scrolling="0" width="145px" height="30px"></iframe> <iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=junit-pioneer&repo=test-reports&type=star&count=true&size=large" frameborder="0" scrolling="0" width="138px" height="30px"></iframe> <iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=junit-pioneer&repo=test-reports&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="138px" height="30px"></iframe>{:/nomarkdown}'
---
:page-layout: single
:page-permalink: /test-reports/
:page-header: { overlay_image: {site-images}/test-reports-full.jpg, title_alignment: left }
:page-title: Test Reports

== Motivation

The `Test Reports` provides additional information in (new) reports of the test results.
The project was started as the current JUnit test report can not publish additional attributes or information, e.g. values created by extensions.
The library provides test report provider(s) the user can use.
For example the first report provider (added to this library) gathers information published by the https://junit-pioneer.org/docs/issue/[Pioneer Issue extension] and creates a report which contains information about issues, corresponding tests and their results.
For more information see the ../issue-report.adoc[Issue report documentation].

Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ public enum IssueReportConfig {
* The directory will be prefixed with "." and the the value of File.separator, together e.g "./".
* Default: ""
*/
ISSUELIST_DIRECTORY("com.github.bukama.ir.issuelist.directory", ""),
ISSUELIST_DIRECTORY("org.junitpioneer.testreports.issuereport.issuelist.directory", ""),
/**
* Filename of the issue list without extension or path.
* Default: "issuelist"
*/
ISSUELIST_FILENAME("com.github.bukama.ir.issuelist.filename", "issuelist"),
ISSUELIST_FILENAME("org.junitpioneer.testreports.issuereport.issuelist.filename", "issuelist"),
/**
* File extension of the issue list.
* Default: "csv"
*/
ISSUELIST_EXTENSION("com.github.bukama.ir.issuelist.extension", "csv"),
ISSUELIST_EXTENSION("org.junitpioneer.testreports.issuereport.issuelist.extension", "csv"),
/**
* Skip first line of the issue list, when it's an csv file.
* Default: "false"
*/
ISSUELIST_CSV_SKIPFIRSTLINE("com.github.bukama.ir.issuelist.csv.skipfirstline", "false"),
ISSUELIST_CSV_SKIPFIRSTLINE("org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline", "false"),
/**
* Directory where the report is generated (without trailing slash).
* The directory will be prefixed with "." and the the value of File.separator, together e.g "./".
* Default: "target/reports"
*/
REPORT_DIRECTORY("com.github.bukama.ir.report.directory", "target/reports");
REPORT_DIRECTORY("org.junitpioneer.testreports.issuereport.report.directory", "target/reports");

private final String key;
private final String defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void readDefaultStringValue() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.extension", value = "xml")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.extension", value = "xml")
void readProvidedStringValue() {
String expected = "xml";
String actual = IssueReportConfig.ISSUELIST_EXTENSION.asString();
Expand All @@ -35,7 +35,7 @@ void readProvidedStringValue() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.csv.skipfirstline", value = "true")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline", value = "true")
void readBooleanValue() {
boolean actual = IssueReportConfig.ISSUELIST_CSV_SKIPFIRSTLINE.asBoolean();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.junitpioneer.jupiter.SetSystemProperty;
import org.junitpioneer.testreports.issuereport.jaxb.IssueType;

@SetSystemProperty(key = "com.github.bukama.ir.issuelist.directory", value = "examples")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.directory", value = "examples")
public class IssueReportCSVReaderTests {

IssueReportCSVReader sut;
Expand All @@ -34,8 +34,8 @@ void setUp() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "oneLine")
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.csv.skipfirstline", value = "false")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "oneLine")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline", value = "false")
void processFileWithOneLine() {
IssueType expected = new IssueType("req-123", "description with spaces", "HIGH");

Expand All @@ -47,8 +47,8 @@ void processFileWithOneLine() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "threeLines")
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.csv.skipfirstline", value = "false")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "threeLines")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline", value = "false")
void processFileWithThreeLines() {
List<IssueType> expectedIssues = new ArrayList<>();
expectedIssues.add(new IssueType("req-123", "description with spaces", "HIGH"));
Expand All @@ -64,8 +64,8 @@ void processFileWithThreeLines() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "oneLine")
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.csv.skipfirstline", value = "true")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "oneLine")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.csv.skipfirstline", value = "true")
void processLineSkipFirstLine() {
String fileName = issueListReader.buildFileName();
List<IssueType> actual = new ArrayList<>(sut.readFile(fileName));
Expand All @@ -74,7 +74,7 @@ void processLineSkipFirstLine() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "tooMuchElements")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "tooMuchElements")
void tooMuchElementsInLine() {
String fileName = issueListReader.buildFileName();

Expand All @@ -84,7 +84,7 @@ void tooMuchElementsInLine() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "tooLessElements")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "tooLessElements")
void tooLessElementsInLine() {
String fileName = issueListReader.buildFileName();

Expand All @@ -94,7 +94,7 @@ void tooLessElementsInLine() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.filename", value = "nonexisting")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.filename", value = "nonexisting")
void FileNotFound() {
String fileName = issueListReader.buildFileName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class SupportedListTypesTests {

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.extension", value = "csv")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.extension", value = "csv")
void supportedTypeLowercase() {
SupportedListTypes expected = SupportedListTypes.CSV;
SupportedListTypes actual = SupportedListTypes.byConfig();
Expand All @@ -28,7 +28,7 @@ void supportedTypeLowercase() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.extension", value = "CSV")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.extension", value = "CSV")
void supportedTypeUppercase() {
SupportedListTypes expected = SupportedListTypes.CSV;
SupportedListTypes actual = SupportedListTypes.byConfig();
Expand All @@ -37,7 +37,7 @@ void supportedTypeUppercase() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.extension", value = " CSV ")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.extension", value = " CSV ")
void supportedTypeTrimmed() {
SupportedListTypes expected = SupportedListTypes.CSV;
SupportedListTypes actual = SupportedListTypes.byConfig();
Expand All @@ -46,7 +46,7 @@ void supportedTypeTrimmed() {
}

@Test
@SetSystemProperty(key = "com.github.bukama.ir.issuelist.extension", value = "NotSupported")
@SetSystemProperty(key = "org.junitpioneer.testreports.issuereport.issuelist.extension", value = "NotSupported")
void notSupportedType() {
assertThatThrownBy(SupportedListTypes::byConfig)
.isInstanceOf(IllegalArgumentException.class)
Expand Down

0 comments on commit 8be066c

Please sign in to comment.