Git Product home page Git Product logo

common's Introduction

#StandWithUkraine

Cucumber Common Components

Cucumber is made up of several libraries, many of which are kept in polyglot repositories, meaning we keep multiple language implementations of the same library together in the same repo.

Library Description Latest release
cucumber-expressions Pattern-matching for Gherkin steps Latest release
tag-expressions For parsing tag selection queries Latest release
gherkin Parser for Gherkin feature files Latest release
messages JSON message protocol Latest release
query Query API for messages Latest release
gherkin-utils API for querying parsed Gherkin documents Latest release

If you're not sure which repository your issue belongs under, or it cuts across multiple repos, raise it in this repo.

common's People

Contributors

aslakhellesoy avatar aurelien-reeves avatar brasmusson avatar cbliard avatar charlierudolph avatar ciaranmcnulty avatar cukebot avatar davidjgoss avatar ehuelsmann avatar gasparnagy avatar jenisys avatar l3pp4rd avatar link89 avatar lsuski avatar luke-hill avatar mattwynne avatar mlvandijk avatar mpkorstanje avatar mvz avatar mxygem avatar nhojpatrick avatar olleolleolle avatar renovate-bot avatar renovate[bot] avatar sergioforerogomez avatar siwood avatar tooky avatar tsundberg avatar vincent-psarga avatar wannesfransen1994 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

common's Issues

Cucumber does not go to AfterStep if the step is failed!

I'm using Cucumber 2.3.3
I want to print some log after each step so I have my code like this:

AfterStep do
  print_log_for_step(@current_step)
end

But in case the step is failed, it never goes to AfterStep, it move to After scenario so I cannot print log of the failed step.
Right now I have to work around in this case.

Anybody has same problem to me?

Better error when both DataTable and DocString supplied (was: Arity mismatch discrepancy)

Using version 1.2.4 JVM in junit with either java/scala

Consider this piece of Gherkin.

 When  I POST a request to /some/url with:
      | header        | value            |
      | SomeHeader    | value            |
      | AnotherHeader | value2           |
      | Content-Type  | application/json |
    """
    {
       "member": "value",
       "member": "value2"
    }
    """

And this step method in scala (the same thing happens in java)

  When(s"^I POST a request to ([^ ]*) with:") { (url: String, body: String, headers: DataTable) =>
      println( headers )
      println( url )
      println( body )
  }

the error is:


cucumber.runtime.CucumberException: Arity mismatch: Step Definition 'Quote.scala:13' with pattern [^I POST a request to ([^ ]*) with:] is declared with 3 parameters. However, the gherkin step has 3 arguments [/v4/quote/create, DocString:{
   "till": "GB:a_store_id:a_till_id",
   "currency": "GBP"
}, Table:[[header, value], [TraceId, a_trace_id], [ClientId, a_client_id:a_secret], [Authorization, Bearer:temporary_token], [Content-Type, application/json]]]. 
Step: When I POST a request to /v4/quote/create with:
    at cucumber.runtime.StepDefinitionMatch.arityMismatch(StepDefinitionMatch.java:102)
    at cucumber.runtime.StepDefinitionMatch.transformedArgs(StepDefinitionMatch.java:60)
    at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
    at cucumber.runtime.Runtime.runStep(Runtime.java:299)
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
    at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)

Two issues arise

  1. is this valid gherkin ?
  2. the error message obviously is incorrect saying all three parameters are there and it requires 3 parameters ?

Looking at the code it seems to be either of these two lines:

  1. in release 1.2.4 lines 53-57 StepDefinitionMatch.java arityMismatch()
       if (step.getRows() != null) {
            argumentCount++;
        } else if (step.getDocString() != null) {
            argumentCount++;
        }

if the gherkin is correct then this should be a if and then another if not if/else. The parameters might need fixing later on to get the correct items in place.

  1. or 114-116 Ste[DefinitionMatch.java arityMismatch. This should be the same as in 1) i.e. either if/else or if if. Ideally this should use exactly the same code to avoid this bug in the future.

An easier way to use a different langauge

Say I need to use Japanese as the primary language for my feature files. Do I need to actually put

# language: ja

at top of each file? That's not really smart to do to be honest.

Can't find a cli option that specifies a spoken language when running tests, and the reference doesn't say anything about this.

A centralized `features/` for each Cucumber implementation?

( This is just a spur-of-the-moment thought I had. Request For Comments! ;) )


I like how cucumber/gherkin3 is organized: each implementation has its own repository, but the parent repository is where all the collaboration happens. This allows for some flexibility between the different Gherkin 3 implementations, but uses the centralization of the parent repository to prevent any significant divergence (including some that were proposed by me :P).

I think it also promotes cross-pollination between people who arrive from different implementations. When a user asks “Why X?” or “Why not Y?”, it’s easy to say “Because of the big picture Z”. (It’s much easier than saying “Go see «other repository»/«other issue»”. And from the user side of the fence, it also “feels” easier to receive this answer and see an issue from the _same) repository; the other implementations are right there in the parent repository, too, which is also nice.)


And now, the questions!

  • (parent project) Would it be beneficial to organize the Cucumber projects similarly?
  • (each implementation) What about a separate “cucumber-tests” project?

    I imagine something like the following:
    • This cucumber-tests project would contain features, but no step definitions
    • Each cucumber implementation would supply its own step definitions, and get tested against the features in cucumber-tests
    • Each implementation could (optionally) go further and provide its own features for the truly implementation-specific behaviors

I was browsing some of the features for the different cucumber implementations (in response to your good feedback on #8) when this occurred to me.

What do you think?

invalid option: --profile when running with Bundler (cucumber for ruby)

I just recently started running into an issue with the Rake tasks. It seems that the options that I'm trying to pass to cucumber are getting skipped and passed to the ruby as another command (or something) which leads to:

.rbenv/versions/2.3.0/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
0 scenarios
0 steps
0m0.000s

invalid option: --profile

For this test run, I've added --name nomatch so it actually doesn't try to run any scenarios (just to highlight the issue).

I dug into the source a bit and it seems like in here:

https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/rake/task.rb#L81

where the cmd is built, in the use bundler path, it builds a shell command like

.rbenv/versions/2.3.0/bin/ruby -S bundle exec cucumber --profile default

and (at least on my mac) the --profile argument appears to apply to the ruby command (not cucumber). I'm not sure where the quoting should go and will try to take a closer look. But if there is a known solution/workaround here, please let me know. I'm on cucumber (2.3.2)

Thanks

Improve title of World configuration page

The wiki page titled "A Whole New World" is poorly named; the page describes how to configure the execution context of Cucumber scenarios but the title suggests it is introducing the "what and why" of Cucumber. It took me two hours of searching to find that page. I suggest renaming it to something like "Configuring the scenario execution context (World)"

Proposal: remove pending steps

I don't see any real difference between pending steps and undefined steps. For both, the step hasn't been implemented.

Problem with cyrillic symbol И

  1. I have feature
  2. set up # encoding: utf-8 (and encoding of feature file is utf-8)
  3. I run my step with parameter "some string with И symbol"
  4. but when step code runs, it gets currupted parameter value inside.

some string with �? symbol

  1. let's test all cyrillic letters on keyboard:

йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМ�?ТЬБЮ,

  1. As you can see, the problem appears only on И symbol and only in uppercase.

Seems like a bug...

ruby -v
ruby 2.0.0p643 (2015-02-25) [i386-mingw32]

cucumber --version
2.0.2

64bit operating system, windows 7

Being Able to Continue Next Steps on @Then Failures

Summary

Add the possibility to being able to mark some "Then" step-definitions so that when they fail, they still mark the result as failed, but continue executing the next steps of the scenario.

Current Behavior

Sometimes, you have such Cucumber scenario:

When I do some extensive computation like loading a heavy web page
Then I check thing 1
And I check thing 2
And I check thing 3
And So on

In this particular situation:

  • all four "Then" have no impact on the rest of the execution of the scenario
  • they are all independent
  • if "I check thing 1" fails, the other 3 "Then"s are in a Schrödinger state: they may be OK, or they may fail, but we will know for sure only after we fix and re-execute the failed step, possibly many times if there are many errors, until all is fine. These retry/fix rountrips can be costly if the number of scenarios and steps are big and if execution is slow, like when testing a heavy website (a pretty common use case of Cucumber).

Expected Behavior

The step-definitions developer should be able to tell that one particular step is an assertion that have no impact on the following steps of the scenario it's used in.
He/she could then add an annotation on that step-definition to allow Cucumber to continue the next steps executions if that one fails.

See the discussion on Google Groups.

Possible Solution

I've made this Cucumber fork for our own needs:
github.com/slaout/cucumber-jvm

Please read the README.md for an explanation and our return of experience on this subject.

It's only working on the Java backend.

See the discussion on Google Groups for people proposing to port it to Ruby, for instance.

Please tell me if the fork is a good starting point for you and you would like me to transform this fork into a Pull Request.

[cucumber-expressions] Node 4 support

cucumber-expressions is written in ES6 which isn't as supported in earlier versions of node. I'm fine dropping support for node 0.10 and node 0.12 whose long term support ends at the end of October and December of this year, but definitely want to continue supporting node 4.

Hitting the following on travis CI for node 4:

/home/travis/build/cucumber/cucumber-js/node_modules/cucumber-expressions/lib/cucumber_expression.js:3
class CucumberExpression {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I hope we just need to add 'use strict'; to the top of the files and that's it. I'll try that out

results circles are not displaying after upgrading the jenkins to 1.652 version

Hi

We have "Cucumber Reports Plugin" version 0.0.23 (pretty old) , and we upgraded our jenkins to 1.652 , after upgrading we are seeing that the cucumber results are not displaying the circle form,
It is saying that "This content requires JavaScript."
Due to some reasons Our QA team is not ready to upgrade the Cucumber Reports Plugin.

Can you please suggest how to fix this issue ??

screen shot attached

Thanks in Advance
Manjunath
cucumber_plugin_issue

rework summary formatter output

@aslakhellesoy @jbpros @mattwynne

This is a rework of the progress formatter output that I am thinking about for cucumber-js and wanted to bring up to the whole cucumber community. Please tag anyone else you think should see this

Given a feature:

Feature: A feature

  Scenario: 1
    Given a passing step

  Scenario: 2
    Given a passing step
    And a failing step
    And a skipped step

  Scenario: 3
    Given a passing step
    And a ambiguous step
    And a skipped step

  Scenario: 4
    Given a passing step
    And a undefined step
    And a skipped step

  Scenario: 5
    Given a passing step
    And a pending step
    And a skipped step

The current progress formatter output is

..F-.A-.U-.P-

(::) failed steps (::)

Error: error
    at World.<anonymous> (/.../features/step_definitions/steps.js:5:11)

Failing scenarios:
features/a.feature:6 # Scenario: 2

5 scenarios (1 failed, 1 undefined, 1 ambiguous, 1 pending, 1 passed)
13 steps (1 failed, 1 undefined, 1 ambiguous, 1 pending, 4 skipped, 5 passed)
0m00.003s

You can implement step definitions for undefined steps with these snippets:

this.Given(/^a undefined step$/, function (callback) {
  // Write code here that turns the phrase above into concrete actions
  callback.pending();
});


The following steps have multiple matching definitions:

"a ambiguous step" matches:
/^an? ambiguous step$/ # features/step_definitions/steps.js:8
/^a ambiguous step$/   # features/step_definitions/steps.js:9

The fact that failed steps only lists the errors without the context (the scenario and step) has always bugged me and almost always made me rerun with pretty formatter the failing test in order to understand the context. I also dislike the that the different issues are shown in different places.

I propose the following new output

..F-.A-.U-.P-

Issues:

1) Scenario: 2 # features/a.feature:6
  Given a failing step # features/step_definitions/steps.js:4
    Error: error
      at World.<anonymous> (/.../features/step_definitions/steps.js:5:11)


2) Scenario: 3 # features/a.feature:11
  Given a ambiguous step
    Multiple step definitions match:
      /^an? ambiguous step$/ # features/step_definitions/steps.js:8
      /^a ambiguous step$/   # features/step_definitions/steps.js:9

3) Scenario: 4 # features/a.feature:16
  Given a undefined step
    Use the following snippet to implement this step
      this.Given(/a undefined step/, function(){
        // Write code to here to turn the step into concrete actions
        callback.pending();
      })

4) Scenario: 5 # features/a.feature:21
  Given a pending step # features/step_definitions/steps.js:11
    Pending

5 scenarios (1 failed, 1 undefined, 1 ambiguous, 1 pending, 1 passed)
13 steps (1 failed, 1 undefined, 1 ambiguous, 1 pending, 4 skipped, 5 passed)
0m00.003s

Thoughts?

Cucumber_AccessIssue_parameterised_featureFile

Summary

Feature: Contact Us Page
As an end user
I want a contact us page
So that I can find out more about QAWorks exciting services!!

Scenario: Valid Submission
Given I am on the "QAWorks" on "Chrome"
When I click on "Contacttab"
And I enter "" with "namelocate"
And I enter "" with "emailocate"
And I enter "" with "messagelocate"
And I click on the "SendButton"
Then I should be able to contact QAWorks with the following information
| name | email | message |
|j.Bloggs | [email protected] | please contact me I want to find out more |

Expected Behavior

1)It should open contact us page
2)It should able to send name,email,message to the text box
3)Click on send button and the data should get sent to qaworks.

Bug:
It is not able to send the data to name,email,message field.Instead of capturing data it is sending it as in the text box.

Function written for the featurefile
The following funtion doesnot work.
@and("^I enter "([a-zA-Z]{1,})" with "([^\"]*)"$")
public void I_enter_name(String text,String object){
system.out.println("I Click On "+ object);
selenium.type(text, object);
}

Locators for name,email,message respectively):

namelocate=//input[@id='ctl00_MainContent_NameBox']
emailocate=//input[@id='ctl00_MainContent_EmailBox']
messagelocate= //*[@id='ctl00_MainContent_MessageBox']

Utility functions:
locator has passed to objectname
,, has sent to Text in the following function.

public void type(String Text, String objectName)
{
driver.findElement(By.xpath(OR.getProperty(objectName))).sendKeys(Text);

    }

Possible solution:
change the regular expression to accept the paratemeter in step definition.

Gherkin Wiki issue: "matched to a Ruby code block called Step Definitions"

I'm new to Cucumber, so pardon me if this is a stupid question.

At https://github.com/cucumber/cucumber/wiki/Gherkin#gherkin-syntax, I see

When you run the feature the trailing portion (after the keyword) of each step is matched to a Ruby code block called Step Definitions.

I'm trying to understand this better. This is my first exposure to Gherkin, from the link at https://github.com/cucumber/cucumber-js#features.

  1. Must the code block be Ruby? I arrived here from the JS port.
  2. Where is that code located?
  3. Should "Step Definitions" be "Step Definition" in that quote?

[cucumber-expressions] generated expressions - expose argument names

When generating step snippets, I would like the generated expression to expose the argument names, so the function arguments in the snippet use the same name.

Current test

it("documents expression generation", () => {
    const transformLookup = new TransformLookup()
    /// [generate-expression]
    const generator = new CucumberExpressionGenerator(transformLookup)
    const undefinedStepText = "I have 2 cucumbers and 1.5 tomato"
    const generatedExpression = generator.generateExpression(undefinedStepText, true)
    assert.equal(generatedExpression.source, "I have {arg1:int} cucumbers and {arg2:float} tomato")
    assert.equal(generatedExpression.transforms[1].typeName, 'float')
    /// [generate-expression]
  })

Proposed addition to the test

assert.deepEqual(generatedExpression.argumentNames, ['arg1', 'arg2'])

step transformations

Hello, right now I see that cucumber does:

  1. step regular expression matching
  2. step transformation

I am trying to understand why that has been chosen. To me it makes more sense to do it the other way around. i.e. first transform and then match the steps.

In our test suite we decided to make <%= ... %> expressions expand to some ruby expression inside. Issue is that if step for example matches \w+ then using such expression in place doesn't work. It is not such a big deal as quotes can be used for parameters. Just a little harder to write the quotes.

But I thought to propose making transformation happen before matching unless there are good reasons to keep current approach.

Thank you.

Parallel Threaded Execution of Scenarios

Summary

Cucumber does not offer a parallelization option out of the box.

I'd like to get a Runtime option like "--threads 4".
The option will put all scenarios of all .features files in a queue.
As soon as a thread is idle, the thread will pick a scenario from the queue and execute it.

I'd also like to have a tagging mechanism to forbid some scenarios to run in parallel if they are prone to interfere with each other.

Current Behavior

Maven plugins or other external components tend to offer hacky ways to implement some sort of parallelism.
They almost all span multiple Cucumber processes, each one running a different .feature file, and then they run a process that merges all the JSON reports into one big report.json.

I'm not happy with this situation because I (anybody can) have .feature files that vary in number, length, and duration of scenarios (depending on varying things like network load required by each scenario).
This results in having one thread taking very long to execute a bigger .feature file while other threads have finished executing all other small .feature files.

Expected Behavior

Given the current behavior, I'd like the parallelism to be smarter, to be optimal about execution time, and a better thread occupation efficiency.

Possible Solution

For our project, I've made a quick fork of Cucumber with this feature, and we use it with success:
https://github.com/slaout/cucumber-jvm/tree/parallel-scenarios-execution-1.2.4

It has the following additions:

  • --threads parameter to tell Cucumber how much executor threads must be spanned
  • At the begin of the execution, all .feature files are scanned and all scenarios are put in a queue
  • Each thread picks a scenario to execute from the queue, and as soon as it finished, it picks another scenario from the queue
  • Some scenario needs to be synchronized:
    • For instance, say two scenarios begin with setting the online stock of a product before testing it: they must be executed sequentially for no interference
    • Say two other scenarios are modifying the in-store stock of a product before testing it: the two of them must also be executed sequentially BUT they can perfectly be executed in parallel with the first two scenarios that modify the online stock
    • To get that behavior, all four scenarios are tagged with a tag starting with "@synchronized-". In this case, we will tag the two first scenarios with @synchronized-online-stock and the two others are tagged with @synchronized-store-stock
    • Cucumber will group all scenarios with the same @synchronized- tag name in one "execution group" and will place them first in the queue, because they contain several not-parallelizable scenarios, so executing them first is more efficient if one group is quite large (imagine this large group being at the bottom of the queue: we would end up with the poor parallelization efficiency discussed in "Current Behavior" with other threads having finished their job and being idle)
  • Not implemented, but we could imagine the order of scenarios in the queue could be randomized, so if there are potential concurrency problems, they get spotted quicker, and developers can either fix the scenarios (and ensure scenarios are independent from each other, not just working by luck of current schedule) or add "@synchronized-" tags to concurrent scenarios.
  • Not implemented too, but some heuristics could put scenarios with a lot of steps at the start of the queue, as they could be longer to execute, which could lead to poorer threading efficiency (but as the gain could be marginal, it could as well not be implemented, it's just an idea)

The fork is launching multiple theads: each scenario has its own Formatter and Reporter: executing a scenario will "print" to those formater and reporter: hey will just record method calls in memory.
At the end, I list all scenarios in the order they are declarer and I tell the formater and reporter of these scenarios to replay what they memorized into the "real" formatter and reporter to construct the report.json exactly the same as it would have been created without parallelism.
To not change the code too much, I heavily added ThreadLocal variables and a few synchronized blocks where needed.
A proper refactor of all the code base will be needed for it to be cleaner, but I read somewhere you were already planning to do so for the next major version of Cucumber.

It's developed mainly for the Java backend, but I think it would need basic adjustments to expose the new threads option to other languages.
It's done for the CLI runner.
It should work for the JUnit runner too, but because all reports are stored in memory and merged at the very end, the JUnit view of the IDE will not move in real time, and it will change all at once at the end.

Note: this fork also contains the @ContinueNextStepsFor({Throwable.class}) evolution seen on issue #79.
Because our project needs both parallel execution and continuing execution on Then step failures.

You can see the changes introduced by the fork with this comparison:
slaout/cucumber-jvm@continue-next-steps-for-exceptions-1.2.4...slaout:parallel-scenarios-execution-1.2.4
Mainly:

  • ThreadLocals
  • synchronized blocks
  • added PlaybackFormatter (implements Reporter, Formatter): records all events of the current thread and is able to play them back to another instance that will merge the reports of all scenario executions in the expected order
  • added ProxyFormatter (implements Reporter, Formatter): just for debug purpose: will be removed
  • ScenarioExecutionRunnable.java
  • ThreadedRuntime.java

Alternative to Regular Expressions

Regular expressions in step definitions should always be part of Cucumber, but we should provide a simpler alternative for those who wish. Good Gherkin shouldn't require the complexities of RegExp anyway - if it does it's usually a sign the Gherkin is too complicated.

There are already several alternative pattern syntaxes out there, which has been discussed in this thread.

There are also some interesting alternatives on this c2 page and this HN thread.

Some things to consider:

  • Cucumber should be able to print snippets in the new expression syntax
  • A spec and common test suite for different implementations
  • The various language implementations should live in separate repos
  • It should compile down to RegExp (probably)

Completion

The new syntax must be implemented on the following platforms before we can close this issue

  • cucumber-ruby
  • cucumber-jvm
  • cucumber-js
  • specflow

Official Python implementation?

On PyPI (Python’s package index), there are some packages that mention Cucumber or Gherkin, but they all seem to be…

  • …out of date
  • …make no use of the official Gherkin parser for Python
  • …a “clone” or “inspired by” spin-off of the Cucumber project (“NIH” strikes again! Grr…)

Is there no official Python implementation of Cucumber?

If not, I’d like to take a crack at writing one. I’m not a brilliant programmer, but I think I could write a working implementation that uses the JSON output from the existing Python implementation of cucumber/gherkin3.

If I do,

  • Would you be willing to adopt it as an official implementation?
  • Are there any requirements for the implementation? (E.g, “The package should be structured into these separate modules”, or “It must follow these coding standards”, etc.)

Scenario outline with examples in title

Regarding this: cucumber/cucumber-js#267

Do we have anything similar in cucumber?

marcfallows commented on Oct 23, 2014
Hello,

I would expect to be able to have my scenario outline title have more information by using the examples >within the title itself:

Scenario Outline: A <some> step is <result>
   When a <some> step
   Then I get <result>
Examples:
   | some    | result  |
   | passing | passed  |
   | failing | skipped |

Then my scenario titles end up very useful:
Scenario: A passing step is passed Scenario: A failing step is skipped

This doesn't seem to be working for me. Is this a supported feature? If not, is it something that I could >assist in having included? Or, is it not expected to work like this?

If not, it would be very useful to have something like this. It would increase the readability of reports with alot of example data.

Output two cucumber format at same time

Is that possible I output the cucumber pretty and json format at the same time by only running the test feature once? Or is that a way I can output the pretty format (e.g. to terminal) and then transfer it to json format?

Obtaining gherkin from AfterScenario or AfterStep

In Cucumber 1, I was able to obtain the gherkin of a scenario in the After block with something like this:

After do |scenario|
  scenario.steps.map(&:to_sexp).map{|a| a[-2..-1].join}
  ...
end

this was used to make annotated gifs of each test, step by step.

In Cucumber 2, I'm not observing that you can get the steps from a scenario. I ran across a mailing list thread addressing a related issue about getting the result from a scenario.

Could either the scenario in the After block, or the step in the AfterStep block, be updated to provide the gherkin in Cucumber 2?

test failure

Hi there,

I'm trying to get a cucumber package together for GNU Guix. Running the tests which come as part of the 2.4.0 gem after gem unpack gave one failure. Is this expected?

ben@u /tmp/cu/cucumber/psb1blr29rlnsbac8qw7i14lrpq9fyb9-cucumber-2.4.0 [env]# rake spec
fatal: Not a git repository (or any parent up to mount point /tmp/cu/cucumber/psb1blr29rlnsbac8qw7i14lrpq9fyb9-cucumber-2.4.0)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /tmp/cu/cucumber/psb1blr29rlnsbac8qw7i14lrpq9fyb9-cucumber-2.4.0)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /tmp/cu/cucumber/psb1blr29rlnsbac8qw7i14lrpq9fyb9-cucumber-2.4.0)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
/gnu/store/dlagr9ndsgip487j446m8a9hlpd1hbiq-ruby-2.3.1/bin/ruby -I/gnu/store/xg7i10rh7la1xszbr0dx7cgdns78i6c7-profile/lib/ruby/gems/2.3.0/gems/rspec-support-3.5.0/lib:/gnu/store/xg7i10rh7la1xszbr0dx7cgdns78i6c7-profile/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib /gnu/store/xg7i10rh7la1xszbr0dx7cgdns78i6c7-profile/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
/gnu/store/xg7i10rh7la1xszbr0dx7cgdns78i6c7-profile/lib/ruby/gems/2.3.0/gems/gherkin3-3.1.1/lib/gherkin3/dialect.rb:4: warning: already initialized constant Gherkin3::DIALECT_FILE_PATH
/gnu/store/h5077m4liqsnb8h97pm2mcw208z8jqrq-ruby-gherkin3-3.1.1/lib/ruby/gems/2.3.0/gems/gherkin3-3.1.1/lib/gherkin3/dialect.rb:4: warning: previous definition of DIALECT_FILE_PATH was here
/gnu/store/xg7i10rh7la1xszbr0dx7cgdns78i6c7-profile/lib/ruby/gems/2.3.0/gems/gherkin3-3.1.1/lib/gherkin3/dialect.rb:5: warning: already initialized constant Gherkin3::DIALECTS
/gnu/store/h5077m4liqsnb8h97pm2mcw208z8jqrq-ruby-gherkin3-3.1.1/lib/ruby/gems/2.3.0/gems/gherkin3-3.1.1/lib/gherkin3/dialect.rb:5: warning: previous definition of DIALECTS was here
................................................................................................................................................................................................F.................................................................................................................................................................................................................................................................................................................................................................................................

Failures:

  1) Cucumber::Formatter::Html when writing the report to a file with a step that embeds a snapshot converts the snapshot path to a relative path
     Failure/Error: expect(@out).to receive(:respond_to?).with(:path).and_return(true)

       (#<StringIO:0x005572e56e9d00>).respond_to?(:path)
           expected: 1 time with arguments: (:path)
           received: 3 times with arguments: (:path)
     # ./spec/cucumber/formatter/html_spec.rb:35:in `block (3 levels) in <module:Formatter>'

Finished in 1.59 seconds (files took 0.55264 seconds to load)
578 examples, 1 failure

Your Environment

I'm in a Guix environment with Ruby 2.3.1p112.

ben@u /tmp/cu/cucumber/psb1blr29rlnsbac8qw7i14lrpq9fyb9-cucumber-2.4.0 [env]# gem list 

*** LOCAL GEMS ***

aruba (0.14.1)
bigdecimal (1.2.8)
builder (3.2.2)
bundler (1.12.5)
childprocess (0.5.8)
coderay (1.1.0)
contracts (0.12.0)
cucumber (2.4.0)
cucumber-core (1.5.0)
cucumber-wire (0.0.1)
did_you_mean (1.0.0)
diff-lcs (1.2.5)
event-bus (0.2.1)
ffi (1.9.14)
gherkin (4.0.0)
gherkin3 (3.1.1)
io-console (0.4.5)
json (1.8.3)
method_source (0.8.2)
mini_portile2 (2.1.0)
minitest (5.8.3)
multi_json (1.11.2)
multi_test (0.1.2)
net-telnet (0.1.1)
nokogiri (1.6.8)
pkg-config (1.1.7)
power_assert (0.2.6)
pry (0.10.1)
psych (2.0.17)
rake (10.4.2)
rdoc (4.2.1)
rspec (3.5.0)
rspec-core (3.5.1)
rspec-expectations (3.5.0)
rspec-mocks (3.5.0)
rspec-support (3.5.0)
slop (3.6.0)
test-unit (3.1.5)
thor (0.19.1)

I do not have the git checkout of v1.x-bugfix branch of http://github.com/cucumber/cucumber-ruby-core.git as specified in the Gemfile, but it doesn't seem on first glance to be related to the bug cucumber/cucumber-ruby-core#109

Thanks in advance. ben.

Dagger support?

Is it possible to add dagger support to cucumber framework?

cucumber trapping SIGINT behavior

Hello, I observe the following behavior.
= regular cucumber vs SIGINT

  • test is running
  • hit ctrl+c
  • test continue to be running and program exits only after it completes fully
  • hit ctrl+c again
  • cucumber exits without any clean-up taking place

= cucumber with Signal.trap('SIGINT') { exit(false) }

  • test running
  • hit ctrl+c
  • test terminates and cucumber switches to After hook

I think that the latter behavior makes much more sense. If user wants to interrupt, then ideally that will happen as soon as possible while After hook is executed to clean-up any underlying test environment. This is current behavior for SIGTERM.

So I was wondering what was the idea behind default SIGINT trap behavior. Why not keep same as SIGTERM? Not a big issue for me as I have a workaround. But would be nice to make behavior more convenient OOB for other users.

btw very nice cucumber takes care to run After hook on SIGTERM. I made some effort to put clean-up in at_exit when After is skipped but it seems After is never skipped. Or was the idea to have single Ctrl+C terminate after scenario finish, second Ctrl+C to drop into After hook? In such case it is not working like that.

Feature Request: Undefined step, leading to suggested alternative(s) from current glue

Summary

Wouldn't it be nice if Cucumber could suggest step definitions from the current project's glue that are similar to the undefined step that is currently being matched.

Possible Solution

There are fuzzy regex matching libraries available e.g. http://laurikari.net/tre/

Context & Motivation

When a step fails to match an undefined error is thrown and a snippet emitted. Often the failure is due to simple mistyping by the user. It would be nice if Cucumber could suggest step definitions that almost matched.

This could make it much simpler to pick up many categories of error, such as missing spaces and/or misspelt words

Test suite for events

At #cukenhagen @mattwynne suggested we write a test suite that will validate that a cucumber emits the expected events when executing features.

how to organize and execute a large number of features

My application has many modules. So I want to orgnize my features by module in subdirectory. But, there is a problem has been harassing me:
how to execute the featues in my prefered order? Should I rename my features file in order? However, mayber I just want to execute some modules' features. I may have many different prefered order.
Maybe, someone suggests to execute featutre like this:
"cucumber -r features 1.feature 2.feature..."
That's good if my features are not too many. When I have a large number features to execute, it's to inconvenient. Anybody has better suggestion?

Support for SpringBootTest annotation when bootstrapping a Spring container

Summary

In Spring Boot the recommended way to fire up a test container to run your tests against isn't the @ContextConfiguration annotation but the @SpringBootTest annotation. The Cucumber Spring support doesn't currently check for this annotation so you have to add @ContextConfiguration as well as @SpringBootTest in order for Cucumber to initiate the bootstrapping of the Spring container.

See issue on Stack Overflow

Expected Behavior

When running cucumber tests against a Spring app, the @SpringBootTest annotation should be sufficient on a Spring test container class in order to bootstrap the container.

Current Behavior

Container only boostraps if you also add @ContextConfiguration in addition to @SpringBootTest

Possible Solution

Change cucumber.runtime.java.spring.SpringFactory method annotatedWithSupportedSpringRootTestAnnotations to check for SpringBootTest annotation as well as others. NB this annotation not necessarily be in the classpath if you aren't using Spring Boot

Steps to Reproduce (for bugs)

  1. Write a basic Spring Boot app (use http://start.spring.io/ to generate a simple one)
  2. Write a class with an empty cucumber @before annotated method, with the class annotated with @SpringBootTest
  3. Run the cucumber suite. The presence of the @before method should boot the Spring container. It doesn't

Context & Motivation

Simplification of test code, using the recommended Spring Boot way of bootstrapping a test container.

Your Environment

  • Version used: 1.2.5 (Spring Boot 1.4.1)
  • Operating System and version: Windows 7
  • Link to your project: N/A

Cucumber Specification

We need a spec.

It's been talked about a lot among different people at different times. The spec should contain:

  • A specification in prose
    • With architecture diagrams
    • Explain why we need a spec
  • Tests
    • That can be run agains multiple implementations
  • A couple of reference implementations

Inspiration:

Gherkin Lint - New project?

A recent discussion in the cucumber/gherkin gitter room revealed that there are (at least) 3 Cucumber linters out there:

The projects are similar, and I think there are some great unique things in each one of them.

What do you think about joining forces to create a single one to rule them all? Ideally in JavaScript since it's easier to use on the web, and also relatively easy to embed into other libraries as well as editors and IDEs.

If you're interested, just reply here and fill out this doodle for a google hangout kickoff meeting.

/cc @enkessler @allustin @vsiakka @r-cochran

Multi-parameter transforms

Summary

Consider this step:

Given I fly the route between LHR and CDG

I want a Route value object that's composed of those two. I can see how I fly the route between {origin:airport} and {destination:airport} would work, but I want my step to receive a Route VO composed of two Airport VOs

Possible Solution

(Example in Ruby):

@transform_lookup.add_transform(Transform.new(
  'route',
  Route,
  '([A-Z]{3}).*([A-Z]{3})',
  lambda { |from, to| Route.new(Airport.new(from), Airport.new(to)) }
))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.