Cucumber Exception

1,112 views
Skip to first unread message

Shantanu Mishra

unread,
Jun 25, 2015, 5:55:05 AM6/25/15
to cu...@googlegroups.com
I am trying to run a simple selenium script using cucumber
---------------------------------------------------------------------
public class SeleniumTest {
public static void main(String args[])
{
System.setProperty("webdriver.ie.driver", "D:\\TECHM\\SM291459\\Jars\\IEDriverServer_x64_2.45.0\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.navigate().to("http://www.store.demoqa.com");
driver.findElement(By.xpath("//a[@class='account_icon']")).click();
driver.findElement(By.name("log")).sendKeys("testuser_1");
driver.findElement(By.id("pwd")).sendKeys("Test@123");
driver.findElement(By.id("login")).click();
System.out.println("Logged in Succesfully");
driver.quit();
}
-------------------------------------------------------------------------
This is my test runner classes
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;


@RunWith(Cucumber.class)
@CucumberOptions(
features = "Feature"
,glue={"stepDefinition"}
)
public class TestRunner {

}
---------------------------------------------------------------------
My feature file
Feature: Login Action

Scenario: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters UserName and Password
Then Message displayed Login Successfully
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully
--------------------------------------------------------------------------
I have all the jars added.
Bu still I m getting the below exception
------------------------------------------------
WARNING: Cucumber-JVM's --format option is deprecated. Please use --plugin instead.
Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@4038d0]
at cucumber.runtime.Reflections.newInstance(Reflections.java:44)
at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:30)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:97)
at cucumber.runtime.Runtime.<init>(Runtime.java:64)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)
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)
... 5 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)
... 10 more
-------------------------------------------------------------------------------------
Can anyonce please help me in this. 



Aslak Hellesøy

unread,
Jun 25, 2015, 9:22:15 AM6/25/15
to cu...@googlegroups.com
Make sure all your cucumber-* jars have the same version.

Aslak 

--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shantanu Mishra

unread,
Jun 25, 2015, 9:29:32 AM6/25/15
to cu...@googlegroups.com

I have attached a screen shot of the jars

Björn Rasmusson

unread,
Jun 25, 2015, 11:18:27 AM6/25/15
to cu...@googlegroups.com
Shantanu Mishra wrote:

I have attached a screen shot of the jars

You have cucumber-java-1.1.2 instead of cucumber-java-1.2.2.

Björn
 

Shantanu Mishra

unread,
Jun 26, 2015, 4:52:05 AM6/26/15
to cu...@googlegroups.com
Its working Now....Thanks all for your help


On Thursday, June 25, 2015 at 3:25:05 PM UTC+5:30, Shantanu Mishra wrote:
Reply all
Reply to author
Forward
0 new messages