gherkin

Using proper grammar in Gherkin

穿精又带淫゛_ 提交于 2019-12-11 07:28:31
问题 It seems to be very difficult to look up documentation about Gherkin, so I was wondering if there was a way to augment step definitions to enable the tester to use proper grammar. One example that shows what I mean is: ...Testing... Then I see there is 1 item ...More testing... Then I see there are 2 items Obviously, these two steps would use the same code. I defined a step definition like this which almost works: Then(/^I see there (is|are) (\d+) item(s)?$/) do |item_count| ...code... end

Dealing with a large string in Gherkin with Scenario Outline

走远了吗. 提交于 2019-12-11 03:32:12
问题 I'm using Behat for BDD and using Scenario Outlines so I can easily do the same test with other data. But I got a problem with large texts. See example below: Scenario Outline: create a thing When I click on "New" Then I should be at "/thing/new" When I fill in "title" with <title> When I fill in "description" with "description" When I click on "save" Then I should be at "/things" Then I should see <title> in the list When I click on <title> Then I should see <title> Then I should see

Having Tables in Example Table in SpecFlow

此生再无相见时 提交于 2019-12-11 01:21:17
问题 I am using SpecFlow with VisualStudio 2013 to test a particular web form which has the following layout ******************** Start: Form ****************** Name:________________ Age:_________________ Experience: Work place | Number of years | ___________ | _________________ | ___________ | _________________ | ___________ | _________________ | ___________ | _________________ | ******************** End: Form ****************** How do I write it so that I can feed from Example? Given ... When

Is there a “for each” or equivalent syntax for Gherkin/Cucumber?

萝らか妹 提交于 2019-12-10 20:49:35
问题 Is there any equivalent "for each" statement for Gherkin? In the following scenario, the page I am testing has multiple date fields that I'd like to run the same test examples on. Here is the scenario that I would like to model. Scenario Outline: Modify precision values for date controls Given I have just added a record When I select <precision> And I select <value> Then <date> displays in the <date type> field Examples: | date type | precision | value | date | | Date 1 | Unknown | N/A |

Updating the name of SpecFlow scenario outline variations

做~自己de王妃 提交于 2019-12-10 12:46:47
问题 I have this feature file: Scenario Outline: Example Given I am a user When I enter <x> as an amount Then the result should be <result> Examples: | x | result | | 3 | 3 | | 1 | 1 | My issue is that after it's run, each example is labeled as variant # Is there a way to name what each example line is actually testing, so that in the report, we know better what is tested, not just: Scenario: Example, Variant 0 Scenario: Example, Variant 1 Scenario: Example, Variant 2 I'm trying to help our

How to implement 'if' in Gherkin

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:26:22
问题 I am trying to convert Selenium test to Gherkin. Is there way to implement if statements in Gherkin? Example : assume the code is written in the below format. I am just writing description as below. Please understand the part after double slash is the actual Selenium code: // launch the application // login to application // navigate to page String str; if(str== "XYZ") { // verify title } //verify text field 1 //verify test field 2 //verify select box For this I am trying to write code in

Karate API Tests - Escaping '?' in the url in a feature file

Deadly 提交于 2019-12-09 22:38:20
问题 I am using the path keyword from Karate API framework to concatenate strings to form a url. However, I am not able to pass '?'. Here is what I am doing: Background: * url 'https://api.cloud.abcde.com/animal/' Scenario: Verify the get status Given path 'herbivore?id=25' When method get Then status 200 When I run the test, i see the '?' being passed as %3F. I tried to escape it using \ and tried some other answers too but couldn't succeed. Do I need to use url encoding ? Any pointers or help

IntelliJ IDEA not recognizing .feature files

混江龙づ霸主 提交于 2019-12-09 11:20:55
问题 I have installed the cucumber-java and gherkin plugins in IntelliJ IDEA but when I create a .feature file it is not recognized as a feature file. I did restart IntelliJ and have checked to make sure the plugins are enabled in the plugins settings window.feature file in IntelliJ 回答1: If you have Substeps IntelliJ Plugin enabled then that might be the issue. you will need to remove and restart. 回答2: Check Settings->Editor->File Types. Verify that Cucumber Scenario is set to a Registered Pattern

How do I create a Cucumber DataTable?

旧时模样 提交于 2019-12-09 10:10:08
问题 I want to manually set up a Cucumber DataTable using Java (instead of Gherkin). In Gherkin, my table would look like this: | h1 | h2 | | v1 | v2 | My Java so far looks like this: List<String> raw = Arrays.asList( "v1", "v2"); DataTable dataTable = DataTable.create(raw, Locale.getDefault(), "h1", "h2"); What I get back is a DataTable with headers but no contents. It's also longer than expected: | h1| h2 | | | | | | | I'm sure the solution must be fairly simple, but I'm a bit at a loss right

Is there a way to directly generate Step Definitions in Eclipse without Running Cucumber?

蹲街弑〆低调 提交于 2019-12-09 07:57:13
问题 Im doing integration testing with cucumber and Gradle in Eclipse. For now my workflow is Write a feature file Run it to generate step skeletons Copy and implement them This works good for new features and so on, but becomes quite bothersome if you have a large feature and implement new steps in the middle or towards the end. To get the new step skeletons I need to run the whole feature. Even with the dryRun = true option this takes up a long time. I have heard that IntellyJ can generate these