Is there a way to parameterize a feature the same thing with a scenario using scenario outline
Hello,
I was wondering if it is possible to run the tests under a certain feature using different parameters. My point is that I know there is something called scenario outline which allows running the same scenario multiple times. Is there something similar for the feature. I found this as a limitation in specflow.
-
If you're using the SpecFlow+ runner you can use targets in your profile to run all the tests multiple times
https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Targets.htmlWe use these in UI tests to run in multiple browsers.
You can also use the filtering to target just particular scenarios/features using tags if you need more granular control
1 -
Thank you for your reply, I was looking at a unique resource online but it wasnt clear enough how to use target. If let us say I have scenarios tagged with @test. I created 2 targets in the profile let us say as follows:
<Targets>
<Target name="chrome">
<Filter>test</Filter>
</Target><Target name="firefox">
<Filter>test</Filter>
</Target>
</Targets>Then any test tagged with @test will run 2 times? I am trying it but it is not working. If I want to do some setup based on the target name how would I do that? I have seen the DeploymentTransformationSteps but not sure how to specify them do I add them for each target and filter based on System.Environment.GetEnvironmentVariable and do I need to specify the DeploymentTransformation in the app.config file
0 -
I have another question, I am using specflow with nunit do I need to do additional step to activate spec flow with runner after installing the nuget package. It looks like I can't see the appropriate message in the console which indicates that specflow+runner is running successfully
0 -
Here is an example of how we use targets
<Target name="Chrome">
<Filter>@AllStandard | @Chrome90 | @Chrome_Latest</Filter>
<DeploymentTransformationSteps>
<EnvironmentVariable variable="browser" value="chrome" />
<EnvironmentVariable variable="version" value="90.0.4430.85" />
</DeploymentTransformationSteps>
</Target>if the targets don't seem to be working make sure your profile is correctly set up, you may need a runsettings file to point to your profile.
The docs should help you out on that
https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Profiles.htmlyes when you first run there will be an activation link in the test output console which you will need to follow to activate it. If you can't see the message you may have already activated and be having issues with your profiles.
0 -
Hello,
To explain what I did from the beginning. I have specflow version 3.8.14 installed with Specflow.nunit and specflow.Tools.MsBuild.Generation packages as well. All what I did is that I installed SpecRun.Runner version 3.8.12 and after I rebuild my solution the first time I didn't see any activation link so Does this mean that spec runner is not activated yet? I did what you suggested by adding runsettings file under the root directory where the solution reside. The file contains the following content:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<Profile>
Default.srprofile
</Profile>
</RunSettings>But I still don't see any link activated not sure why. Do I need to go through the process of manually clicking on a link to activate? I thought I can directly use Runner because if I want to merge my code into a certain repo do I need to have the activation done on every machine where the code reside?
0
Please sign in to leave a comment.
Comments
5 comments