Specflow: Specflow+Runner Specrun doesn't support TestRunParameters

Created on 23 Mar 2017  路  14Comments  路  Source: SpecFlowOSS/SpecFlow

Specflow+Runner Specrun doesn't support TFS 2015 Secret Variables:

In a TFS 2015 build definition it's possible to set Variables. These variables are also set as environment variabeles on the agent, and so usable in Specflow / Specrun tests.

https://www.visualstudio.com/en-us/docs/build/define/variables

TFS 2015 also supports Secret Variables, these can be passed into the test run with Override Test Run Parameters. Very usefull for example for passwords used in tests. They are not set as enviroment variables .

If I set a secret variable in TFS it can override my TestRunParameters set in .runsettings, for example:

#defined in runsettings file:
 <TestRunParameters>
    <Parameter name="password" value="nothing yet" />
  </TestRunParameters>

In the Visual Studio Test task in TFS 2015 : Override TestRun Parameters : password=$(Secret_Password_Variable)

When using MsTest as test runner I can access this variable trough : Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Properties['password']

However, Specrun doesn't support the TestRunParameters, and therefore also not the overrided parameters from TFS. The TestContext is only available when the Specflow tests run with the MsTest unitTestProvider, and not with SpecRun.

Feature-Request SpecFlow+

All 14 comments

The TestContext is MsTest specific, so it does not exists when the scenarios are executed by the SpecFlow+Runner.
But I will think about a way to get this parameters available if you are executing the scenarios with the SpecFlow+Runner.

Agree, if the parameters are available that would be great. I don't know the implementation from TFS when overriding the TestRunParameters, but somehow getting that (secret) variabeles from TFS into Specrun would be a great addition.

I was just looking for exactly this. Any news on this?

This indeed would be very helpful !
However, is there a way to specify custom parameters inside TestProfile file ?
It would be very helpful to pass for example the browser type for end to end automated testing with selenium.

@PierreRoudaut: I suspect this example would answer your question.

It would be extremely useful if this could be done for Nunit as well.

@adzpond Supporting TestRunParameters is job of the test runner. This issue is about adding it to the SpecFlow+Runner. If the NUnit Runner did not have this feature yet, please open a feature request at their repository. This issue is only about the SpecFlow+Runner (as seen in the labels).

@SabotageAndi Appologies, it's been a long day. I've read through the notes again. I see what your saying. It is what I'm actually looking to do. I'm able to do this with specflow+ because of the ability to reslove the mstest test context. I was hoping for similar functionality with the NUnit test context.

The ability to access via Specflow+Runner would be perfect.

Hi Team,

Any update when this feature will be released? It seems to be open for more than 2 years now.
Thanks

We are currently developing two bigger features for SpecFlow and SpecFlow+ (one is .NET Core 3.0 support). After that we have this feature request currently in our backlog.

hey, any updates on this issue? and regarding TestContext object support?

No updates on this.

To make it easier for you all to vote on feature requests and influence our prioritization of them in our backlog, we created in our new support tool a special forum to have a better overview of all of them. We moved this feature request there and you can find it here. Sadly we could not take over the existing votes. So if you are still interested in this feature request, please vote again on the new list.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings