specflow

Is there a way to run Specflow scenarios in desired order (C# Selenium)?

放肆的年华 提交于 2019-12-06 10:19:58
问题 I'm trying to run multiple Specflow tests in the Test Explorer, but the challenge is I'm unable to run them in the desired order. ex - I have 3 scenarios in my feature files: Login positive Login negative registration positive Currently, they run in random order. I want them to always run in the above order. How can I configure my feature files to make it possible? 回答1: For NUnit: Tests inside a scenario run in alphabetical order, so if you want to run them in specific order just rename

Reuse background definition between two feature files in Specflow

眉间皱痕 提交于 2019-12-06 10:13:41
I have several specflow .feature files to test different entities of a web api project. For every entity I have to create a background with all the needed data in my database, but before of all I need to delete all data, and need to delete using web api calls (not by sql query). I'm doing this: Background: Given I make a new request to localhost on port 53364 And the path is api/voipport/deleteAll And the request type is Delete When the request has completed Given I make a new request to localhost on port 53364 And the path is api/loopblockingexception/deleteAll And the request type is Delete

Specflow step definition inheritance

心不动则不痛 提交于 2019-12-06 09:21:11
问题 I have ExcelStepDefinition class in which are my steps for excel testing. I have WordStepDefinition class too. Since I have a great number of steps that are same for both classes I made some StepDefinition class which will be base class for those two classes. In this base class I need to have some args in constructor which depends on what class is instanced (excel or word). I have made all of this, but when I start tests in Nunit it fails with following stack trace: System

SpecRun returning exit code 120 with @ignore tests

女生的网名这么多〃 提交于 2019-12-06 08:58:55
Running SpecRun from command line as part of a Continuous Integration setup, and recently an ignored ( @ignore ) test generated an exit code of 120 when SpecRun completed. Currently, we break the build on any exit code not equal to 0 (universal success indicator!). What does exit code 120 mean exactly? Is it simply "A test was ignored"? or does it imply more? What other values are returned? Sample build output below. We collect all exit codes (currently 1 SpecRun task, so only 1 exit code is collected), and print out to "exit codes" 58> Done. 58> Result: all tests passed (5 ignored) 58> Total:

Access TestContext in SpecFlow Step Binding class

元气小坏坏 提交于 2019-12-06 00:35:12
Is it possible to access the MSTest TestContext from within a SpecFlow (1.7.1) step binding class? In the generated code of a feature file there is a method FeatureSetup which takes the TestContext as an argument but apparently doesn't do anything with it. I found a way to pass parameters to TestContext and then access them from SpecFlow. By adding a [TestClass] which has a TestContext property and marking its AssemblyInit() method as [AssemblyInitialize] so it gets initialized early before runnig the tests and MSTest will be able to populate the TestContext. { [TestClass] public class

Performing keyboard strokes “Ctrl + A” “Ctrl + C” and “Ctrl + V” on text field with selenium C#

為{幸葍}努か 提交于 2019-12-06 00:31:28
How to simply want to input a value in a text box , select the complete text from the text box using "Ctrl+a" , then copy it using "Ctrl + c" and then Paste it in the same box with "Ctrl + v" using Selenium + C#. Arpan Buch [FindsBy(How = How.Id, Using = "search-criteria")] public IWebElement txtProductSearch1 = null public void copypaste(string strCopy) { txtProductSearch1.Click(); txtProductSearch1.Clear(); txtProductSearch1.SendKeys(strCopy); txtProductSearch1.SendKeys(Keys.Control + "a"); //a in smaller case txtProductSearch1.SendKeys(Keys.Control + "c"); // c in smaller case

How to navigate to feature file from resharper test session window in Visual Studio 2012?

回眸只為那壹抹淺笑 提交于 2019-12-05 20:37:42
For acceptance testing I use TeckTalk SpecFlow in Visual Studio 2012. When I run all specflow scenarios, resharper unit test session windows is opened I can see all test results. Like on screen shot below. The question is, when I see failed test (scenario) in some feature file, how can I navigate directly to this feature file from resharper session window to edit it??? It seems to work perfectly well if run via the new VS2012 Test explorer, which on my machine worked automatically from "Run SpecFlow Scenarios" on the project menu. I can only assume Resharper is getting in the way on your

Multiple Match bindings found on line with two different parameters

你说的曾经没有我的故事 提交于 2019-12-05 15:22:59
I have written two lines(When's) in my same feature file When user $action1$ $key1$ with $value1$ for $atttributeType_Value$ in $Filename1_SectionId1$ Then abc When user $action2$ $key2$ with $value2$ in $Filename2_SectionId2$ Then def and corresponding step definition in step definition file as [When(@"user (.*) (.*) with (.*) for (.*) in (.*)")] public void abc() { //operation } [When(@"user (.*) (.*) with (.*) in (.*)")] public void def() { //operation } But, its showing up an error as "Multiple match bindings found. Navigating to first match.." When I try to navigate for 1st line its

Specflow Binding from External Assembly always purple

非 Y 不嫁゛ 提交于 2019-12-05 11:36:04
I have bindings in an external assembly (As per the specflow docs here ) We need this, as we are making a generic library of Step Definitions that can be used in any of our test suites. It works, however some specflow functionality does not appear to work. Namely: All steps are highlighted purple (Indicating that it cannot be matched with a binding) If you select a step and hit F12 or right-click and select "Go To Step Definition", it says it cannot find a matching binding. However, the code runs OK, and if you debug it, you can step from the feature file into the step definition file, so it

SpecFlow Visual Studio extension attempted to use SpecFlow code-behind generator 1.9

你。 提交于 2019-12-05 07:05:20
问题 I am getting the following error while trying to build my automation solution. Due to which i am unable to change anything in my feature file at the moment. error Version conflict - SpecFlow Visual Studio extension attempted to use SpecFlow code-behind generator 1.9, but project 'POC.Specs' references SpecFlow 2.0. error We recommend migrating to MSBuild code-behind generation to resolve this issue. error For more information see https://specflow.org/documentation/Generate-Tests-from-MsBuild/