bdd

Why is it wrong for me to run the tests of a specific directory with cypress?

拟墨画扇 提交于 2021-02-11 12:44:47
问题 I am trying to run some specific tests within a directory, using cypress the command that I try to execute is: node_modules\.bin\cypress run --spec 'cypress\integration\tests\default.spec.js' I have also tried with: node_modules\.bin\cypress run --spec 'cypress\integration\tests\*.spec.js' Or: node_modules\.bin\cypress run --spec 'cypress\integration\tests\**' The directory and the files exist, I tried to keep the absolute path to those files but it does not work either. Try changing the

Howto to write a step implementation that supports multiple words

家住魔仙堡 提交于 2021-02-10 16:22:46
问题 Example Gherkin # Gherkin snip When waiting for 30 seconds # or When waiting for 5 s I want to implement above steps in one step definition. I tried the following step implementation. from behave import * use_step_matcher("re") @when(u"waiting for (?P<time>\d+) (s|seconds)") def step_impl(context, time): pass When running this results in this error: TypeError: step_impl() got multiple values for keyword argument 'time' Behave extracts it as a parameter. What's a good practice for doing this?

Howto to write a step implementation that supports multiple words

断了今生、忘了曾经 提交于 2021-02-10 16:22:08
问题 Example Gherkin # Gherkin snip When waiting for 30 seconds # or When waiting for 5 s I want to implement above steps in one step definition. I tried the following step implementation. from behave import * use_step_matcher("re") @when(u"waiting for (?P<time>\d+) (s|seconds)") def step_impl(context, time): pass When running this results in this error: TypeError: step_impl() got multiple values for keyword argument 'time' Behave extracts it as a parameter. What's a good practice for doing this?

How to mock the same method in Prophecy so it returns different response in each of its calls

你。 提交于 2021-02-07 20:35:44
问题 In pure PHPUnit mocking I can do something like this: $mock->expects($this->at(0)) ->method('isReady') ->will($this->returnValue(false)); $mock->expects($this->at(1)) ->method('isReady') ->will($this->returnValue(true)); I was not able to do the same thing using Prophecy. Is it possible? 回答1: You can use: $mock->isReady()->willReturn(false, true); Apparently it's not documented (see https://gist.github.com/gquemener/292e7c5a4bbb72fd48a8). 回答2: There is another documented way to do that. If

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

How to loop over array values in a karate feature

大兔子大兔子 提交于 2021-02-04 20:59:18
问题 I am trying to loop over array values in a karate feature file. In a Feature1.feature - Scenario1, I have some values in the array ["UUID1","UUID2","UUID3"] and I want to call another feature file (Feature2.feature) (having a code to call a DELETE endpoint) of a service Feature2.feature: @ignore Feature: Delete Background: * url baseUrl * headers {content-type:'application/json'} Scenario: Delete Test Assets Given headers {uid: '#(UId)', cid:'#(CId)'} And path 'type', Type, 'id', AssetId When

How to loop over array values in a karate feature

我们两清 提交于 2021-02-04 20:58:59
问题 I am trying to loop over array values in a karate feature file. In a Feature1.feature - Scenario1, I have some values in the array ["UUID1","UUID2","UUID3"] and I want to call another feature file (Feature2.feature) (having a code to call a DELETE endpoint) of a service Feature2.feature: @ignore Feature: Delete Background: * url baseUrl * headers {content-type:'application/json'} Scenario: Delete Test Assets Given headers {uid: '#(UId)', cid:'#(CId)'} And path 'type', Type, 'id', AssetId When

Rails Rspec controller testing with nested resources

岁酱吖の 提交于 2021-01-28 04:48:44
问题 I have nested resources: resources :requests do resources :responses end and want to write controller test for response model. When I try to write: RSpec.describe ResponsesController, type: :controller do describe 'GET #show' do before do @testrequest = Request.create @testresponse = @testrequest.responses.create get :show, request_id: @testrequest.id, id: @testresponse.id end it 'show specific response selected by id if user owner of response or user owner of parent request' do expect

Pass POJOs in Cucumber Example table

北战南征 提交于 2021-01-28 04:16:53
问题 Description: As a test developer, I would like to use a single scenario to test 3 different environments. Simplified Scenario example: @smoke Scenario: Login to the login page and assert that the user is logged in Given User navigates to the page And User enters valid login credentials When User clicks on the login button Then Landing page can be seen Data ( These are grabbed from a property file - converted to POJO ) : Env1.class url = www.environment1.com username = john password = doe1