cucumber

Design issue in Cucumber spring WebDriver quit in @After method

让人想犯罪 __ 提交于 2021-02-08 11:05:30
问题 I have a design issue when I am trying to build a framework using cucumber, selenium and cucumber-spring. My expected behavior is to quit WebdDriver instance for every scenario. But Here is my page objects in src\main\java @Component public class BasePage { WebDriver driver; public BasePage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } public WebDriver getDriver() { return this.driver; } } Here is another page object class which extends the Base class.

Cucumber: How to run the After hook only once after all examples in scenarion_outline

不问归期 提交于 2021-02-08 10:16:16
问题 I have a scenario_outline which tests login screen of a website. Scenario_outline: Try to login Verify login Examples: | User | Pass | | user1 | pass1 | | user2 | pass2 | I want to be able to start the web page at the beginning and close if after all examples are done. Running the Before hook is easy Before do $start ||= false if ! start #start web page $start = true end end But how do i run my After hook only once after all scenarios are done? After do #close web page end The above example

Karate - Conditional logic with string and array

这一生的挚爱 提交于 2021-02-08 07:25:21
问题 This question derives from this question asked earlier. I am making a Soap request, and I am receiving the response as either an Array, or String. [print] [ "M4205N", "M4206U" ] [print] M5967H When I get the response as an array, I figured out how to loop through it, and pass the values to another request. However, sometimes the response will come back as a single Code, and it will be returned as a String. In that case, I cannot perform the same logic as I did with the array. I've read about

Karate - Conditional logic with string and array

醉酒当歌 提交于 2021-02-08 07:21:21
问题 This question derives from this question asked earlier. I am making a Soap request, and I am receiving the response as either an Array, or String. [print] [ "M4205N", "M4206U" ] [print] M5967H When I get the response as an array, I figured out how to loop through it, and pass the values to another request. However, sometimes the response will come back as a single Code, and it will be returned as a String. In that case, I cannot perform the same logic as I did with the array. I've read about

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 |

Sharing a common set of Examples across multiple Scenario Outlines in Specflow

故事扮演 提交于 2021-02-07 11:31:49
问题 Is is possible to share a common set of examples across multiple scenario outlines in Specflow without duplicating the set of examples for each outline? e.g. excuse the noddy example, but here the Examples are repeated for each Scenario Outline and I want to know if it's possible to declare those Examples once and use them for each Scenario Outline ? Feature: Just an example about animals Scenario Outline: Given an <animal> When something happens Then this should be the outcome Examples: |

Capybara open an html file in my computer

流过昼夜 提交于 2021-02-07 04:26:41
问题 I have an html file in my computer and I want to open that file using Capybara to test it. Could you help me to solve this problem? P/S: That html file is created automatically in my app. I do appreciate any idea helping me to solve this problem. Thanks :) UPDATE: Based on the capybara source code here, I found that I should use Capybara.current_session.driver.visit instead of page.visit. The problem is solved 回答1: I can confirm that the update to the question works (assuming the file is in

Capybara open an html file in my computer

你说的曾经没有我的故事 提交于 2021-02-07 04:26:13
问题 I have an html file in my computer and I want to open that file using Capybara to test it. Could you help me to solve this problem? P/S: That html file is created automatically in my app. I do appreciate any idea helping me to solve this problem. Thanks :) UPDATE: Based on the capybara source code here, I found that I should use Capybara.current_session.driver.visit instead of page.visit. The problem is solved 回答1: I can confirm that the update to the question works (assuming the file is in

cucumber re-run failed scenarios automatically with a tag?

大城市里の小女人 提交于 2021-02-06 15:29:49
问题 In our build there are certain scenarios that fail for reasons which are out of our control or take too long to debug properly. Things such asynchronous javascript etc. Anyway the point is sometimes they work sometimes they don't, so I was thinking it would be nice to add a tag to a scenario such as @rerun_on_failure or @retry which would retry the scenarion X number of times before failing the build. I understand this is not an ideal solution, but the test is still valuable and we would like