Giter Site home page Giter Site logo

donut-maven-plugin's Introduction

Build Status Maven Central

donut-maven-plugin

This is a maven plugin for donut. More about donut here.

usage

in your pom.xml add the plugin with the following configuration:

<plugin>
    <groupId>report.donut</groupId>
    <artifactId>donut-maven-plugin</artifactId>
    <version>1.2.2</version>
    <executions>
        <execution>
            <id>execution</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <resultSources>
                    <resultSource>
                        <!-- optional format, defaults to cucumber -->
                        <format>cucumber</format>
                        <directory>${project.build.directory}/cucumber-reports</directory>
                    </resultSource>
                </resultSources>
                <outputPath>${project.build.directory}/donut</outputPath>
                <timestamp>${maven.build.timestamp}</timestamp>
                <template>default</template>
                <projectName>${project.name}</projectName>
                <!-- optional customAttributes -->
                <customAttributes>
                   <customAttribute>
                      <name>My Custom 1</name>
                      <value>custom123</value>
                   </customAttribute>
                   <customAttribute>
                      <name>App Name</name>
                      <value>${app.name}</value>
                   </customAttribute>
                </customAttributes>
            </configuration>
        </execution>
    </executions>
</plugin>

For older versions, use groupId as io.magentys and an appropriate version.

all configuration parameters

<resultSources>
<outputPath>
<prefix>
<timestamp>
<template>
<countSkippedAsFailure>
<countPendingAsFailure>
<countUndefinedAsFailure>
<countMissingAsFailure>
<projectName>
<projectVersion>
<customAttributes>

default values:

  • resultSources : is mandatory and it should be specify multiple result sources that detail the result format and location.
  • outputPath : by default a donut folder will be generated
  • prefix : the generated file is donut-report.html, however you can specify prefix i.e. myproject-
  • timestamp : refers to the start time of your execution. If not specified by the user reports will use now
  • template : donut supports 2 themes, default and light. default is the default value.
  • countSkippedAsFailure, countPendingAsFailure, countUndefinedAsFailure, countMissingAsFailure: are boolean values, and by default they are set to false.
  • projectName : is a string value
  • projectVersion : is a string value
  • customAttributes : is a map of name/value pairs

report timestamp

As it may take a while to execute your tests, Donut expects that you pass the start timestamp, otherwise will default it to now at the time of the report execution. The format should be yyyy-MM-dd-HHmm

Example:

<properties>
   <maven.build.timestamp.format>yyyy-MM-dd-HHmm</maven.build.timestamp.format>
</properties>

Contributing

To contribute:

  • Create an integration test to demonstrate the behaviour under src/it/. For example, to add support to default the report prefix to an empty string:
    • Create src/it/default-empty-prefix
    • Copy the contents of the src/it/default-empty-prefix directory and update the pom as appropriate to demonstrate the configuration. Update the verify.groovy to implement the test for your feature.
    • Run mvn clean install -Prun-its to run the integration tests.

License

This project is under an MIT license

Powered by: MagenTys & Mechanical Rock

donut-maven-plugin's People

Contributors

chdask avatar mplord avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

donut-maven-plugin's Issues

Required parameter `resultSources` not set.

I have upgraded my test project to Cucumber 4.7.2, donut 1.2.2 and donut-maven-plugin 1.2.2 from cucumber 1.2.5, donut 1.1 and donut-maven-plugin 0.0.5. And I also changed plugin configuration to the one provided in the current Readme.md.

donut-maven-plugin version 0.0.5 with configuration bonded to pre-intergration-test phase was working fine when called from the command line as a standalone task.

mvn io.magentys:donut-maven-plugin:0.0.5:generate

But after version the update the similar report generation task in the build fails with the following exception:

mvn report.donut:donut-maven-plugin:1.2.2:generate

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal report.donut:donut-maven-plugin:1.2.2:generate (default-cli) on project bbsw-test-harness: Required parameter `resultSources` not set.

While the plugin configuration clearly has this parameter:

<plugin>
  <groupId>report.donut</groupId>
  <artifactId>donut-maven-plugin</artifactId>
  <version>1.2.2</version>
  <executions>
    <execution>
      <id>execution</id>
      <phase>post-integration-test</phase>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <resultSources>
          <resultSource>
            <!-- optional format, defaults to cucumber -->
            <format>cucumber</format>
            <directory>${project.build.directory}/cucumber-reports</directory>
          </resultSource>
        </resultSources>
        <outputPath>${project.build.directory}/donut</outputPath>
        <timestamp>${maven.build.timestamp}</timestamp>
        <template>default</template>
        <projectName>${project.name}</projectName>
        <!-- optional customAttributes -->
        <customAttributes>
          <customAttribute>
            <name>App Name</name>
            <value>blah</value>
          </customAttribute>
        </customAttributes>
      </configuration>
    </execution>
  </executions>
</plugin>

Maven version 3.6.2.

What am I missing?

Update:
Maven debug log:

[DEBUG] Configuring mojo report.donut:donut-maven-plugin:1.2.2:generate from plugin realm 
ClassRealm[plugin>report.donut:donut-maven-plugin:1.2.2, parent: sun.misc.Launcher$AppClassLoader@4e25154f]
[DEBUG] Configuring mojo 'report.donut:donut-maven-plugin:1.2.2:generate' with basic configurator 
-->
[DEBUG]   (f) countMissingAsFailure = false
[DEBUG]   (f) countPendingAsFailure = false
[DEBUG]   (f) countSkippedAsFailure = false
[DEBUG]   (f) countUndefinedAsFailure = false
[DEBUG]   (f) customAttributes = []
[DEBUG]   (f) outputPath = D:\Projects\bbsw-test-harness\target\donut
[DEBUG]   (f) resultSources = []
[DEBUG]   (f) skip = false
[DEBUG]   (f) template = default
[DEBUG] -- end configuration --

Screenshots are missing in the donut report

After upgrading to the latest version (1.2.2), screenshots are missing in the report html. Prior to the update, screenshots were getting attached to the failed scenarios.

Donut Configuration

image

Cucumber Dependency

image

The failed screenshots are available in the cucumber report folder. However, donut is failing to attach it to the report.

Console Log

[INFO] --- donut-maven-plugin:1.2.2:generate (reporting) @ XXX_Automation ---
[INFO] Generating reports...
[WARNING] Could not lookup path List(projectMetadata, projectVersion) in List(Identifier(List(projectMetadata, projectVersion)))
[INFO] Donuts created at: C:\XXX_Automation\target\donut/donut-report.html

The build fails when using skip tests param

When running mvn clean install -DskipTests via the command line the build will fail as no report is produced. The build should not fail as we are intentionally not running any tests.

Add support for custom attributes

The latest version of donut provides the capability to pass custom attributes to the report. Update the maven plugin to enable custom attributes to be specified.

Build fails when there are special characters in cucumber.json

[ERROR] Failed to execute goalreport.donut:donut-maven-plugin:0.0.6:generate (execution) on project taf-chips: Error Found:: Input length = 1 -> [Help 1]
The error is not very meaningful but we discovered the build fails when there are special characters in the cucumber feature file. For example:

"%!@£$%^&*( “ ” ' ' « » … ° © ® ™ • ½ ¼ ¾ ⅓ ⅔ № † ‡ µ ¢ £ € ♤ ♧ ♥️ ♢ ✓)"

Removing those characters from cucumber.json fixes the problem, however it's painful having to manually go through json and remove all special characters especially if the feature file is massive.

Interesting fact is that it only happens on windows machines. Works fine one Mac no matter if the special characters are there or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.