Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d211ba6
initial
anshooarora Jun 2, 2020
3b9050d
Update Readme.md
anshooarora Jun 2, 2020
3b05739
Delete Main.java
anshooarora Jun 2, 2020
63b13fc
Create BREAKING.md
anshooarora Jun 2, 2020
4398524
Delete ExtentKlovReporter.java
anshooarora Jun 2, 2020
b1072e3
initial
anshooarora Jun 5, 2020
66c09a1
Delete BREAKING.md
anshooarora Jun 5, 2020
2576f8a
fix System/Environment container naming
anshooarora Jun 5, 2020
fc6adad
add distributionManagement to pom.xml
anshooarora Jun 5, 2020
e96278a
Update Readme.md
anshooarora Jun 5, 2020
0e3b1a1
closes #173
anshooarora Jun 5, 2020
384ddcc
closes #153
anshooarora Jun 5, 2020
5a89d55
closes #152
anshooarora Jun 5, 2020
3f9abeb
Update Readme.md
anshooarora Jun 5, 2020
c7e0690
Update Readme.md
anshooarora Jun 5, 2020
0e27e41
Update Readme.md
anshooarora Jun 5, 2020
24dfc64
Update Readme.md
anshooarora Jun 6, 2020
d7dcf91
OfflineMode
anshooarora Jun 8, 2020
c3d8ce9
Update .travis.yml
anshooarora Jun 8, 2020
b628f0e
closes #168
anshooarora Jun 8, 2020
48336e1
bump cdn commit sig
anshooarora Jun 8, 2020
58e0eef
refactoring
anshooarora Jun 9, 2020
f1d6a0c
filter ScenarioOutline from status computation
anshooarora Jun 9, 2020
87de867
synchronize refresh
anshooarora Jun 9, 2020
d369e46
fix for null check
anshooarora Jun 9, 2020
4bda536
closes #157
anshooarora Jun 9, 2020
2bf4419
Update TestServiceTest.java
anshooarora Jun 9, 2020
8422b76
fix test
anshooarora Jun 9, 2020
ad4ca8c
closes #184
anshooarora Jun 9, 2020
d5ff047
Update spark-config.json
anshooarora Jun 9, 2020
6d5d048
fixes #185
anshooarora Jun 9, 2020
c90779f
remove RETRY status
anshooarora Jun 9, 2020
aec1de1
remove retry status
anshooarora Jun 9, 2020
acfd24e
update Readme for loading external configuration
anshooarora Jun 9, 2020
3f10aa7
Update Readme.md
anshooarora Jun 9, 2020
2b34a2f
Update Readme.md
anshooarora Jun 9, 2020
adb10dd
use jacoco for codecov
anshooarora Jun 9, 2020
328599f
add codecov badge
anshooarora Jun 9, 2020
85f94ba
add maven-central badge
anshooarora Jun 9, 2020
2746515
add services tests
anshooarora Jun 10, 2020
ad08a20
add tests: Markup::Table
anshooarora Jun 10, 2020
defc706
use cobertura as jacoco is failing some tests
anshooarora Jun 10, 2020
98701fa
adds ability to load both external xml and json config, updates Readme
anshooarora Jun 10, 2020
a4c2ca6
Delete RichViewReporterConfig.java
anshooarora Jun 10, 2020
5f8f532
#173, #176 refactoring
anshooarora Jun 11, 2020
f150dad
add tests: ReportStatsService, SparkReporter
anshooarora Jun 12, 2020
13c2744
resolve conflicts
anshooarora Jun 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ deploycmd.txt

# Intellij
.idea/

#
pom-nexus.xml
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: java
script: "mvn cobertura:cobertura"
jdk:
- openjdk8
services:
- mongodb
after_success:
- bash <(curl -s https://codecov.io/bash)

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## [5.0.0]

## [4.1.6](https://github.com/extent-framework/extentreports-java/compare/v4.1.5...v4.1.6)
#### Fixes
* [#149] Skipped count is not displaying in authors tag and category tag
Expand Down
195 changes: 187 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,193 @@
## Extent Framework 4 - Community Edition
## ExtentReports [![Join the chat at https://gitter.im/anshooarora/extentreports](https://badges.gitter.im/anshooarora/extentreports.svg)](https://gitter.im/anshooarora/extentreports?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Maven Central](https://img.shields.io/maven-central/v/com.aventstack/extentreports.svg?maxAge=300)](http://search.maven.org/#search|ga|1|g:"com.aventstack") [![Build Status](https://travis-ci.com/extent-framework/extentreports-java.svg?branch=v5.0.x)](https://travis-ci.com/extent-framework/extentreports-java) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/dbdc8c04b0f84489a738f064f28a82fa)](https://www.codacy.com/app/anshooarora/extentreports?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=extent-framework/extentreports&amp;utm_campaign=Badge_Grade) [![codecov](https://codecov.io/gh/extent-framework/extentreports-java/branch/master/graph/badge.svg)](https://codecov.io/gh/extent-framework/extentreports-java)

[![Join the chat at https://gitter.im/anshooarora/extentreports](https://badges.gitter.im/anshooarora/extentreports.svg)](https://gitter.im/anshooarora/extentreports?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Maven Central](https://img.shields.io/maven-central/v/com.aventstack/extentreports.svg?maxAge=300)](http://search.maven.org/#search|ga|1|g:"com.aventstack")
[![Build Status](https://travis-ci.com/extent-framework/extentreports-java.svg?branch=master)](https://travis-ci.com/extent-framework/extentreports-java)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dbdc8c04b0f84489a738f064f28a82fa)](https://www.codacy.com/app/anshooarora/extentreports?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=extent-framework/extentreports&amp;utm_campaign=Badge_Grade)
Help the project by contributing, or by giving a star at the top of this page.

#### Documentation
## Maven

View [extentreports.com](http://extentreports.com/docs/versions/4/java/) for complete documentation.
```xml
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
```

### License
## What's new

### Custom logs
You can now create your own custom logs, tables with custom headers, pass your POJOs directly
to be converted into a `<table>` etc. You can also specify any CSS classes to be applied on
the table, like in the below example with "table-sm" (a bootstrap table class).

```java
public class MyCustomLog {
private List<Object> names = Arrays.asList("Anshoo", "Extent", "Klov");
private Object[] favStack = new Object[]{"Java", "C#", "Angular"};
@MarkupIgnore
private List<Object> ignored = Arrays.asList("Anshoo/Ignore", "Extent/Ignore", "Klov/Ignore");
private Map<Object, Object> items = new HashMap<Object, Object>() {
{
put("Item1", "Value1");
put("Item2", "Value2");
put("Item3", "Value3");
}
};
}
extent.createTest("GeneratedLog").generateLog(Status.FAIL, MarkupHelper.toTable(new MyCustomLog(), "table-sm"));
```

![generateLog](http://extentreports.com/docs/v5/generateLog.png)

### Report filters for Status/Tag specific reports
It is now possible to create separate reports for each status (or a group of them). For example, 2 reports can be created per run session to 1. view all tests and 2. view only failed ones. The example below shows just that:

```java
ExtentReports extent = new ExtentReports();
// will only contain failures
ExtentSparkReporter sparkFail = new ExtentSparkReporter("target/spark/fail.html")
.filter()
.statusFilter()
.as(new Status[] { Status.FAIL })
.apply()
// will contain all tests
ExtentSparkReporter sparkAll = new ExtentSparkReporter("spark/all.html");
extent.attachReporter(sparkFail, sparkAll);
```

### Choose which views to display, in a particular order
It is now possible to select the views and their order. For example: if you want the Dashboard view
to be the primary view, followed by Tests, you can use the snippet below:

```java
ExtentReports extent = new ExtentReports();
ExtentSparkReporter spark = new ExtentSparkReporter("spark/spark.html")
.viewConfigurer()
.viewOrder()
.as(new ViewName[] { ViewName.DASHBOARD, ViewName.TEST })
.apply();
```

The above will limit the report to 2 views, with DASHBOARD view the primary one, followed by TEST.
No other views will be displayed. Default setting is to display all views in this order: TEST,
TAG, EXCEPTION, DASHBOARD.


### Ordered, Unordered lists
Use `MarkupHelper::createOrderedList` or `MarkupHelper.createUnorderedList` for
quick POJO to HTML list conversion.

```java
String[] items = new String[] { "Item1", "Item2", "Item3" };
Set<Object> items = new HashSet<>(Arrays.asList("Item1", "Item2", "Item3"));
List<Object> items = Arrays.asList(new Object[] { "Item1", "Item2", "Item3" });
extent.createTest("Test").info(MarkupHelper.createOrderedList(items));
```
![orderedList](http://extentreports.com/docs/v5/orderedList.png)

```java
Map<Object, Object> items = new HashMap<Object, Object>()
{{
put("Item1", "Value1");
put("Item2", "Value2");
put("Item3", "Value3");
}};
extent.createTest("Test").info(MarkupHelper.createUnorderedList(items).getMarkup());
```
![unorderedList](http://extentreports.com/docs/v5/unorderedList.png)

### Pojo to HTML Table
Pass your pojo to `MarkupHelper::toTable` to convert it into a table structure.
Note: this performs only single-level parsing, no deep searches.

```java
public class MyObject {
private List<Object> names = Arrays.asList("Anshoo", "Extent", "Klov");
private Object[] favStack = new Object[]{"Java", "C#", "Angular"};
@MarkupIgnore
private List<Object> ignored = Arrays.asList("Anshoo/Ignore", "Extent/Ignore", "Klov/Ignore");
private Map<Object, Object> items = new HashMap<Object, Object>() {
{
put("Item1", "Value1");
put("Item2", "Value2");
put("Item3", "Value3");
}
};
}
extent.createTest("Test").info(MarkupHelper.toTable(new MyObject()));
```

![toTable](http://extentreports.com/docs/v5/toTable.png)

### JSON configuration
Version 4 and earlier had the ability to consume configuration-XML files, a functionality that remained unchanged in v5.0.
External configuration can now be loaded via JSON also, as demonstrated below:

spark-config.json:
```
{
"theme": "standard",
"encoding": "utf-8",
"protocol": "HTTPS",
"timelineEnabled": false,
"offlineMode": true,
"documentTitle": "ExtentReports",
"reportName": "ExtentReports",
"timeStampFormat": "MMM dd, yyyy HH:mm:ss a",
"theme": "STANDARD",
"js": "",
"css": ""
}
```

```java
final File CONF = new File("config/spark-config.json");
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark/spark.html");
spark.loadJSONConfig(CONF);
```

### Configuration builders
Until version 4, it was only possible to specify a configuration entry at once, example:

```java
ExtentSparkReporter spark = new ExtentSparkReporter("spark.html");
spark.config().setTheme(Theme.DARK);
spark.config().setDocumentTitle("MyReport");
```

Now, it is possible build and pass the entire configuration at once:

```java
spark.withConfig(
ExtentSparkReporterConfig.builder()
.theme(Theme.DARK)
.documentTitle("MyReport")
.build()
);
```


## Breaking changes

* ExtentReports::getStartedReporters removed
* ExtentReports::detachReporter removed
* ExtentReports:setTestRunnerOutput renamed to `addTestRunnerOutput`
* Status::ERROR, Status::FATAL, Status::DEBUG removed
* ExtentHtmlReporter removed (use ExtentSparkReporter)
* ExtentLoggerReporter removed (use ExtentSparkReporter)
* Reporter::enableTimeline removed, use Reporter::setTimelineEnabled

## What's not working (yet)

* ~~OfflineMode~~
* Append, CreateDomainFromJsonArchive
* ~~Loading external configuration~~
* You tell me..

## Upcoming

* See [v5.0.x milestones](https://github.com/extent-framework/extentreports-java/issues?q=is%3Aopen+is%3Aissue+milestone%3A5.0.x)
* Want to see a feature added? You can raise one [here](https://github.com/extent-framework/extentreports-java/issues?q=is%3Aopen+is%3Aissue+milestone%3A5.0.x)

## License

Apache-2.0
44 changes: 0 additions & 44 deletions config/logger-config.xml

This file was deleted.

12 changes: 12 additions & 0 deletions config/spark-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"theme": "STANDARD",
"encoding": "utf-8",
"protocol": "HTTPS",
"timelineEnabled": false,
"offlineMode": true,
"documentTitle": "ExtentReports",
"reportName": "ExtentReports",
"timeStampFormat": "MMM dd, yyyy HH:mm:ss a",
"js": "",
"css": ""
}
96 changes: 47 additions & 49 deletions config/spark-config.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>

<!-- report theme -->
<!-- standard, dark -->
<theme>standard</theme>

<!-- document encoding -->
<!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>

<!-- protocol for script and stylesheets -->
<!-- defaults to https -->
<protocol>https</protocol>

<!-- offline report -->
<enableOfflineMode>false</enableOfflineMode>

<!-- title of the document -->
<documentTitle>Extent Framework</documentTitle>

<!-- report name - displayed at top-nav -->
<reportName>Build 1</reportName>

<!-- timestamp format -->
<timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>

<!-- settings to enable/disable views -->
<enableCategoryView>true</enableCategoryView>
<enableAuthorView>false</enableAuthorView>
<enableExceptionView>true</enableExceptionView>
<enableTestRunnerLogsView>true</enableTestRunnerLogsView>

<!-- custom javascript -->
<scripts>
<![CDATA[
$(document).ready(function() {

});
]]>
</scripts>

<!-- custom styles -->
<styles>
<![CDATA[

]]>
</styles>

</configuration>
<configuration>

<!-- report theme -->
<!-- STANDARD, DARK -->
<theme>STANDARD</theme>

<!-- document encoding -->
<!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>

<!-- protocol for script and stylesheets -->
<!-- defaults to https -->
<!-- HTTP, HTTPS -->
<protocol>HTTPS</protocol>

<!-- offline report -->
<timelineEnabled>true</timelineEnabled>

<!-- offline report -->
<enableOfflineMode>false</enableOfflineMode>

<!-- title of the document -->
<documentTitle>Extent Framework</documentTitle>

<!-- report name - displayed at top-nav -->
<reportName>Build 1</reportName>

<!-- timestamp format -->
<timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>

<!-- custom javascript -->
<scripts>
<![CDATA[
$(document).ready(function() {

});
]]>
</scripts>

<!-- custom styles -->
<styles>
<![CDATA[

]]>
</styles>

</configuration>
</extentreports>
Loading