Reqnroll Version
2.4.0
Which test runner are you using?
MSTest
Test Runner Version Number
2.4.0
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
{
"$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
"bindingAssemblies": [
{
"assembly": "Credentials.UI.Integration.Tests"
}
]
}
Issue Description
While converting specflow tests to Reqnroll, I came across this exception. The same has worked fine with specflow but somehow vausing triuble when migrated tests from specflow to reqnroll. Build worked fine. Issue while running scripts.
Error: Unable to access test execution dependent service 'Reqnroll.TestThreadContext' with the Reqnroll.Microsoft.Extensions.DependencyInjection plugin. This service is only available once test execution has been started and cannot be used in '[BeforeTestRun]' hook.
Any help would be much appreciated.
Below is the code written for hooks.cs
[Binding]
public sealed class Hooks
{
private static TestContext _textContext;
public Hooks()
{
}
[BeforeTestRun]
public static void BeforeTestRun(TestThreadContext threadContext, IConfiguration configuration)
{
_textContext = threadContext.TestThreadContainer.Resolve<TestContext>();
if (_textContext.Properties.Contains("Environment") &&
_textContext.Properties["Environment"].ToString() == "dev")
{
threadContext.Add("portal", configuration["portal:url"]);
}
else
{
}
}
[AfterScenario]
public void AfterScenario(BrowserDriver browserDriver)
{
browserDriver.Current.Close();
browserDriver.Current.Quit();
}
}
}
Steps to Reproduce
- Build works fine
- Issue when running the tests
Link to Repro Project
No response
Reqnroll Version
2.4.0
Which test runner are you using?
MSTest
Test Runner Version Number
2.4.0
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
{ "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json", "bindingAssemblies": [ { "assembly": "Credentials.UI.Integration.Tests" } ] }Issue Description
While converting specflow tests to Reqnroll, I came across this exception. The same has worked fine with specflow but somehow vausing triuble when migrated tests from specflow to reqnroll. Build worked fine. Issue while running scripts.
Error: Unable to access test execution dependent service 'Reqnroll.TestThreadContext' with the Reqnroll.Microsoft.Extensions.DependencyInjection plugin. This service is only available once test execution has been started and cannot be used in '[BeforeTestRun]' hook.
Any help would be much appreciated.
Below is the code written for hooks.cs
Steps to Reproduce
Link to Repro Project
No response