8000 [allure-adaptor] Add ability to define custom report title by valfirst · Pull Request #5373 · vividus-framework/vividus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[allure-adaptor] Add ability to define custom report title #5373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/modules/configuration/pages/reporting.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

== Configure report layout

[cols="3,1,1,3", options="header"]
[cols="3,2,1,3", options="header"]
|===
|Property Name
|Acceptable values
|Default
|Description

|`report.title`
|Any short description of the report.
|`VIVIDUS Report`
|The provided title is displayed on *Summary* widget of *Overview* tab. Also it is used as HTML title of the document.

|`report.show-parameters-section`
a|`true` +
`false`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public class AllureReportGenerator implements IAllureReportGenerator
private final File resultsDirectory =
new File((String) PropertiesUtils.loadAllureProperties().get("allure.results.directory"));

private final String reportTitle;

private final IPropertyMapper propertyMapper;
private final ResourcePatternResolver resourcePatternResolver;
private final AllurePluginsProvider allurePluginsProvider;
Expand All @@ -102,9 +104,11 @@ public class AllureReportGenerator implements IAllureReportGenerator

private boolean started;

public AllureReportGenerator(IPropertyMapper propertyMapper, ResourcePatternResolver resourcePatternResolver,
AllurePluginsProvider allurePluginsProvider, NotificationsSender notificationsSender)
public AllureReportGenerator(String reportTitle, IPropertyMapper propertyMapper,
ResourcePatternResolver resourcePatternResolver, AllurePluginsProvider allurePluginsProvider,
NotificationsSender notificationsSender)
{
this.reportTitle = reportTitle;
this.propertyMapper = propertyMapper;
this.resourcePatternResolver = resourcePatternResolver;
this.allurePluginsProvider = allurePluginsProvider;
Expand Down Expand Up @@ -267,7 +271,7 @@ public Template getTemplate(String name)
new Allure2Plugin()
);
Configuration configuration = new ConfigurationBuilder()
.withReportName("VIVIDUS Report")
.withReportName(reportTitle)
.withReportLanguage("en")
.withExtensions(extensions)
.withPlugins(allurePluginsProvider.getPlugins())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@

<bean id="allurePluginsProvider" class="org.vividus.report.allure.AllurePluginsProvider" />

<bean id="allureReportGenerator" class="org.vividus.report.allure.AllureReportGenerator"

Check failure on line 61 in vividus-allure-adaptor/src/main/resources/org/vividus/report/allure/spring.xml

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Incorrect constructor injection in XML Spring bean

No matching constructor found in class 'AllureReportGenerator'#treeend *** ** * ** *** |-------------------------------------------------|---|-----------------------------------------------------------------------------------------------------| | **AllureReportGenerator(...):** | | **Bean:** | | String reportTitle | | \<constructor-arg index="0" value="${report.title}" /\> | | IPropertyMapper propertyMapper | | **???** | | ResourcePatternResolver resourcePatternResolver | | **???** | | AllurePluginsProvider allurePluginsProvider | | Autowired: allurePluginsProvider(AllurePluginsProvider) | | NotificationsSender notificationsSender | | \<constructor-arg\>\<bean class="org.vividus.report.allure.notification.NotificationsSender" /\>... |
destroy-method="end">
<constructor-arg index="0" value="${report.title}" />

Check warning on line 63 in vividus-allure-adaptor/src/main/resources/org/vividus/report/allure/spring.xml

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Unresolved placeholders configured in the Spring XML application context

Cannot resolve property key
<constructor-arg>
<bean class="org.vividus.report.allure.notification.NotificationsSender" />
</constructor-arg>
Expand Down
C392
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class AllureReportGeneratorTests
private static final String EXECUTOR_JSON = "executor.json";
private static final String ALLURE_EXECUTOR_PROPERTY_PREFIX = "allure.executor.";
private static final String INDEX_HTML = "index.html";
private static final String VIVIDUS_REPORT = "VIVIDUS Report";

private final TestLogger logger = TestLoggerFactory.getTestLogger(AllureReportGenerator.class);

Expand All @@ -108,7 +109,7 @@ void beforeEach(@TempDir Path tempDir) throws IOException
resultsDirectory = tempDir.resolve("allure-results");
Files.createDirectories(resultsDirectory);
System.setProperty(ALLURE_RESULTS_DIRECTORY_PROPERTY, resultsDirectory.toAbsolutePath().toString());
allureReportGenerator = new AllureReportGenerator(propertyMapper, resourcePatternResolver,
allureReportGenerator = new AllureReportGenerator(VIVIDUS_REPORT, propertyMapper, resourcePatternResolver,
allurePluginsProvider, notificationsSender);
}

Expand Down Expand Up @@ -187,7 +188,7 @@ void testEndWhenResultsDirectoryDoesNotExist() throws IOException
File reportDirectory = tempDir.toFile();
resultsDirectory = tempDir.resolve("allure-results-to-be-created");
System.setProperty(ALLURE_RESULTS_DIRECTORY_PROPERTY, resultsDirectory.toAbsolutePath().toString());
allureReportGenerator = new AllureReportGenerator(propertyMapper, resourcePatternResolver,
allureReportGenerator = new AllureReportGenerator(VIVIDUS_REPORT, propertyMapper, resourcePatternResolver,
allurePluginsProvider, notificationsSender);
when(propertyMapper.readValue(ALLURE_EXECUTOR_PROPERTY_PREFIX, ExecutorInfo.class)).thenReturn(
Optional.empty());
Expand Down Expand Up @@ -294,7 +295,7 @@ private void assertIndexHtml(Path reportDirectory) throws IOException
private void assertSummaryJson(Path reportDirectory) throws IOException
{
assertFile(reportDirectory, "widgets/summary.json",
"{\"reportName\":\"VIVIDUS Report\","
"{\"reportName\":\"" + VIVIDUS_REPORT + "\","
+ "\"testRuns\":[],"
+ "\"statistic\":{\"failed\":0,\"broken\":0,\"skipped\":0,\"passed\":0,\"unknown\":0,\"total\":0},"
+ "\"time\":{}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ statistics.print-failures=false

report.show-parameters-section=true
report.text-length-diff-threshold=100
report.title=VIVIDUS Report
Loading
0