Menu
  • HOME
  • TAGS

Static methods called with base class property in specflow step from definition file refer to property as null

inheritance,selenium,tdd,specflow

You shouldn't mix your test setup/cleanup infrastructure between specflow and mstest. SpecFlow is a test generation tool. It will generate the [Test] and [TestCleanup] methods for you and so your classes should not use them. If you want things to happen after your tests then you should use the SpecFlow...

Injecting data into running IISExpress from SpecFlow

asp.net-mvc,bdd,iis-express,specflow

I know this is just a learning experience but I'm going to consider if this were a real system, how would you get it into a production stable code. This way you get the chance to learn more too. Unfortunately there is no silver bullet that is going to give...

parallel execution in nunit for bdd test cases

selenium,nunit,bdd,specflow,pnunit

I've developed a method of running selenium tests in parallel that I've written about here http://blog.dmbcllc.com/running-selenium-in-parallel-with-any-net-unit-testing-tool/

Providing Examples in more than 1 row Specflow

c#,.net,bdd,specflow

There are a couple of things wrong with your first scenario. You have mixed you steps with your examples. The steps must be in the scenario outline, they can't be in the examples. Given that, if you re-wrote your scenario with the steps in the outline then it would look...

How can I get Resharper to treat Specflow Bindings, Step Def etc. annotations as Implicitly Used

binding,annotations,resharper,specflow

Put your TechTalk.SpecFlow.xml to C:\Program Files (x86)\JetBrains\ReSharper\v8.2\Bin\ExternalAnnotations\; Remove ".dll" extension from <assembly name="TechTalk.SpecFlow.dll"> in xml you mentioned to get <assembly name="TechTalk.SpecFlow">; Reopen Visual Studio; Clean ReSharper caches for the solution; ...

Passing arrays of variable in specflow

arrays,variables,specflow

You can pass a comma separated string and then transform it into a list: When i login to a site then 'Joe,Bloggs,Peter,Mr,Some street,15' are valid [Then("'(.*)' are valid")] public void ValuesAreValid(List<String> values) { } [StepArgumentTransformation] public List<String> TransformToListOfString(string commaSeparatedList) { return String.Split(",").ToList(); } if you want the values to come...

Verifying multiple product's features added in the cart is same in the Order Summary page with Selenium webdriver + Specflow + C#+ page object pattern

c#,selenium-webdriver,specflow,pageobjects

you method os.getOrderProductName(); doesn't make any sense if an order can have multiple products. You should have a method os.getOrderProducts(); which will return a collection of OrderProduct objects. It should do this by finding all elements which have an id="productorderelement" (although you should not have elements with the same id,...

Built tests are not added to the Visual Studio Test Explorer window

specflow,white

in order to configure it to generate MSTest tests you need to add this to your app.config: <specFlow> <unitTestProvider name="MSTest"></unitTestProvider> </specFlow> ...

Web.config file not found after projects moved

c#,asp.net,visual-studio-2012,iis-7,specflow

i think Chrome is your web browser? This is the default error page Chrome displays when it receives a 500 HTTP response from the server with no content. Run the site directly on the server – depending on the configuration of your site/server, you may be able to see the...

is there a way to use .feature file as input

bdd,specflow

From what I understand, you want to avoid having to rebuild your test for changes in your feature file The problem with what you are suggesting is that you are assuming your mapping is as simple as: Feature file <---> StepDefs But in reality whats happening is: .Feature File<--->FeatureFile.feature.cs<--->StepDefs The...

SpecFlow Ambiguity in bindings

c#,.net,bdd,specflow

As @perfectionist has pointed out your problem is with your regexes. One is consuming all of the chars for both. Try this instead: Feature: ConversionUnencrypted Pdf-Pdf @mytag Scenario Outline: ConversionUnencrypted Pdf-Pdf Given I get Inputs Folder and list of Files '<inputFolder>' then '<getInputTokens>' Given I get '<outputDirectory>' ... and the...

SpecRun and TeamCity pass/fail integration

teamcity,specflow,specrun

There is an option to set build status to success using Build Status Service message. When your test pass, report such message with status 'SUCCESS' in log output

Is it correct in BDD to bypass your service layers and change state of data for test setups?

api,tdd,bdd,specflow,atdd

I don't see any problem with doing this. In fact your Given steps should be able to do what is neccessary to get the system under test setup as your test needs it. What you are testing is the When and validating it with the Then. If these given steps...

Multiple Scope value in Binding (Specflow)

scope,automated-tests,specflow,feature-selection,feature-file

According to the scoping rules multiple Scope bindings will be OR'd so I would expect the second example to work. Are you sure that you are spelling the feature name correctly? I'll try and get an example worked up to verify this behaviour....

Specflow table selenium

specflow

Instead of using using a Table element, turn it into a Scenario Outline. So your Scenario would become. Scenario Outline: Successful Login Given I am on **** Login When I enter <UserName> and <Password> Then the logout link should be displayed Examples: | UserName | Password | | Foo |...

PicklesDoc: How do I create a level 3 header

markdown,bdd,specflow

Unfortunately, the "#" signs are swallowed by the SpecFlow/gherkin parser, so they are never passed to the Markdown parser. So there is - as far as I know - no way to create a level 3 header. I am in the process of evaluating the upcoming Gherkin3 parser, maybe that...

Sharing example tables between scenarios

c#,bdd,specflow

You can use SpecFlow's "background" keyword. Background: Given my table looks like | .... | .... | Put this before your scenarios. You can then include the table as you would for any other Given, and it will be available for every scenario in the file....

installing specflow for vs2013 mssing TechTalk.SpecFlow reference

specflow

Go to visual studio package manager console. To install specflow for NUnit, type Install-Package SpecFlow.NUnit This will install all the required packages and a correctly configured app.config to work with NUnit. If you instead resolved all the references by hand, then you would still have to construct the app config...

In SpecFlow can you store more than one hook in the same steps file

c#,specflow

Yes this is fine, just don't call the methods the same thing: [AfterScenario("hook_afterscenario_x_cleanup")] public void AfterScenarioX() { //do x } [AfterScenario("hook_afterscenario_y_cleanup")] public void AfterScenarioY() { //do y } having two methods with the same name and same arguments in the same class is not valid in c#, which is why...

How to make step argument dependent on configuration?

c#,specflow,gherkin

You don't want the configurable data in your feature files at all. Instead, create a generic step whose definition reads the config file: Scenario: Test LoggingService Given I set the auth header And in C#: [Given(@"I set the auth header")] public void GivenISetTheAuthHeader() { string username = System.Configuration.ConfigurationManager.AppSettings["RestServiceUserName"]; string password...

Postsharp skips to decorate methods that are marked with CompilerGenerated attribute

c#,mstest,specflow,postsharp

PostSharp ignores all the types that have [CompilerGenerated] attribute applied when performing the multicasting of the aspect attributes. This functionality is by design and is needed to avoid the application of the aspects on all the types generated by the C# compiler. The generated types represent the implementation details of...

Using Specflow and NUnit version 3 to run tests in paralel

c#,parallel-processing,nunit,specflow

Thanks a lot for the suggestions. I come out with own custom solution - just exploring the test dll with reflection from a custom command line app which then spawns separate OS processes each of them calling nunit-console.exe with the --include parameter specifying only a particular group of tests. This...

Build failure conditions — what do these checkboxes look for?

teamcity,specflow

You can take a look here for the general documentation http://confluence.jetbrains.com/display/TCD8/Build+Failure+Conditions The basic idea is that teamcity already provides options for common failures in the build process (like test failing,build running for longer time etc). This is in the first category of "common conditions". The second category is where you...

Load data for Scenario Context from CSV file

c#,coded-ui-tests,specflow,data-driven-tests

SpecFlow doesn't support such functionality. One choice related to reading examples from file is to use SpecFlow+ Excel and read data from excel file....

Specflow regex matching - overloading of definitions

c#,regex,specflow

A simple solution that should probably work sufficiently would be to replace your (.*)'s with ([^"]*) (instead of 'any character', 'any character that is not a "). A slightly better solution might be counting your "'s to ensure that you match the opening and ending quotation mark. Most probably you...

BeforeScenarioBlock to execute only before “Given” statement

bdd,specflow

A [BeforeScenarioBlock] will run before any 'block' in the scenario, ie before each separate set of Given, When or Then blocks. There is no built in way to specify that a hook should only run before a particular type of block I don't think but I believe it should be...

How to find a JavaScript alert that is already open with WatiN

javascript,c#,internet-explorer-8,watin,specflow

Let me write a more complete example of this for you: public partial class Form1 : Form { // // Your class properites/variables // AlertDialogHandler dialogHandler; [DllImport("User32.dll")] public static extern Int32 FindWindow(String lpClassName, String lpWindowName); // // Some methods/functions declarations // public void SomeInitMethod() { dialogHandler = new AlertDialogHandler() browse.AddDialogHandler(dialogHandler);...

There is any wait to integrate Specflow with Jasmine?

javascript,testing,jasmine,specflow

Specflow is cucumber for .net, so it won't be able to run javascript tests using jasmine. However there are a couple of cucumber frameworks for javascript (see this and the answers in this question which also shows how jasmine expects the tests to be written BDD style.) which will give...

When I call SpecFlow hook [BeforeScenario] test class non static properties in the test class value is not saved

c#,selenium,hook,specflow

The problem is probably that your [BeforeScenario] method is private. Have you checked that the method is actually called in the debugger?

Where is the Visual Studio 'Test Explorer' Output located? Is it a saved file?

c#,visual-studio,specflow,test-explorer

After digging around a bit I couldn't find a way to actually view the results from the test explorer window run. So the best I can do is give you an alternative. What you will want to do is run your test using a program called vstest.console.exe, this works almost...

file not found exception running specflow test with codedui in visualstudio 2013

visual-studio-2013,coded-ui-tests,specflow

I believe you might be missing references to some of the required dlls. I just finished testing a test created using a Specflow, codedUI test project on my MS Visual Studio 2013 ultimate and it worked just fine. Here are the steps which I followed: Created a class library project....

Is there a way to use wildcards for a windows directory path in a Gradle script?

windows,command-line,gradle,specflow

You can create a file tree - http://www.gradle.org/docs/current/userguide/working_with_files.html - with include filter matching **/SpecFlow.exe and then call its http://www.gradle.org/docs/current/javadoc/org/gradle/api/file/FileCollection.html#getSingleFile() and obtain path from it. Of course there is a question how you want to handle case when there are more versions of this package installed.

How to get Exception message thrown by one of the specflow scenario's [Given-when-then] methods

c#,exception,bdd,specflow

You are looking for ScenarioContext.Current.TestError. I tried looking through the SpecFlow documentation, but I think I found this property by just drilling down into the ScenarioContext.Current property using Intellisense in Visual Studio. using TechTalk.SpecFlow; namespace Your.Project { [Binding] public class CommonHooks { [AfterScenario] public void AfterScenario() { Exeception lastError =...

Is it possible to run multiple Examples in a Scenario Outline without closing the browser?

c#,specflow

A good option to avoid having to close/re-open the browser between tests is to look at Hooks in SpecFlow. You can use a [BeforeFeature] or [BeforeTestRun] hook (or more variations) to launch the browser once, then run numerous tests before closing the browser at the end of the tests. If...

What governs when [BeforeScenario] is run in SpecFlow?

c#,specflow

Some code might help identify the issues, but it might be that the derived steps classes all have the method [BeforeScenario] (as they inherit it) and so specflow is calling once for each derived class. In Specflow its usually not necessary to get involved with any inheritance as all steps...

Specflow/Gherkin: How to handle bad data

specflow,gherkin

It's a bit strange that you are testing 2 values thoughout your test. I would be tempted to rewrite like this: Scenario Outline: valid lc's can be created Given the lc named <lc> does not exist When I add a Lc named <lc> with Id <id> and rate <rate> Then...

How to Structure CRUD Tests using BDD

nunit,automated-tests,bdd,crud,specflow

After some internal debate I decided that it was futile to try and reduce the tests I had already written into the BDD grammar of: [scenario name] [pre-condition] [action] [observation] And what I ended up with was something like this: [scenario name] [pre-condition] [action] [observation] [pre-condition] [action] [observation] ... [end]...

Regenerate steps for scenarios in specflow

specflow,auto-generate,scenarios

The easiest way I can think of to do this would be to exclude the current steps files from your project (right click on the file in the solution explorer-> Exclude from project) and then you'll be able to regenerate them from the scenario file again.

How to integrate Appium with C#?

c#,selenium-webdriver,appium,specflow

Appium provides the dotnet-appium-driver which is your API to interface with Appium. You can use that to write your app automation. You did not provide any example here nor code, so I cannot really act on something to show you. I will just write down some C# code to let...

Specflow,Selenium-Share data between different Step definitions or classes

selenium-webdriver,specflow

What you want to do is a bad idea. you should start a new browser session for each feature, IMHO. There is no guarantee in what order your tests will execute, this will be decided by the test runner, so you might get Feature2 running before Feature1. In fact your...