SpecFlow
SpecFlow copied to clipboard
StepArgumentTransformation Async/Await support
I'm trying to implement async/await all the for transform method decorated with
Before
[StepArgumentTransformation]
public Device TransformDevice(Table table)
{
return this.TransformDevices(table).FirstOrDefault();
}
After
[StepArgumentTransformation]
public async Task<Device> TransformDeviceAsync(Table table)
{
return (await this.TransformDevicesAsync(table)).FirstOrDefault();
}
However, it fails and errors out while doing table to Device transform. The same synchronous version works fine. Would like to if async is supported all the way?
SpecFlow Version:
- [ *] 2.3
Used Test Runner
- [ ] Xunit
Version number:
Project Format of the SpecFlow project
- [ ] Classic project format using
<PackageReference>
tags
.feature.cs files are generated using
- [ ]
SpecFlow.Tools.MsBuild.Generation
NuGet package
Visual Studio Version
- [ ] VS 2019
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settings
- [ ] Disabled
Are the latest Visual Studio updates installed?
- [ ] Yes
.NET Framework:
- [ ] >= .NET 4.5
- [ ] before .NET 4.5
- [ ] .NET Core 2.0
- [ ] .NET Core 2.1
- [ ] .NET Core 2.2
- [ ] .NET Core 3.0
- [ ] .NET Core 3.1
- [ ] .NET 5.0
Test Execution Method:
- [ ] Visual Studio Test Explorer
<SpecFlow> Section in app.config or content of specflow.json
Issue Description
Steps to Reproduce
Repro Project
Did you try it in SpecFlow 3.5? I am not sure when we added the first support for async/await.
No but as per https://stackoverflow.com/a/40038944 it was added in 2.2 so I thought it’d work.
Analyzed and this is still a problem with v4.0 beta, because the transformation infrastructure does not realize that the method with return type Task<Device>
can be used to get the parameter of type Device
.
Looking into it...
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.