Skip to content

Commit c3fea3d

Browse files
authored
Updated user guide
- added description related to new logic
1 parent 2e27ebd commit c3fea3d

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

README.md

+41-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Serenity integration with ReportPortal
22
===================
33

4-
Module allows to report Serenity powered tests to [Report Portal]((http://reportportal.io)).
4+
Module allows to report Serenity powered tests to [reportportal.io]((http://reportportal.io)).
55

66
Setup
77
-------------
@@ -10,10 +10,10 @@ To add support of Serenity with Report Portal integration simply add dependencie
1010
<dependency>
1111
<groupId>com.github.invictum</groupId>
1212
<artifactId>serenity-reportportal-integration</artifactId>
13-
<version>1.0.3</version>
13+
<version>1.0.4</version>
1414
</dependency>
1515
```
16-
Report Portal uses external repository, so it URL also should be added to your build configuration
16+
Report Portal core libraries are used, but it uses external repository, so it URL also should be added to your build configuration
1717
```
1818
<repositories>
1919
<repository>
@@ -26,26 +26,54 @@ Report Portal uses external repository, so it URL also should be added to your b
2626
</repository>
2727
</repositories>
2828
```
29-
Actually from this point setup of integration is done. The only thing you should to do is to configure Report Portal itself. This process is described in [Report Portal Documentation](http://reportportal.io/docs/JVM-based-clients-configuration).
30-
Now run your tests normally and report should appear on Report Portal. To add custom messages into report portal, just emit logs
29+
Actually from this point setup of integration is done. The only thing you should to do is to configure Report Portal itself. In general it means just adding of `reportportal.properties` file to you project. Properties example is described below
30+
```
31+
rp.endpoint = http://report-portal-url
32+
rp.uuid = 385bha54-c1df-42c7-afa4-9e4c028930af
33+
rp.launch = My_Cool_Launch
34+
rp.project = My_Cool_Project
35+
```
36+
For more details related to Report Portal configuration please reffer to [Report Portal Documentation](http://reportportal.io/docs/JVM-based-clients-configuration).
37+
38+
Now run your tests normally and report should appear on Report Portal in accordance to provided configuration. To add custom messages to Report Portal, you may emit logs in any place in your test
3139
```
3240
ReportPortal.emitLog("My message", "INFO", Calendar.getInstance().getTime());
3341
```
34-
Message will appear in the scope of entity it was triggered. I. e. inside related test or step.
42+
Message will appear in the scope of entity it was triggered. I. e. inside related step.
43+
> **Notice**
44+
> Actually to add logs to Report Portal, they should be emitted in scope of test method
3545
3646
Integration configuration
3747
-------------
38-
Integration provides two reporting styles:
3948

40-
- build steps as nested entities into tree `StepTreeHandler.class` (default)
41-
- build steps as sequence of emited logs `StepFlatHandler.class`
49+
Each Serenity `TestStep` is passed throug chain of configured `StepProcessors`. This approach allows to flexible configure reporting behaviour on the step level. All configuration is accessible from the code. By default integration provides two configuration profiles:
4250

43-
This behaviour may be configured using code snippet
51+
- DEFAULT
52+
- CUSTOM
53+
54+
`DEFAULT` profile is used by default and contains all usually required reporting details. To change default behavior `CUSTOM` profile shoul be used.
55+
```
56+
StepsSetProfile config = StepsSetProfile.CUSTOM.registerProcessors(new ScreenshotAttacher());
57+
ReportIntegrationConfig.useProfile(config);
4458
```
45-
ReportIntegrationConfig.setHandlerClass(StepFlatHandler.class);
59+
In example above `CUSTOM` profile with `ScreenshotAttacher` processor is configured. All step processors available out of the box may be observed in `com.github.invictum.reportportal.processor` package.
60+
It is possible to use integrated processors as well as implemented by your own
4661
```
47-
> **Note**
48-
Configuration should be provided only once, before any Serenity facility initialization. For example in `@BeforeClass` method
62+
public class StartStepLogger implements StepProcessor {
63+
64+
@Override
65+
public void proceed(final TestStep step) {
66+
// You logic here to emit logs
67+
}
68+
}
69+
```
70+
> **Warning**
71+
To emit log to Report Portal date should be specified. If log timestams is out of range of step it won't be emitted at all. `TestStep` contains all data to calculate start, end dates and duration
72+
73+
The order of processors registtration is matters, this order the same as order of invocation.
74+
75+
> **Notice**
76+
Profile configuration should be provided before Serenity facility init (For example on `@BeforeClass` method on the parent test class). Otherwise default profile will be used.
4977

5078
Limitations
5179
-------------

0 commit comments

Comments
 (0)