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

Support configurable NamingStrategy.ExampleName #32

Merged
merged 1 commit into from
Apr 5, 2024

Commits on Apr 5, 2024

  1. Support configurable NamingStrategy.ExampleName

    For example:
    
    ```java
    public final class MyJUnitXmlFormatter implements ConcurrentEventListener {
    
        private final MessagesToJunitXmlWriter writer;
    
        public JUnitFormatter(OutputStream out) {
            this.writer = new MessagesToJunitXmlWriter(NamingStrategy.ExampleName.PICKLE, out);
        }
    
        @OverRide
        public void setEventPublisher(EventPublisher publisher) {
            publisher.registerHandlerFor(Envelope.class, this::write);
        }
    
        private void write(Envelope event) {
            try {
                writer.write(event);
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
    
            if (event.getTestRunFinished().isPresent()) {
                try {
                    writer.close();
                } catch (IOException e) {
                    throw new IllegalStateException(e);
                }
            }
        }
    
    }
    ```
    
    Note: Cucumber-JVM at present doesn't allow much configuration of plugins.
    To take advantage of this new option, the class above must be copied. And
    can be used in Cucumber-JVM with
    `cucumber.plugin=com.example.MyJUnitXmlFormatter:target/report.xml`.
    
    Fixes: #27
    mpkorstanje committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    d77dd29 View commit details
    Browse the repository at this point in the history