Cucumber | Facing issues using Examples: | Selenium Forum
M
Posted on 26/01/2016
Hi,

I am trying the cucumber examples and after figuring out a workaround for the parsing error and Lexical error, I ended up getting a
"java.lang.UnsupportedOperationException" and its kind of clueless. Please see the attached file and I have all the error traces as well as the feature file, runner and the class file that I am using.

Your help on this will be much appreciated as always.

Regards,
Arun

M
Replied on 28/01/2016

Well, I tried using @tester and even @login and @hellotester but it doesn't work. I am still getting the "java.lang.UnsupportedOperationException".


M
Replied on 28/01/2016

zip and upload the project.


M
Replied on 31/01/2016

Hi,

I have zipped and uploaded the complete project for your reference. Please let me know the issue in it.

Regards,
Arun


M
Replied on 01/02/2016

update all your jar files.


M
Replied on 01/02/2016

Can I get all the updated JARS in one place? I just noted down the names and downloaded them one by one by looking at your video? Is there a better approach?


M
Replied on 01/02/2016

Below are the latest JAR's that I downloaded and included and I am getting this new error

Cucumber-core-1.1.5.jar
cucumber-html-0.2.3
cucumber-java-1.1.3
cucumber-junit-1.1.5
gherkin-2.12.2
hamcrest-core-1.3
jchronic-0.2.6
junit-4.12


Error:
cucumber.runtime.CucumberException: java.lang.reflect.InvocationTargetException


M
Replied on 01/02/2016

update this 2 file.

http://mvnrepository.com/artifact/info.cukes/cucumber-core/1.2.4
http://mvnrepository.com/artifact/info.cukes/cucumber-junit/1.2.4


M
Replied on 03/02/2016

That did not still help me either. i did update the JAR's as per your previous comment and I am getting the below error. Also attached the jar's screenshot for your reference. Please help!

cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@13b6d03]
at cucumber.runtime.Reflections.newInstance(Reflections.java:44)
at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:30)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:98)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:78)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cucumber.runtime.Reflections.newInstance(Reflections.java:41)
... 23 more
Caused by: java.lang.NoSuchMethodError: cucumber.runtime.io.ClasspathResourceLoader.getAnnotations(Ljava/lang/String;)Ljava/util/Collection;
at cucumber.runtime.java.ClasspathMethodScanner.findCucumberAnnotationClasses(ClasspathMethodScanner.java:75)
at cucumber.runtime.java.ClasspathMethodScanner.<init>(ClasspathMethodScanner.java:23)
at cucumber.runtime.java.JavaBackend.<init>(JavaBackend.java:30)
... 28 more

Responsive image

M
Replied on 03/02/2016

change this [color=#FF0000:rcm6nrky]@cucumber.option[/color:rcm6nrky] to this [color=#FF0000:rcm6nrky]@cucumberoption(features = {"path/to/myfile.feature"})[/color:rcm6nrky]


M
Replied on 04/02/2016

Hi,

I actually looked at module-42 videos and integrated maven with cucumber. I added the respective dependencies and when I copied the respective scripts and ran, it worked fine and I am glad I am able to proceed with the cucumber tutorial now. I believe the issue is with the jar files earlier.

Btw, I am already using "@CucumberOptions(plugin={"html:output"})" in the runner class since options is deprecated. Thanks a lot for your continuous support and I appreciate it.