在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):trivago/cluecumber-report-plugin开源软件地址(OpenSource Url):https://github.com/trivago/cluecumber-report-plugin开源编程语言(OpenSource Language):Java 82.9%开源软件介绍(OpenSource Introduction):Clear and Concise Cucumber Reporting for Maven
Cluecumber Report Maven PluginThis plugin creates aggregated test reports from Cucumber compatible JSON files that are generated by Cucumber BDD, Karate and other frameworks. This project was created because other projects...
Note: From Cluecumber 1.10.2 on, Cluecumber fully supports Cucumber's new scenario start timestamps! If you need to run Cucumber tests in parallel, please check out our Cucable project! Example reportA fully generated example report can also be viewed online! ChangelogAll changes are documented in the full changelog. PrerequisitesIn order to have the JSON files as a source for the Cluecumber Report generation, you need to specify this option in your Cucumber runner configuration: Cucumber 1.x:
Cucumber >= 2.x:
This will generate JSON results for all Cucumber tests. Maven POM settings<plugin>
<groupId>com.trivago.rta</groupId>
<artifactId>cluecumber-report-plugin</artifactId>
<version>Check the version number above</version>
<executions>
<execution>
<id>report</id>
<phase>post-integration-test</phase>
<goals>
<goal>reporting</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceJsonReportDirectory>${project.build.directory}/cucumber-report</sourceJsonReportDirectory>
<generatedHtmlReportDirectory>${project.build.directory}/generated-report</generatedHtmlReportDirectory>
</configuration>
</plugin> Mandatory Configuration ParametersThere are two mandatory parameters that have to be specified within the Maven POM Note: Typically, both properties point to directories inside the Maven sourceJsonReportDirectoryThis specifies the source folder of the Cucumber JSON result files. <configuration>
<sourceJsonReportDirectory>c:/example/json-files</sourceJsonReportDirectory>
...
</configuration> generatedHtmlReportDirectoryThis points to the root directory of the generated Cluecumber HTML report. <configuration>
<generatedHtmlReportDirectory>c:/example/my-report</generatedHtmlReportDirectory>
...
</configuration> Optional Configuration ParametersPlugin LoggingBy default, Cluecumber logs all information including
This can be configured by passing the
Add Custom Information to the ReportAdd Custom Information Using PropertiesThe Note: Underscores in the parameter names are automatically turned into spaces in the report.
Valid URLs that start with a protocol (http, https, ftp) are automatically recognized and turned into clickable links.
If a parameter name starts with an underscore ( <configuration>
<customParameters>
<Custom_Parameter>This is a test</Custom_Parameter>
<Custom_URL>http://www.google.com</Custom_URL>
<_Text>This is a long text that is displayed without the key. This can be used to display longer texts in the report!</_Text>
</customParameters>
...
</configuration> The property definitions above are shown in the report like this: Add Custom Information Using a FileYou can also set custom parameters by specifying the path to a <configuration>
<customParametersFile>path/to/your/customParameters.properties</customParametersFile>
...
</configuration> This file needs to have a format like this: Custom_Parameter=This is a test
Custom_URL=http://www.google.com
_Text=This is a long text that is displayed without the key. This can be used to display longer texts in the report! Note: These custom parameters behave exactly like the ones defined by the The property definitions above are shown in the report like this: Where to Display Custom ParametersYou can decide how to display the custom parameters in the report using the The following display modes are available for displaying the custom parameters:
<configuration>
<customParametersDisplayMode>ALL_PAGES</customParametersDisplayMode>
...
</configuration> The default value for this property is Skip Report GenerationThe <configuration>
<skip>true</skip>
...
</configuration> Fail Scenarios on Pending or Undefined StepsThe optional <configuration>
<failScenariosOnPendingOrUndefinedSteps>true</failScenariosOnPendingOrUndefinedSteps>
...
</configuration> Auto-expand Certain Report SectionsThe If they are not set, they default to false. This means that the report user has to use the buttons on a scenario detail page to expand those sections on demand. <configuration>
<expandBeforeAfterHooks>true|false</expandBeforeAfterHooks>
<expandStepHooks>true|false</expandStepHooks>
<expandDocStrings>true|false</expandDocStrings>
...
</configuration> Auto-expand AttachmentsBy default, attachments are collapsed and can be toggled individually. If the <configuration>
<expandAttachments>true|false</expandAttachments>
...
</configuration> Optional Configuration Parameters for Changing the Report AppearanceDefining the report start pageThe default start page of the reports (if not overwritten by the <configuration>
<startPage>ALL_SCENARIOS</startPage>
...
</configuration> This can be customized with one of the following values:
Defining a custom report titleBy default, the page html title of the report pages is By setting the property <configuration>
<customPageTitle>My Report</customPageTitle>
...
</configuration> This would lead to a report title like this: Defining a custom CSS fileThe If you have a custom CSS file called body {
background-color: black;
}
h3, h4, h5 {
color: white;
} To use this files, specify it like so in your pom file or as a system property: <configuration>
<customCss>custom/custom.css</customCss>
...
</configuration> When generating the report, this file is automatically included as Likewise, if you want to hide elements from the report, you can also add this to the custom css like so: .some_element {
display: none;
} Defining custom passed, skipped and failed colorsIt is possible to set these properties to change the color scheme for passed, failed and skipped steps and scenarios including the displayed diagrams. The values have to be valid hex colors: <configuration>
<customStatusColorPassed>#017FAF</customStatusColorPassed>
<customStatusColorFailed>#C94A38</customStatusColorFailed>
<customStatusColorSkipped>#F48F00</customStatusColorSkipped>
...
</configuration> The result of this customization is:
Running the reporting goal directly via command lineIn some cases it may be desirable to run the reporting as a completely separate step, e.g. in CI pipelines. This can be done by running
directly from the command line. Note: If you want this invocation to consider the configuration that is included in your POM file,
the
Passing properties via command lineYou can also pass properties directly on the command line, e.g.
Passing custom parameters via command lineIf you want to set a custom parameter, you can do it like this: Set an empty property in your pom file's properties block: <properties>
<someProperty/>
</properties> Also define it in the Cluecumber section in your POM: <customParameters>
<My_Parameter_Name>${someProperty}</Base_Url>
</customParameters> When invoking the reporting, you can now pass this property via the
Note: If you don't pass this property, Cluecumber will ignore it and not show it in the report. Example projectYou can test the complete flow and POM configuration by checking out the Cluecumber example project. AppendixBuildingCluecumber requires Java >= 8 and Maven >= 3.3.9. It is available in Maven central. Generated pages
LicenseCopyright 2018 - 2022 trivago N.V. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论