scenarios

Nested examples in cucumber scenario outline - List or Map values

寵の児 提交于 2021-02-07 20:53:22
问题 I have recently seen a cucumber scenario outline like this. sorry for my bad example below. But the format is in this way. I really wonder if this type of format is supported by cucumber? The nested Data tables. Has any one used this type of nested Data table? If yes is this the below format? Scenario Outline: Hello World Given I am logged in as <user> When I search for <searchTerm> Then I add the following to my basket: | <item1> |teapot| | <item2> |Yorkshire tea| Examples: | user |

Nested examples in cucumber scenario outline - List or Map values

落爺英雄遲暮 提交于 2021-02-07 20:52:13
问题 I have recently seen a cucumber scenario outline like this. sorry for my bad example below. But the format is in this way. I really wonder if this type of format is supported by cucumber? The nested Data tables. Has any one used this type of nested Data table? If yes is this the below format? Scenario Outline: Hello World Given I am logged in as <user> When I search for <searchTerm> Then I add the following to my basket: | <item1> |teapot| | <item2> |Yorkshire tea| Examples: | user |

Matching key value pairs in a request in a Karate Netty scenario

蓝咒 提交于 2021-01-28 08:07:24
问题 I'm writing features for a Karate Netty mock service and I'm trying to use the Scenario to match on a key value pair in the request. For example: In a request like this one that has a nested array of objects, I want this feature to fire when any of the Id values are null: { "Array": [ { "Id": "legitId" }, { "Id": null } ], } Scenario: pathMatches('path/to/my/endpoint') && methodIs('post') && request.Array.contains('Id': null) The documentation says I can use JS expressions in the scenario,

Karate : How to use response of scenario in afterScenario

陌路散爱 提交于 2021-01-28 04:50:49
问题 What is the best way to use the response of scenario in afterScenario?? Background: * configure afterScenario = function(response){if(response.key){ karate.log('key is present');} else{karate.log('key is not present');} } Scenario: get all users Given path 'users' When method get Then status 200 回答1: Try function without input params * configure afterScenario = function(){if(response.key){ karate.log('key is present');} else{karate.log('key is not present');} } if the response variable

How can i get cucumber scenario variables in title?

梦想的初衷 提交于 2021-01-27 21:33:21
问题 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 回答1: The Then keyword must be above the Examples . Feature: Scenario outline with variables

Specflow Feature-level Templates

左心房为你撑大大i 提交于 2021-01-27 21:03:31
问题 I'm trying to execute an entire SpecFlow Feature using three different UserID/Password combinations. I'm struggling to find a way to do this in the .feature file without having to introduce any loops in the MSTest. On the Scenario level I'm doing this: Scenario Template: Verify the addition functionality Given the value <x> And the value <y> When I add the values together Then the result should be <z> Examples: |x|y|z| |1|2|3| |2|2|4| |2|3|5| Is there a way to do a similar table at the

SpecFlow - Retry failed tests

杀马特。学长 韩版系。学妹 提交于 2020-12-29 12:48:49
问题 Is there a way to implement an AfterScenario hook to re-run the current test in case of Fail? Something like this: [AfterScenario("retry")] public void Retry() { if (ScenarioContext.Current.TestError != null) { // ? } } Note : The tests in my project are combined in Ordered tests and executed via MsTest . 回答1: The purpose of Specflow scenarios is to assert that a system is behaving as expected. If some temporal issue causes the test to fail, then getting the test to re-run and "hoping for the

Cucumber examples reuse in different features/scenarios

只愿长相守 提交于 2020-02-04 18:43:12
问题 I've been using cucumber for awhile and I've stumbled upon a problem: Actual question: Is there a solution to import the examples from a single file/db using cucumber specifically as examples? Or alternatively is there a way to define a variable while already in-step to be an example? Or alternatively again, is there an option to send the examples as variables when I launch the feature file/scenario? The Problem: I have a couple of scenarios where I would like to use exactly the same examples