Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Support for gherkin keywords in different languages (ex. norwegian) #939

Closed
krehator21 opened this issue Aug 25, 2017 · 17 comments
Closed

Comments

@krehator21
Copy link

Summary

Extent report is not able to recognize Cucumber feature files in a different language other then english. I am currently using gherkin Feature files in Norwegian language. My issue is does Extent report support different languages?

Expected Behavior

Extent report is able to recognize gherkin keywords based in different languages other then english.

Current Behavior

Extent report is not able to translate the gherkin keyword Gitt (norwegian) into Given. An exception is throw because the plugin is not able to find the class.

Sample

java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Gitt
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:264)
            at com.aventstack.extentreports.GherkinKeyword.<init>(GherkinKeyword.java:46)
            at com.cucumber.listener.ExtentCucumberFormatter.match(ExtentCucumberFormatter.java:228)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at cucumber.runtime.Utils$1.call(Utils.java:40)
            at cucumber.runtime.Timeout.timeout(Timeout.java:16)
            at cucumber.runtime.Utils.invoke(Utils.java:34)
            at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:294)
            at com.sun.proxy.$Proxy122.match(Unknown Source)
            at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:68)
            at cucumber.runtime.Runtime.runStep(Runtime.java:279)
            at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
            at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
            at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
            at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
            at org.junit.runners.Suite.runChild(Suite.java:128)
            at org.junit.runners.Suite.runChild(Suite.java:27)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:59)
            at org.junit.runners.Suite.runChild(Suite.java:128)
            at org.junit.runners.Suite.runChild(Suite.java:27)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:53)
            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
            at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
            at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
            at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
            at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
            at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
            at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
            at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
            at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
            at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Environment Details

  • Extent report Version used: 3.0.6
  • Operating System and version: Windows 7
  • JDK Version: 1.8
@anshooarora
Copy link
Owner

anshooarora commented Aug 25, 2017

Please test with this branch by compiling into jar or adding sources as project. To initiate:

ExtentReports extent = new ExtentReports();
extent.setGherkinDialect("no");

Note: Dialects come from gherkin-languages.json.

Does it work?

@krehator21
Copy link
Author

I followed your suggestion and now I get the following erro:r

java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.null
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at com.aventstack.extentreports.GherkinKeyword.<init>(GherkinKeyword.java:66)
	at com.cucumber.listener.ExtentCucumberFormatter.match(ExtentCucumberFormatter.java:237)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at cucumber.runtime.Utils$1.call(Utils.java:40)
	at cucumber.runtime.Timeout.timeout(Timeout.java:16)
	at cucumber.runtime.Utils.invoke(Utils.java:34)
	at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:294)
	at com.sun.proxy.$Proxy16.match(Unknown Source)
	at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:68)
	at cucumber.runtime.Runtime.runStep(Runtime.java:279)
	at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
	at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
	at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
	at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:59)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:53)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

@anshooarora
Copy link
Owner

anshooarora commented Aug 25, 2017

Can you share the code you used or possible create a project for me to reproduce what you're doing?

@krehator21
Copy link
Author

krehator21 commented Aug 25, 2017

I am trying to adapt this plugin to support Norwegian Gherkin dialect. The plugin uses your plugin as basis to generate a user-friendly cucumber Test report

<dependency>
         <groupId>com.vimalselvam</groupId>
         <artifactId>cucumber-extentsreport</artifactId>
         <version>3.0.1</version>
</dependency>

I made some adjustments in the original project in order to support norwegian language. Just run the test class RunCukesTest

I sent you an invitation as a collaborator to the project bellow

https://github.com/krehator21/cucumber-extentsreport-norwegian/

@anshooarora
Copy link
Owner

All tests have passed. All I did to the project was, host the -SNAPSHOT at Nexus, add the latest dependency to the project. Can you please check once?

@anshooarora
Copy link
Owner

@krehator21
Did you get a chance to try it out?

@krehator21
Copy link
Author

Sorry I didn't get back to you sooner. For a simple Test in english works great. But if the language in the gluecode is in norwegian the plugin is not able to find the Step definitions. Updated the Tests in the project if you are interested in reproducing the error. Thanks in advance

@krehator21
Copy link
Author

@anshooarora
Any updates on the issue?

@anshooarora
Copy link
Owner

anshooarora commented Aug 31, 2017

I believe it is the way this setting is created. The issue got resolved when I did this in ExtentCucumberFormatter.java:

private static void setExtentReport() {
        if (extentReports != null) {
            return;
        }
        extentReports = new ExtentReports();
        try {
            extentReports.setGherkinDialect("no");
        } catch (UnsupportedEncodingException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    //....

@anshooarora
Copy link
Owner

Note: this should be the very first setting applied to ExtentReports, before any of the tests start.

@hemano
Copy link

hemano commented Sep 27, 2017

I'm still getting the error

java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.*
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.aventstack.extentreports.GherkinKeyword.(GherkinKeyword.java:46)
at com.cucumber.listener.ExtentCucumberFormatter.match(ExtentCucumberFormatter.java:224)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at cucumber.runtime.Utils$1.call(Utils.java:40)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:34)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:294)
at com.sun.proxy.$Proxy15.match(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:68)
at cucumber.runtime.Runtime.runStep(Runtime.java:279)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:59)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:53)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

@anshooarora
Copy link
Owner

On what keyword was this error thrown?

@anshooarora anshooarora reopened this Sep 27, 2017
@amarmg
Copy link

amarmg commented Feb 9, 2018

I am using v 3.0.7 along with cucumber. and while using * instead of Given, When Then, i am facing below error. I did not faced this in 3.0.2.

java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.*

@anshooarora
Copy link
Owner

Why are you using * instead of a GherkinKeyword?

@amarmg
Copy link

amarmg commented Feb 13, 2018

it is for data set up steps that I do which are not part of acceptance criteria.

@anshooarora
Copy link
Owner

It is not an acceptable GherkinKeyword, so obviously this error is thrown.

@amarmg
Copy link

amarmg commented Feb 14, 2018

But it was supported in v 3.0.3

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

No branches or pull requests

4 participants