Not able to run cucumber bdd framework | Selenium Forum
M
Posted on 19/10/2015
When running simple step file through runner I am getting error.

java.lang.TypeNotPresentException: Type Cucumber not present
at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:46)
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:75)
at com.sun.proxy.$Proxy4.value(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
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:26)
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.ClassNotFoundException: Cucumber
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:390)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:371)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:300)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
at java.lang.Class.getAnnotation(Class.java:3137)
at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:10)
... 12 more
Same I am getting when running salesforce project too.

M
Replied on 20/10/2015

your cucumber jars are missing i think

add this

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.1.8</version>
</dependency>


M
Replied on 20/10/2015

if error occurs again dowload these.

Cucumber-java (1.2.2) -Cucumber-junit (1.2.2) -Cucumber-picocontainer (1.2.2) -junit (4.12)


M
Replied on 20/10/2015

these errors are gone. But facing new issue. when running a feature file I am getting below message:

Feature: Logging into Salesforce

In order to work
As a sales person
I want to login

@login
Scenario Outline: Logging in salesforce # com/qtpselenium/app/salesforce/login/login.feature:8
#Given Runmode is "Y"
#Given I go to "http://qtpselenium.com/login/selectlogin.php" on "mozilla"
Then All tabs on menu should be present

0 Scenarios
0 Steps
0m0.000s

Note: steps are not getting executed:
below is my step : And also I tried many combination of steps but same reult
Feature: Logging into Salesforce

In order to work
As a sales person
I want to login

@login
Scenario Outline: Logging in salesforce
#Given Runmode is "Y"
#Given I go to "http://qtpselenium.com/login/selectlogin.php" on "mozilla"
Then All tabs on menu should be present
#And I enter "loginusername" as "<Username>"
#And I enter "loginpassword" as "<Password>"
#And I click on "loginButton"
#Then Login should be "<Expected_Result>"

#Examples:
#|Runmode |Browser | Username | Password | Expected_Result |
#| N | Mozilla | xxxxx | zxxxx | failure |
#| n | Mozilla | loadrunner.jmeter@gmail.com | pass@1234 | success |
#| N | Chrome | xxxxx | zxxxx | failure |
#| Y | Mozilla |loadrunner.jmeter@gmail.com | pass@1234 | success |


M
Replied on 20/10/2015

could give me the error you are getting?


M
Replied on 21/10/2015

I am not getting any error, but steps are not getting executed.
In console it is printing :
"Feature: Logging into Salesforce
In order to work
As a sales person
I want to login
@login
Scenario Outline: Logging in salesforce # com/qtpselenium/app/salesforce/login/login.feature:8"

Note: above words are mentioned in feature file before steps. Steps never executed


M
Replied on 22/10/2015

have you made cucumber tests in java?


M
Replied on 23/10/2015

yes I did, And also I tried to run the project salesforce, the one which is there in tutorial, but same result.


M
Replied on 25/10/2015

any help. I am not able to run feature file because of this.


M
Replied on 26/10/2015

can you paste full stack trace exceptions here.


M
Replied on 26/10/2015

I am not getting any exception. When I run feature file it runs, statment from feature file gets printed but steps not executed.
Attached test steps java and runner java file. Feature file: pasting the statment which print in eclipse console:
Feature: Logging into Salesforce

In order to work
As a sales person
I want to login

@login
Scenario Outline: Logging in salesforce # com/qtpselenium/app/salesforce/login/login.feature:8
#Given Runmode is "Y"
Given I go to "http://qtpselenium.com/login/selectlogin.php" on "mozilla"
Then All tabs on menu should be present

0 Scenarios
0 Steps
0m0.000s


M
Replied on 26/10/2015

pasting feature file here:
Feature: Logging into Salesforce

In order to work
As a sales person
I want to login

@login
Scenario Outline: Logging in salesforce
#Given Runmode is "Y"
Given I go to "http://qtpselenium.com/login/selectlogin.php" on "mozilla"
Then All tabs on menu should be present
#And I enter "loginusername" as "<Username>"
#And I enter "loginpassword" as "<Password>"
#And I click on "loginButton"
#Then Login should be "<Expected_Result>"

#Examples:
#|Runmode |Browser | Username | Password | Expected_Result |
#| N | Mozilla | xxxxx | zxxxx | failure |
#| n | Mozilla | loadrunner.jmeter@gmail.com | pass@1234 | success |
#| N | Chrome | xxxxx | zxxxx | failure |
#| Y | Mozilla |loadrunner.jmeter@gmail.com | pass@1234 | success |


M
Replied on 27/10/2015

if you're not getting any exception the zip and upload the project.


M
Replied on 27/10/2015

attaching the project


M
Replied on 29/10/2015

so, firstly
update your jar files.