Not able to find feature file | Maven | Cucumber

1,373 views
Skip to first unread message

jagmoha...@gmail.com

unread,
May 10, 2013, 3:25:58 AM5/10/13
to cu...@googlegroups.com

Hi,

I am relatively new to Cucumber ...just trying to execute basic cucumber tests..have created the feature file at correct path and using following command in dos

mvn clean test

but am getting error

Tests in error:
  initializationError(fundtransfer.test.RunCukesTest): No features found at [cla
sspath:fundtransfer/test]

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0


RunCukesTest.java

package fundtransfer.test;
import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber-htmlreport",
"json-pretty:target/cucumber-report.json"})
public class RunCukesTest {
}



Complete Stack Trace:


C:\Users\jbhano\workspace\FundTransfer>mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FundTransfer 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ FundTransfer ---
[INFO] Deleting C:\Users\jbhano\workspace\FundTransfer\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ FundTrans
er ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ FundTransfer
---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ F
ndTransfer ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Fund
ransfer ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e.
uild is platform dependent!
[INFO] Compiling 2 source files to C:\Users\jbhano\workspace\FundTransfer\targe
\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ FundTransfer ---
[INFO] Surefire report directory: C:\Users\jbhano\workspace\FundTransfer\target
surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running fundtransfer.test.RunCukesTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.493 sec <<< F
ILURE!

Results :

Tests in error:
  initializationError(fundtransfer.test.RunCukesTest): No features found at [cl
sspath:fundtransfer/test]

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.589s
[INFO] Finished at: Fri May 10 12:53:51 IST 2013
[INFO] Final Memory: 15M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2
10:test (default-test) on project FundTransfer: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\jbhano\workspace\FundTransfer\target\surefire-
eports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swi
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please re
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureEx
eption
C:\Users\jbhano\workspace\FundTransfer>


Could you kindly point me to right direction?

Thanks,
Jag

Paolo Ambrosio

unread,
May 10, 2013, 3:51:54 AM5/10/13
to cu...@googlegroups.com
On Fri, May 10, 2013 at 8:25 AM, <jagmoha...@gmail.com> wrote:

> Tests in error:
> initializationError(fundtransfer.test.RunCukesTest): No features found at
> [cla
> sspath:fundtransfer/test]
>
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
>
>
> RunCukesTest.java
>
> package fundtransfer.test;
> [...]

It might be a stupid question, but have you got any feature file
(gherkin syntax) in the src/test/resources/fundtransfer/test
directory?


Paolo

Paolo Ambrosio

unread,
May 10, 2013, 4:01:37 AM5/10/13
to cu...@googlegroups.com
On Fri, May 10, 2013 at 8:51 AM, Paolo Ambrosio <pa...@ambrosio.name> wrote:

> It might be a stupid question, [...]

Of course I meant my question, not yours! :-)


Paolo

Jagmohan Bhanot

unread,
May 10, 2013, 4:40:05 AM5/10/13
to cu...@googlegroups.com
Got it working...created same file again at same location....looks like my original file might have been corrupt.

Thanks Paolo!!

Cheers!!
Jag




Paolo

--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Cukes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cukes/FhLKjqUnyG8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Jagmohan Bhanot

unread,
May 10, 2013, 5:23:33 AM5/10/13
to cu...@googlegroups.com
Now, when I am getting following output

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ FundT
ransfer ---

[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ FundTransfer ---
[INFO] Surefire report directory: C:\Users\jbhano\workspace\FundTransfer\target\
surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running fundtransfer.test.RunCukesTest
Feature: SAP Home Page
  verifies that SAP Home Page is as expectedaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  Scenario Outline: Parameters # fundtransfer\test\fundtransfer.feature:10
    When I add 1 and 2
    Then result should be 3    # FundTransferStepDefs.checkResult(int)

  Scenario Outline: Parameters # fundtransfer\test\fundtransfer.feature:11
    When I add 3 and 4
    Then result should be 7    # FundTransferStepDefs.checkResult(int)


You can implement missing steps with the snippets below:

@When("^I add (\\d+) and (\\d+)$")
public void I_add_and(int arg1, int arg2) throws Throwable {
    // Express the Regexp above with the code you wish you had
    throw new PendingException();
}


Tests run: 6, Failures: 0, Errors: 0, Skipped: 6, Time elapsed: 1.108 sec

Results :

Tests run: 6, Failures: 0, Errors: 0, Skipped: 6

[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ FundTransfer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.272s
[INFO] Finished at: Fri May 10 14:46:14 IST 2013
[INFO] Final Memory: 11M/169M
[INFO] ------------------------------------------------------------------------

C:\Users\jbhano\workspace\FundTransfer>


Feature File

Feature: SAP Home Page
verifies that SAP Home Page is as expectedaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Scenario Outline: Parameters
When I add <a> and <b>
Then result should be <c>

Examples:
|a|b|c|
|1|2|3|
|3|4|7|




StepDef.java (src/test/java/fundtransfer.test/FundTransferStepDefs.java)

is having matching Step Definition for (When I add <a> and <b>)


@When("^I add (\\d+)$ and (\\d+)$")
public void add(int a, int b){
    c = a + b;
}




Then why it is still not able to find matching steps?

Thanks,
Jag

Jagmohan Bhanot

unread,
May 10, 2013, 6:34:24 AM5/10/13
to cu...@googlegroups.com
Getting following pending exception


-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running fundtransfer.test.RunCukesTest
Feature: SAP Home Page
  verifies that SAP Home Page is as expectedaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  @WEB
  Scenario Outline: Parameters # fundtransfer\test\fundtransfer.feature:13
    When testing               # FundTransferStepDefs.test1()
    When testing               # FundTransferStepDefs.test1()
    When I add 2 and 3         # FundTransferStepDefs.I_add_and(int,int)
      cucumber.runtime.PendingException: TODO: implement me
        at fundtransfer.test.FundTransferStepDefs.I_add_and(FundTransferStepDefs
.java:91)
        at ?.When I add 2 and 3(fundtransfer\test\fundtransfer.feature:8)

    Then result should be 5    # FundTransferStepDefs.checkResult(int)

cucumber.runtime.PendingException: TODO: implement me
        at fundtransfer.test.FundTransferStepDefs.I_add_and(FundTransferStepDefs
.java:91)
        at ?.When I add 2 and 3(fundtransfer\test\fundtransfer.feature:8)

Tests run: 4, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 1.569 sec

aslak hellesoy

unread,
May 10, 2013, 7:27:24 AM5/10/13
to Cucumber Users
Should be src/test/java/fundtransfer/test/FundTransferStepDefs.java (no dot in dir name)
 
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.

aslak hellesoy

unread,
May 10, 2013, 7:29:28 AM5/10/13
to Cucumber Users



On Fri, May 10, 2013 at 5:34 AM, Jagmohan Bhanot <jagmoha...@gmail.com> wrote:
Getting following pending exception


Read the stack trace. Open the file where the exception is thrown from. Read the comment above the line the exception is thrown from.
 
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.
Reply all
Reply to author
Forward
0 new messages