gherkin

Reusable/Generic Examples table in Cucumber

血红的双手。 提交于 2019-12-06 15:22:46
Is it possible for multiple scenarios to use the same Examples table? So instead of having something like the following: Scenario Outline: First Scenario Given I am viewing "<url>" Then I assert that the current URL "<url>" Examples: | url | | https://google.com | | https://twitter.com| Scenario Outline: Second Scenario Given I am viewing "<url>" with route "</contactus>" Then I assert that "<url>" contains "contactus" Examples: | url | | https://google.com | | https://twitter.com| I can do something like Scenario Outline: Reusable Example Examples: | url | | https://google.com | | https:/

cucumber tags based on maven profile

前提是你 提交于 2019-12-06 14:27:28
I am trying to run specific Gherkin scenarios based on the variable @tags(if it is possible). For example, if my profile is "dev" I want to run scenario 1 and if profile is "qa" I want to run scenario 2. I can get the profile value in my java class. I can also pass the tags in the command line and run it as mentioned here . But that is not something I am looking for. For example: @QA Scenario:I do x and check y Given I do abc Then the response is 200 @DEV Scenario:I do y and check x Given I do cde Then the response is 500 I am getting the profile value in java class as System.getProperty(

How to implement 'if' in Gherkin

戏子无情 提交于 2019-12-06 07:35:00
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 Gherkin as follows Given user launches the application When user login with valid credentials and navigate

BDD and Behat special characters

血红的双手。 提交于 2019-12-06 06:33:31
问题 There is a similar question @ Gherkin in Behat and input validations scenarios However is not the same. My problem is that I need to had to scenario outlines examples or to arrays Given I have a problem with data | in | this | array | | how | can | I | | add | special | characters | Most of special characters are ok, but wat about quotes and pipes? special characters example: \|!"#$%&/()=?«»'{}[]'`^~*+ºª-_.:,;<>@ł€¶ŧ←↓→øþĸħŋđðßæ|«»¢“”nµ Thanks 回答1: I know that a year has passed since this was

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

十年热恋 提交于 2019-12-04 15:41:09
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 would be appreciated. Thanks You should use param for this case: Scenario: Verify the get status Given

BDD and Behat special characters

↘锁芯ラ 提交于 2019-12-04 14:46:30
There is a similar question @ Gherkin in Behat and input validations scenarios However is not the same. My problem is that I need to had to scenario outlines examples or to arrays Given I have a problem with data | in | this | array | | how | can | I | | add | special | characters | Most of special characters are ok, but wat about quotes and pipes? special characters example: \|!"#$%&/()=?«»'{}[]'`^~*+ºª-_.:,;<>@ł€¶ŧ←↓→øþĸħŋđðßæ|«»¢“”nµ Thanks I know that a year has passed since this was posted, but today had a similar problem and I have posted my solution here . I'm copying it here in case

How to increase reusability between SpecFlow/Gherkin steps?

佐手、 提交于 2019-12-04 08:39:15
问题 I think I thoroughly understand the concepts and ideas behind SpecFlow, but even after reading the Secret Ninja Cucumber Scrolls, The Cucumber Book, and going through the various forums I'm still unsure about the path to reusability. Our scenarios already comply to various guidelines Self explanatory Must have a understandable purpose (what makes it different from the other scenarios) Are unique Represent vertical functional slices Uses Ubiquitous Language Written from the stakeholder

When writing a BDD feature, should I put previous user interaction into a Given step, or a When step?

半世苍凉 提交于 2019-12-04 07:35:38
I am trying to write requirements for a multi-step business process (via a wizard). I have many scenarios where user interactions with one screen will change whether you are allowed to pick options on another screen. For example (I've obscured the actual business, but the process and form of the steps is nearly identical): Feature: Personal Diagnostic Search Filter In order to select a Technician who offers Personal Diagnostics, when I've asked for a Personal Diagnostic As a Business Customer I want to limit my search to Technicians who offer Personal Diagnostics Background: Given a Business

CustomDataProvider for feature file (QAF)

不问归期 提交于 2019-12-04 04:11:31
问题 I'm using QAF and it's amazing tool, but i have one problem. Are there any ways to parameterize cucumber feature steps with custom data provider as it's done in BDD files? For example, we can insert data from external file Examples: {'datafile':'resources/testdata.txt'} In .BDD it's done like this: SCENARIO: Data provider with testng method argument and context META-DATA: {"dataProvider":"dp-with-testngmethod-contex", "dataProviderClass":"com.qmetry.qaf.automation.impl.CustomDataProvider"} #

How to set up individual tracing / logging with SpecFlow

夙愿已清 提交于 2019-12-03 22:15:29
For my SpecFlow tests, I want to setup an individual logging / tracing of the test progress during the execution of tests. E.g. i want to write all passed / failed steps started / ended scenarios started / ended features to the windows event log (in order to synchronize it with event log messages generated by other system components during the test). I tried to use the [BeforeFeature], [BeforeScenario], [BeforeStep] Hooks for doing that, but it turned out that I do not have all the required information within this hooks. E.g. i do not know how to get the current text line of the current step