FAQ Database Discussion Community


Providing Examples in more than 1 row Specflow

c#,.net,bdd,specflow
When I provide examples in a single row it works fine. When I provide examples in more than a row I'm getting binding parameter exception. If I provide all examples in a single line its not readable easily. Feature: ConversionUnencrypted Pdf-Pdf @mytag Scenario Outline: ConversionUnencrypted Pdf-Pdf Given I get Inputs...

is there a way to use .feature file as input

bdd,specflow
i'm currently trying to learn bdd techniques and trying frameworks for it. the idea comes from test to code, but i want to use it in revers way if possible. i'm currently using specflow, selenium and nunit combination. i want to open my work to anyone (non-developers) for adding new...

Jbehave - Run method after a specific scenario

bdd,jbehave,gherkin
I'm trying to configure JBehave with Gherkin to run a teardown method after a specific scenario. So far I'm aware of the below: JBehave supports Gherkin, which has a syntax for Lifecycle before event, unfortunately Gherkin doesn't support the Lifecycle after. http://jbehave.org/reference/latest/story-syntax.html JBehave supports the annotation @AfterScenario which can only...

'ProgrammingError' on django test case

django,unit-testing,testing,bdd,django-1.6
I wrote a test case for an image api, but I got this error AttributeError: 'ProgrammingError' object has no attribute '__traceback__' I create an image, I go to the api url, then I test if the image is there, all is good but when I try to delete this image...

How to test if devise is signing users in with login, not email?

ruby-on-rails,ruby,testing,devise,bdd
I'm trying to confirm whether devise is using login, not email for sign in. That's what I have so far: test/controllers/sessions_controller_test.rb: require 'test_helper' class Devise::SessionsControllerTest < ActionController::TestCase test "should sign in using login" do @request.env["devise.mapping"] = Devise.mappings[:user] post :create, user: {login: 'login', password: 'password'} assert_response :success end end And now...

Cucumber.js debugging in IntelliJ

debugging,intellij-idea,bdd,cucumberjs
IntelliJ has a plugin for Cucumber.js. This suppose to enable running and debugging inside the IDE. The run configuration for cucumber.js works, but the debug mode is deactivated (Debug button can not be clicked). Does anybody else has the same problem and managed to solve it? Debugging is very essential...

Can behat check that steps are defined before trying to run anything?

php,testing,bdd,behat
I've got a behat scenario that takes a long time to run. If I've written a step incorrectly, I have to wait for the test to hit that step before I find out my mistake when it tells me I've got an undefined step. Is there a way to get...

Mocha Loading Blank in Browser

javascript,html,bdd,mocha,chai
Context I've used Mocha before many times, both in the browser and just using the command line. I tend to use Chai's expect module for bdd. I have five test files that have been working with command line npm test. I just want to run the tests in the browser...

How do I test array element types using BDD Javascript?

javascript,unit-testing,bdd
I am writing a Javascript unit test using the BDD style. I want to test that a value is an array has all string elements I can get the first condition with value.should.be.an('array'); Is there a way to test for the second condition using this idiom?...

BeforeScenarioBlock to execute only before “Given” statement

bdd,specflow
Based on SpecFlow documentation, the [BeforeScenarioBlock] hook will be called before "Given" and "When" statement. Is there any way to make the [BeforeScenarioBlock] hook only to be called before "Given" statement ?

Injecting data into running IISExpress from SpecFlow

asp.net-mvc,bdd,iis-express,specflow
I'm new to the ASP.NET MVC 5 world and SpecFlow. I'm trying to put together a simple example for learning purposes. I've a ASP.NET MVC project in one assembly and a SpecFlow definition in another. I'm trying to avoid having a database in the setup since I'm trying to keep...

Testing behaviour of classes with deep nested dependencies

php,testing,tdd,bdd,behat
I am starting using Behat and I was thinking what is the correct way to do something like this: I am testing system behaviour with Behat (the domain, not web) and i want to test behaviour that uses UserService class. UserService takes UserRepository (Interface) as an argument. Should i create...

Check with Chai if an object doesn't contain any additional properties

node.js,mocha,bdd,chai
I'm working on an API and should return based on permissions only a subset of the actual object's properties. I'm writing my tests in mocha and chai and would like to test for something like this (given res is the response object from the server and res.body contains the received...

SpecFlow Ambiguity in bindings

c#,.net,bdd,specflow
I'm working with Spec-flow for quite some days. I am facing "Multiple matching found.Navigating to first match", while Debugging this can be solved, but when I'm running the entire solution Its failing because of Ambiguity in bindings. I'm running around 4 C sharp class files in a Single project Feature:...

Enabling Mink Extension in Behat

bdd,behat,mink
I'm trying to add the Mink extension to Behat. I've installed Behat, Mink and Mink-Extension through composer. However, now I'm having trouble with enabling the extension. Here is my behat.yml: default: extensions: Behat\MinkExtension\Extension: base_url: http://en.wikipedia.org goutte: ~ selenium2: ~ Here is my example test: Feature: New In order to test...

Behat 3 - Behat\Behat\Context\Step\Given not found

php,bdd,behat,mink
I'm testing Behat/Mink for the first time with a simple example. When I launch behat I have this error : PHP Fatal error: Class 'Behat\Behat\Context\Step\Given' not found in /var/www/behat-test/features/bootstrap/FeatureContext.php on line 31 features/bootstrap/FeatureContext.php : <?php require_once './vendor/autoload.php'; use Behat\Behat\Context\Context; use Behat\Behat\Context\SnippetAcceptingContext; use Behat\MinkExtension\Context\MinkContext; use Behat\Behat\Context\Step; class FeatureContext extends MinkContext implements...

Behat / Mink error Snippets for the following steps not generated

php,bdd,behat,mink
When switching over from Behat to Mink in v3 to use headless browser for testing. It stops generating Snippets for me automatically from my feature files. Following the setup for features/bootstrap/FeatureContext.php from the docs. behat # generates this error at the bottom of the output --- Snippets for the following...

Using Chai - how to check object property contains DOM element

javascript,jquery,tdd,bdd,chai
How can I test that an object property contains the value of a DOM element in Chai, eg: someObject = function(){ element: $('#foo'); } How do I check that element equals the jquery object $('#foo')? So far, I have tried: someObject.should.have.property('element', $('#foo') someObject.should.have.property('element').with.value($('#foo')) But these fail. Anyone have any ideas?...

MsTests MVC5 Controller not triggering OnAuthorization

c#,asp.net-mvc-5,tdd,bdd
I'm testing controller actions on my current project. Got a method to mock the logged user so I can control access to the data itself, on one of the methods I forgot to mock the user and I got surprised, instead of getting a redirect (defined behaviour for non-anonymous actions...

How to create DRYer Rspec with Factory Girl

ruby-on-rails,ruby,rspec,factory-girl,bdd
I am building a simple blog app in order to learn BDD/TDD with RSpec and Factory Girl. Through this process, I continue to run into 'Failures' but I believe they have more to do with how I am using Factory Girl than anything. As you'll see below, in order to...

Writing tests before writing code

unit-testing,testing,tdd,bdd
As far as I understand TDD and BDD cycle is something like: Start by writing tests See them fail Write code Pass the tests Repeat The question is how do you write tests before you have any code? Should I create some kind of class skeletons or interfaces? Or have...

How to partially mock external object

ios,objective-c,unit-testing,bdd,ocmock
I have class method to test with dependant object (Keys object) APIRouter.m + (NSURL*)apiURLWithPath:(NSString*)path { MyKeys *keys = [MyKeys new]; NSString *url = [NSString stringWithFormat:@"%@?api_key=%@", path, [keys APIKey]]; return [NSURL URLWithString:url]; } I am trying to partially mock this Keys object and return "MY_API_KEY" value but the test method fails...

PHP, BDD with Behat and Mink (Selenium2 driver): How to close the browser window at the end of the test programatically?

php,selenium-webdriver,bdd,behat,mink
I am trying to learn BDD in PHP with Behat and Mink and I am using Selenium2 driver for the same. My question is once the tests are over, how to programmatically close each browser window/tab that Selenium2 opens? Since closing so many browser windows/tabs each time after each test...

Calabash - how to compare text from label with given id?

ios,ruby,bdd,calabash,calabash-ios
I want to make assertion of the results of Calabash queries for labels with given ids. But the 'assert' method seems to not exist in Calabash. I test an iOS application. My code: Then(/^arrival date has been changed to day after departure date$/) do departure_date_day = query("label marked:'departure_date_day'", :text).first arrival_date_day...

How to conditionally exclude a scenario in cucumber

scala,cucumber,bdd
I am trying to exclude scenarios programmatically in cucumber. Testcases are OS dependent in my case. Say if underlying OS is Windows, I would like to skip certain scenarios. After some research on google I found out that there a place where you can hook up this logic in ruby...

Socket.IO server not receiving message from client

node.js,socket.io,mocha,bdd,expect.js
I'm playing around with Node, Socket.IO and BDD by creating a chat application. During one of the tests, I get a timeout error stating: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. The affected test is it('#must be able to receive a message',...

first time trying tdd. which tests should I write?

testing,tdd,bdd
I'm working on an application for access control on gyms. I want to make all this app testable, but it's my first time with TDD/BDD. I don't exactly know which tests should I create. Maybe tests from user's perspective? Something like: As a visitor, I want to enter gym. As...

RSpec & Devise authentication don't works

ruby-on-rails,ruby-on-rails-4,rspec,devise,bdd
I having very weird problem with RSpec and Devise describe 'GET edit:/id' do before do @job = FactoryGirl.create(:job) get(:edit, id: @job.id) end context 'as not authorized' do before { logout(:user) } it 'redirects to login page' do expect(response).to redirect_to new_user_session_path end end #it '' do end << works if i...

Mocha breakpoints using Visual Studio Code

node.js,tdd,mocha,bdd,vscode
Is it possible to add breakpoints to ones Mocha tests using Visual Studio Code? Normally when debugging code one need to configure the launch.json, setting the program attribute to the javascript file to execute. I am not sure how to do this for for Mocha though....