Skip to content
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

Collect multiples JGiven JSON reports to a single HTML report. #387

Open
zambrovski opened this issue Mar 5, 2019 · 4 comments
Open

Collect multiples JGiven JSON reports to a single HTML report. #387

zambrovski opened this issue Mar 5, 2019 · 4 comments

Comments

@zambrovski
Copy link

Imagine, I have a multi-module maven project with several modules containing their JGiven tests.
Now in a CI I want to generate a single report out of them.

Currently, the Maven Plugin supports the sourceDirectory to read json files from one directory.
It would be nice, if this would be either an ANT matcher or a list of directories could be specified.

@zambrovski
Copy link
Author

Currently, I'm using a workaround of copying all json files by the maven-resources-plugin to a single place and generate a report out of them...

@ahus1
Copy link
Contributor

ahus1 commented Mar 19, 2019

@zambrovski - the technique you describe works for me in several projects. I event went to far to zip the JSON reports and upload them as a secondary artifact to the artifact repository. In a different build I download reports from multiple projects, extract them and run the plugin.

@janschaefer
Copy link
Contributor

Sounds like a useful extension. Could you make a concrete example of how you would expect this to look like in Maven? What would be the Maven-native way of doing this?

@janschaefer janschaefer added this to the Backlog / Unplanned milestone May 1, 2019
@serrafrank
Copy link

serrafrank commented Mar 11, 2024

I had the same problem with a multi-module Java 21 /Spring Boot 3 / Maven project.
Here is the build section of my root pom for aggregating reports

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-jgiven-reports</id>
                        <phase>test</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.parent.basedir}/target/jgiven-reports/
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>
                                        ${basedir}/target/jgiven-reports/
                                    </directory>
                                    <includes>
                                        <include>**/*.json</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.tngtech.jgiven</groupId>
                <artifactId>jgiven-maven-plugin</artifactId>
                <version>${jgiven.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <format>html</format>
                    <sourceDirectory>${project.parent.basedir}/target/jgiven-reports/</sourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants