Questions tagged [specflow]
SpecFlow is a Behavior-Driven Development (BDD) tool for .NET.
2,273
questions
-1
votes
0
answers
23
views
C# - Automation Testing: How can I get url of windows which closes really fast?
I have an automation code in which I have to click on a link -> clicking on that link opens a new page for which I have to check the content of the url.
The problem is that the page closes really ...
-2
votes
0
answers
39
views
Gitlab Pipeline not able to run a specflow project on windows using gitlab runner shell executor [closed]
I am trying to run a specflow test project in windows using .dll from gitlab pipeline. The runner executer is shell. I am using cmd prompt from .yml file to run the dot net .dll . Its not working ...
1
vote
1
answer
67
views
Specflow Hooks - Why do they need to be static?
I understand the utility of the hooks in C# Specflow, but why do BeforeScenario / AfterScenario and BeforeFeature / AfterFeature have to be static?
1
vote
0
answers
28
views
SpecFlow - passing parameter(s) into a hook
In SpecFlow, is it possible to pass parameters into a hook?
For example, I would like to pass parameters for specifying the Authenticated user and setting up test base data. Something like this would ...
0
votes
0
answers
15
views
Exeption of type 'System.exepction' Was thrown
I have install Specflow extantion in my Visual studio 2022
I am trying to open new Specflow project in Visual studio 2022
I getr this message: Exeption of type 'System.exepction' Was thrown
I have ...
1
vote
1
answer
47
views
Is there a way to override [BeforeScenario] in Specflow C#
Background: At my work place, we have a generic Selenium test automation framework that's used by various teams. It's a skeleton framework on top of which each team customizes/adapts the test ...
0
votes
0
answers
20
views
Configure Specflow to test a dll with Microsoft DI
The scenario is as follows:
I have created a .net dll that uses microsoft dependency injection.
This dll can be used by either a web api or a windows service.
I need to create a specflow test that ...
0
votes
2
answers
94
views
Deserialize JSON json URL for query parameters in Specflow not working
How to encode query parameters on a url in Specflow? the
GET Call for API with Search options with changing scenarios as
Case with searchOperator used = equal, in, like
GET API call for
url.com/?...
0
votes
1
answer
28
views
How to pass Spaces in Scenario name in Test Explorer using SpecFlow, NUnit, Gherkin
i am working on a simple test case using SpecFlow and Gherkin Feature file i want to name my Scenario with spaces in Test Explorer
my Scenario name in Feature file
Scenario: "Perform a Google ...
0
votes
0
answers
19
views
Can I remove SpecflowFeatureFiles tags from my csproj file?
In my csproj file I have lots of SpecflowFeatureFiles tags of the form
<SpecFlowFeatureFiles Update="Path\To\Feature\featureName.feature">
<Visible>$(UsingMicrosoftNETSdk)<...
0
votes
0
answers
31
views
Add driver to service (DI container by SpecFlow.DependencyInjection) at BeforeScenario attribute hooks
I am using SpecFlow.DependencyInjection
I created and added service at ScenarioDependencies attribute like this
[ScenarioDependencies]
public static IServiceCollection CreateServices()
{
var ...
0
votes
0
answers
17
views
Test Class Cleanup Failure - Cleanup not working when running Specflow Selenium tests in a Virtual Machine (Azure Pipeline)
I implemented some Specflow selenium tests in a .NET project, and made them run automatically in an Azure pipeline in a virtual machine. It all worked well, but now I have around 20 test cases and, ...
0
votes
0
answers
50
views
How to run Specflow scenario once but generating 2 extent reports for Chrome and Edge
Currently my manager want me to run a specflow scenario test case once but can generate 2 extent reports (one for Chrome Driver and one for Edge Driver) without changing the old step definition files.
...
0
votes
1
answer
33
views
Specflow Dependency Injection doesn't update variables instantiated in BeforeScenario
Up until now, we've been using the dependency injection in Specflow to good effect - POCOs are instantiated automatically when needed, and carried from one steps binding to another with persisting ...
0
votes
0
answers
47
views
Cannot find SpecFlow Feature Files option in Add New Item window - VS2022
I am new to visual studio and specflow. I have visual studio 2022 community edition in my windows 10 and I have followed all steps and installed specflow extention in visual studio. But I cannot add a ...
-1
votes
1
answer
30
views
How to add Image source in json file of extent spark report config file
I have spark-config.json file as below:
{
"theme": "STANDARD",
"encoding": "utf-8",
"protocol": "HTTPS",
"timelineEnabled":...
0
votes
2
answers
26
views
How to convert specflow or cucumber example into keyvaluepair
How to get selenium example as key value so that I can execute step based on example
0
votes
0
answers
40
views
Why am I getting unauthorised when the code looks fine to me in my step definition file
Trying to generate and API key but seem to get a unauthorised (status 401):
The client security is a company's own web security layer to allow the request to be generated. Obviously these are just ...
0
votes
0
answers
32
views
Error executing a test with SpecFlow newer version
I have setup a new testing instance using SpecFlow 3.9.40 with C# and NUnit. This in Visual Studio 2022 and using built-in SpecFlow to create project, so all necessary packages are pulled in. There ...
0
votes
0
answers
25
views
Azure DevOps SpecFlow+ LivingDoc : Cannot edit feature files online
I cannot edit SpecFlow feature files directly in the LivingDoc section of Azure DevOps.
What I dit :
Installed the Azure DevOps SpecFlow LivingDoc extension
Created an Azure DevOps reposity using Git
...
0
votes
0
answers
37
views
Playwright w/ Specflow and NUnit: Parallel execution only on some tests
I want to run some tests on parallel and some tests not on parallel. When I use [assembly: Parallelizable(ParallelScope.Fixtures)], all of the tests are running on parallel even if I use [...
2
votes
0
answers
86
views
Specflow Playwright - Cant get to the launch the browser at all. What am i missing?
Here's the driver class
[
Binding]
public class Driver : IDisposable
{
private readonly Task<IPage> page; //similar to driver declaration
private IBrowser? browser;
public Driver()
{
...
0
votes
1
answer
58
views
How to make a variable global within the step definition file so the other steps can access them
I am trying to make special keys global so that they can be used in other steps within the step definition file for C# Automation. So my file looks like this:
[Binding]
public class ...
1
vote
1
answer
126
views
How to add logs to Extent Report for Specflow C# BDD tests?
From Step Definitions, I am unable to add logs to Extent report
I see only Given When Then Description in Report.
Specflow version - 3.9.74
C# - 7.0
NUnit3
Hooks.cs File:
[Binding]
public class ...
0
votes
0
answers
47
views
How to run each feature file with scenarios on different chrome instances parallelly?
The Problem:
I am using MSTest framework for running UI tests. I have 10 feature files each having at least 20 scenarios. I am able to run them successfully using a pipeline, but it takes around 4-5 ...
0
votes
0
answers
58
views
Hooks : BeforeTestRun and AfterTestRun are NOT running when running specflow tests
Created a Feature File
Added a Scenario with Given, When, Then
Created a Hook File and added all hooks like [BeforeTestRun], [BeforeScenario], [BeforeStep] etc..
Inside each hook method I have added a ...
0
votes
0
answers
25
views
Can I create a mock service for a card transaction workflow that bypasses the need for the physical card machine to test?
I have a card payment work flow that utilizes multiple API endpoints in it's workflow to start a transaction ask the customer if they are paying with card/cash prompts the user to tap the card payment ...
0
votes
1
answer
28
views
Can't use Excel datasource in specflow, it is not working
My specflow with excel not working .I used the code like below:
Feature: Calculator

Simple calculator for adding **two** ...
0
votes
0
answers
23
views
Silent casting invalid bool values from table
When parsing a table with bool values, I get a silent conversion to false for values that can't logically be parsed.
Using the following step:
When I send a POST HTTP request to store/order with very ...
0
votes
0
answers
44
views
NUnitRetry.SpecflowPlugin doesnt work with Selenium Errors with NUnit and Specflow
I have a Specflow and NUnit automation project using Selenium in c#. My issue is that we are using NUnitRetry.SpecflowPlugin for retries. This works fine if the test fails on an NUnit Assertion, but ...
0
votes
0
answers
26
views
How to access page in AfterTestRun hook
I want to create after test run rook to clean data after run.
For AfterScenario hooks I'm using ScenarioContext from injection:
public Hooks(ScenarioContext scenarioContext)
{
_scenarioContext = ...
0
votes
1
answer
39
views
Running a single specflow test starts the entire test suite
I am having a specflow test suite in C# that is running through visual studio. The problem is that recently I started having some issues with running the test. Every time I start a test, instead of ...
1
vote
0
answers
68
views
How to mock authentication in .Net core using TestServer / Specflow
I have a .net 7 api that i tried to test cover using Specflow/xUnit but i cannot seem to mock the authentication for my api.
I always receive Unauthorized on my authenticated endpoints.
The .net 7 api ...
0
votes
0
answers
36
views
What is the exact way we can print logs using log4net and specflow with .net 6.0
I want to print logs to separate file in my existing project which created using Specflow with .NET 6.0.
Can someone explain to me how it needs to be done?
I have tried the below steps but not worked.
...
0
votes
1
answer
69
views
How to pass json body through cucumber steps in C# and Cucumber
I need to send the below jsons through the cucumber feature file,
So Like to know what would be the exact way I can define the json bodies under cucumber data table.
Even I tried to define as plain ...
1
vote
3
answers
518
views
OpenQA.Selenium.WebDriverException : Cannot start the driver service on http://localhost:60975/ error using SpecFlow in C# and ChromeDriver
Environment settings:
Target Framework - 6
Selenium.WebDriver.ChromeDriver -115.0.5790.17000
Selenium.WebDriver - 4.11.0
Chrome Version - 115.0.5790.171
I am trying to launch the chrome driver and ...
1
vote
1
answer
85
views
Intermittent WebDriverException when running Winappdriver/appium Automation test in MS Hosted Agent ('windows-2022')
Brief background:
Automating a winform application using WInAppDriver/Appium.
Using Specflow's BDD to define tests
At every start of test the automation test will always check if App is open already, ...
0
votes
1
answer
214
views
How to test different browser using specflow and Playwright (cross browsing)
I'm new on Playwright and specflow, i would like to know what's the best approach for testing scenario on all browser (chromium, firefox, webkit).
The current project used Selenium, but now we want to ...
1
vote
1
answer
52
views
Specflow API Testing with Dynamic Values
When I have a Specflow definition file like the below
Given these products exist
| Sku | Name | Price |
| BOOK1 | Atlas Shrugged | 25.04 |
| BOOK2 | The Fountainhead | 20....
0
votes
0
answers
29
views
SpecFlow LivingDoc throwing syntax error when generated on Azure Hosted Agents
We are currently using the LivingDoc CLI tool to generate our .html report in an Azure DevOps release pipeline. We don't want to use the Azure DevOps plugin because it doesn't retain historical ...
1
vote
0
answers
61
views
Specflow scenario fails on the line X but says that if has failed on the last line of the scenario
I have a test on Specflow that now fails due to a bug.
Let's say it fails on line 5 of the scenario file, yet failure stacktrace says that it fails on the last line of the scenario (8).
It started ...
0
votes
0
answers
27
views
Extentreports suddenly not generating Dashboard with certain scenario outline with a tag
Currently I have extentreport implemented in my SpecFlow/Selenium solution. It is still generating the html file for me and showing me results per test case, but suddenly it stopped generating the ...
0
votes
0
answers
29
views
Hi, I am using extent report in specflow+c#, i want to print my API response in extent report in Then step, but I am not sure how do I do that
I want to print details of my API response like statusCode, StatusMessage and more importantly response content(JSON format) in my extent report of specflow project.
Can anyone please give me solution ...
0
votes
1
answer
58
views
How to structure a SpecFlow project?
So I really like Specflow, but as the project gets more complicated I fail to see how to do things in an organised way.
I know there are solutions like Scopes, ScenarioContext, and Feature context, ...
0
votes
0
answers
89
views
Issue running SpecFlow under Docker
I have an API test suite written using SpecFlow. When run from VS, it works fine. I've tried creating docker image and running dotnet test command there, but I get following error:
PS /source/...
0
votes
0
answers
44
views
Unable to read data from Specflow feature file Table
I am new to Specflow. While reading data from feature file data table I am getting error:-
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : 'object' does not contain a definition for 'Type'
...
0
votes
0
answers
15
views
How can xunit+SpecFlow be configured to not include skipped/ignored scenarios in pass rate calculation
My Jenkins job is using a dotnet test command with --logger:html parameter.
When I look at my report, the results are shown as something like:
Total tests
715
Passed : 530
Failed : 89
Skipped : 96
...
0
votes
1
answer
65
views
How to efficiently write features using specflow?
I am working on a SpecFlow project in C#, and I want to make the process of adding scenarios more user-friendly for non-technical individuals, such as product owners. Currently, the process involves ...
2
votes
2
answers
184
views
Send command line arguments to specflow tests
I have a feature files as part of specflow project. The environment in which i need to execute the specflow tests is taken from the parameter mentioned in "appsettings.json".
I want to run a ...
1
vote
0
answers
124
views
Using SpecFlowPlus@0 in YAML pipeline, the project name is getting ommitted from the path to the testAssembly
I am getting this error even when I hard code the entire path from the volume to the file.
Error: Cannot find the specified testAssembly: D:\Agent_work\2\s\bin\Debug\net6.0\company_com.dll
##[error]...