Re: [Cucumber] Looking for aggregated html report from cucumber

330 views
Skip to first unread message

aslak hellesoy

unread,
Mar 5, 2013, 2:57:42 AM3/5/13
to Cucumber Users



On Mon, Mar 4, 2013 at 9:53 PM, Senthil <senth...@gmail.com> wrote:
Hi,

 I have feature files(under src/test/resources), and step defintions(src/test/java) in respective packages.  I have 10 stepdefs and corresponding test classses.

This is the problem.

You're not supposed to have more than a single JUnit class annotated with @RunWith(Cucumber.class). It should be able to run all of your features.

Likewise, you're not really supposed to have a 1-1 mapping between feature files and step definitions. See https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)

Aslak

Options annotations contains path about glue code only, no reporting options present in code.

mvn clean test -Dcucumber.options="--format html:target/cuke-html-reports"

once all tests run, html report is created under target/cuke-html-reports. But contains the last run feature's report only. But I want report of all features that run.

The goal is to see all tests report in local running as well as publishing report in genkins while ci runs the build.

Any help is appreciated. Thanks

Regards
Senthil



--
-- 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 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/groups/opt_out.
 
 

Senthil

unread,
Mar 12, 2013, 4:35:23 PM3/12/13
to cu...@googlegroups.com
Hi Aslak,

I have changed our stepdefs, and currently running with a single junit class. Now the duplicate stepdefs is really problem.

There are steps but different stepdefs are implemented slightly different but they exist in different packages.

Say

Given that stock order is submitted
And the order is received
When the order is processed.

Another scenario
Given that bill-only order is submitted
And the order is received
When the order is processed.

For example, the step 'the order is processed' is differently implemented by different stepdefs. But described commonly as "the order is processed". This long we had different test class for different package/stepdef, and we limited glue code search to only that package.

But now we use just single test class, and glue code path is base package path, resulting duplicate step defs.

All I say is sometimes the business people describe step in general way, but as I developer I implement differently based on the case/situations etc. But because of duplicate stepdef issue, we are forced to change the step declaration to avoid dupe stepdefs like

Given the bill-only order is submitted
And the bill-only order is received
When the bill-only order is processed

Not preferring this redundant way. The solution that we are looking is, if there more than one step-defs are matching for any given step, check is there any closest match. Say a step-def is defined in same package as feature file. If so use that step-def, otherwise use a step-def defined in any parent package or so.

Seems like jBehave also doesn't handle dupe step-def in expected, or desired way. 


Appreciate your input. Thanks

Senthil

George Dinwiddie

unread,
Mar 12, 2013, 5:10:03 PM3/12/13
to cu...@googlegroups.com
Senthil,

On 3/12/13 4:35 PM, Senthil wrote:
> Hi Aslak,
>
> I have changed our stepdefs, and currently running with a single junit
> class. Now the duplicate stepdefs is really problem.
>
> There are steps but different stepdefs are implemented slightly
> different but they exist in different packages.
>
> Say
>
> Given that stock order is submitted
> And the order is received
> When the order is processed.
>
> Another scenario
> Given that bill-only order is submitted
> And the order is received
> When the order is processed.
>
> For example, the step 'the order is processed' is differently
> implemented by different stepdefs. But described commonly as "the order
> is processed". This long we had different test class for different
> package/stepdef, and we limited glue code search to only that package

Why is receiving an order different based on the type of order? What is
different about these?

- George
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

Senthil

unread,
Mar 13, 2013, 3:06:07 PM3/13/13
to cu...@googlegroups.com

Hi,

Please ignore order receiving step. For forum question purpose, i roughly typed quick. Actually order receiving step varies based on service through which user is  communicating.  But order processing varies based on the type of order.

For duplicate stepdefs case, resolving to a closest stepdef  (from same package or parent package etc), Is that make sense? I just wished that way, while I was refactoring my stepdefs. I am new to BDD & cucumber.  Thanks

Regards
Senthil

George Dinwiddie

unread,
Mar 13, 2013, 3:14:20 PM3/13/13
to cu...@googlegroups.com
Senthil,

On 3/13/13 3:06 PM, Senthil wrote:
>
> Hi,
>
> Please ignore order receiving step. For forum question purpose, i
> roughly typed quick. Actually order receiving step varies based on
> service through which user is communicating. But order processing
> varies based on the type of order.
>
> For duplicate stepdefs case, resolving to a closest stepdef (from same
> package or parent package etc), Is that make sense? I just wished that
> way, while I was refactoring my stepdefs. I am new to BDD & cucumber.

It does not, should not, and doesn't need to work that way.

I asked the question to be able to help you understand BDD & cucumber.
If that is not a good example of your problem, provide a better example
that you are willing to discuss. Then I can help you understand how to
get what you want, and why it would not be good to have it work the way
you are asking.

- George

Shaba K

unread,
Mar 26, 2014, 10:35:38 AM3/26/14
to cu...@googlegroups.com
Hi There,

I am seeing the duplicate step definitions.

am on version cucumber-java 1.1.6

I see the below exception, i did do a clean build of project.


Below exception :
--------------------------
cucumber.runtime.DuplicateStepDefinitionException: Duplicate step definitions in uk.co.ratedpeople.test.functional.selenium.tmacquisition.TMSignupStepDefs.The_user_is_on_home_page() in file:/home/shabana.khanam/dev/Selenium-Test/selenium-tests-module/target/test-classes/ and uk.co.ratedpeople.test.functional.selenium.tmacquisition.TMSignupStepDefs.The_user_is_on_home_page() in file:/home/shabana.khanam/dev/Selenium-Test/selenium-tests-module/target/test-classes/
    at cucumber.runtime.RuntimeGlue.addStepDefinition(RuntimeGlue.java:47)
    at cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:117)
    at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:68)
    at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:41)
    at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:78)
    at cucumber.runtime.Runtime.<init>(Runtime.java:88)
    at cucumber.runtime.Runtime.<init>(Runtime.java:66)
    at cucumber.runtime.Runtime.<init>(Runtime.java:62)
    at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:74)
    at cucumber.api.junit.Cucumber.<init>(Cucumber.java:61)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
    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.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:31)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54)
    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)



On Monday, March 4, 2013 9:53:50 PM UTC, Senthil wrote:
Hi,

 I have feature files(under src/test/resources), and step defintions(src/test/java) in respective packages.  I have 10 stepdefs and corresponding test classses. Options annotations contains path about glue code only, no reporting options present in code.

ashok bakthavathsalam

unread,
Sep 23, 2014, 11:59:53 PM9/23/14
to cu...@googlegroups.com
I too am new to Cucumber-Java in Eclipse. I have used a very simple feature file (calculate.feature) to generate the necessary tests and is working fine.
calculateStepdefs.java and Calculator.java have the necessary implementation code. My calculator implementation uses jexl (from apache.commons).

---- File: calculate.feature -----
Feature: Calculate
  Scenario: Add two numbers
  Given the input "2+2"
  When the calculator is run
  Then the output should be "4"
  
  Scenario: Subtract two numbers
  Given the input "9-4"
  When the calculator is run
  Then the output should be "5"
-----   
I now wish to now implement Calculator using a different design/implementation (Tokenizer) and so I defined the following feature file called tokenCalc.feature
and placed it in the same src/test/resources directory with the same contents (as calculate.feature), except a change to the Feature name.

---- File: tokCalc.feature -----
Feature: TokCalc
  Scenario: Add two numbers
  Given the input "2+2"
  When the calculator is run
  Then the output should be "4"
  
  Scenario: Subtract two numbers
  Given the input "9-4"
  When the calculator is run
  Then the output should be "5"
--------

In spite of invoking RunCukeTest.java, I don't see any new code generation for the new feature file.
What am I doing wrong now? How do I go about implementing and testing my Token-Calculator?

  % ashok
Reply all
Reply to author
Forward
0 new messages