Closed echarrod closed 4 years ago
In typical fashion, I've been stuck on this for days and then right after I post the issue, I manage to fix it.
I removed the package SpecRun.SpecFlow
, and added SpecFlow.MsTest
, and now it works
👍
You had using the SpecFlow+ Runner. One dependency to use it on Linux is to have mono installed. This is needed for the report generation. An alternative is to disable the report generation.
As you found a solution an this is the correct behavior (the error could be better), I am closing this issue.
@SabotageAndi How do I disable report generation ? I think I have similar problem and disabling reports might help.
I would first try to install the Mono dependency to get it work, because you are losing a key feature of the SpecFlow+ Runner.
Disabling the reporting is documented here: https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Report.html
@SabotageAndi I just spent many hours trying to figure out the cause of this same issue. Only real difference is I am using the latest version of the NuGet pkgs, WSL 2, and netcore 3.1
It would be rad if there was some way to have a better error.
@GoFightNguyen And you fixed it with installing Mono?
@SabotageAndi I don't want to have a dependency on mono, so I did not attempt to install it. Maybe it is because my local repo is in WSL 2 and/or because I am using VS Code (so unable to use the Visual Studio SpecFlow extension), but I had issues using mstest with SpecFlow too. At this point, I need to move on with the project so I decided to leave SpecFlow (for now) :(
I also still have this issue. Mono (v 6.12.0.90) is already installed on system , as I am using VS for mac. Here is the full error
2020-10-12T10:00:05.8325780-04:00:Executing test executor at '/usr/bin/dotnet' 'exec “/Users/../../TestApplication.UiTests/bin/Release/netcoreapp3.1/SpecFlowPlusRunner/netcoreapp3.1/TechTalk.SpecRun.Framework.Executor.anycpu.netcoreapp3_1.dll” --remoteRunnerPid 23140 --uniqueId "2020-10-12T100005" --outputFolder “/Users/../../TestApplication.UiTests/obj/TestResults” --callbackPort 32768 --loggerPort 32769' in ‘/Users../../TestApplication.UiTests/bin/Release/netcoreapp3.1’
2020-10-12T10:00:05.8733140-04:00:System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
@SabotageAndi <Report disable="true"/>
isn't respected. I have added it to the default.srprofile, and when i'm running the tests in a docker container, the logs state:
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Starting external program: "mono" "/app/bin/Release/netcoreapp3.1/SpecFlowPlusRunner/net461/SpecFlow.Plus.Runner.Reporting.exe" "/tmp/tmpEPWiA7.tmp" in /app/bin/Release/netcoreapp3.1
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at TechTalk.SpecRun.Framework.ProcessHelper.RunProcess(ProcessStartInfo processStartInfo)
at TechTalk.SpecRun.Framework.Services.ExternalProcessTestRunResultReporter.Report(TestRunResult result, TestProfile testProfile)
at TechTalk.SpecRun.Framework.Execution.ExecutionEngine.ExecuteTestSuite(TestProfile testProfile, TestRunExecutionConfiguration executionConfiguration, IObjectContainer parentObjectContainer, IExecutionContainerBuilder containerBuilder)
at TechTalk.SpecRun.VisualStudio.TestAdapter.Execution.SingleSourceTestExecutor.ExecuteTestSuiteSync(IExecutionEngine executionEngine, TestProfile profile, TestRunExecutionConfiguration testRunExecutionConfiguration, IObjectContainer parentObjectContainer)
at TechTalk.SpecRun.VisualStudio.TestAdapter.Execution.SingleSourceTestExecutor.ExecuteTestSuite(IExecutionEngine executionEngine, TestProfile profile, TestRunExecutionConfiguration testRunExecutionConfiguration, IObjectContainer parentObjectContainer)
at TechTalk.SpecRun.VisualStudio.TestAdapter.Execution.SingleSourceTestExecutor.Run(String source, FilterItem filter)
at TechTalk.SpecRun.VisualStudio.TestAdapter.Execution.MultiAssemblyTestExecutor.Run()
at TechTalk.SpecRun.VisualStudio.TestAdapter.Execution.CommonTestExecutionWrapper.Run()
An exception occurred while invoking executor 'executor://specrun/executorV3.5.22': No such file or directory
I installed mono using apt-get, like so:
RUN apt-get update RUN apt-get install -y mono-complete
Which works successfully. However, I thought I would point out that the disabling of reports doesn't seem to change anything.
@ZukkyBaig Linux is case-sensitive for filenames. The Filename has to be Default.srProfile
. With your filename we fall back to default values. We never have a look at this file.
Is a way to split report generation?
"mono" "/app/bin/Release/netcoreapp3.1/SpecFlowPlusRunner/net461/SpecFlow.Plus.Runner.Reporting.exe" "/tmp/tmpEPWiA7.tmp"
To SpecFlow.Plus.Runner.Reporting.exe as a parameter is passed file /tmp/tmpEPWiA7.tmp
, so I would like to run dotnet test
and as a result, get this file
Is it possible?
@adrusz No, this is not possible at the moment. What do you want to achieve? And did you had a look at SpecFlow+ LivingDoc?
My goal is to generate a report from test execution in cucumberJson format (then it will be imported to Jira XRay) For now, I solve this problem with some workaround
FROM mcr.microsoft.com/dotnet/sdk:5.0 as dotnet
COPY [ "./", "/src"]
WORKDIR /src
RUN dotnet restore ./TestSpecFlow.SpecRun.csproj
RUN dotnet build ./TestSpecFlow.SpecRun.csproj
RUN rm /tmp/* -R
RUN dotnet test ./TestSpecFlow.SpecRun.csproj; exit 0
FROM mono:latest as mono
COPY --from=dotnet [ "/src/bin/Debug/net5.0/SpecFlowPlusRunner/net461", "/Reporting"]
COPY --from=dotnet [ "/src/CucumberJson.cshtml", "/Templates/CucumberJson.cshtml"]
COPY --from=dotnet [ "/tmp/tmp*.tmp", "/Reporting"]
WORKDIR /Reporting
RUN mono ./SpecFlow.Plus.Runner.Reporting.exe ./tmp*.tmp
But dotnet test
is failed because report generating is enable, otherwise file /tmp/tmp*.tmp
will not be generated
@adrusz What is hindering you to install mono in your docker image for test execution? Then you get the report directly out to the execution and there is no need to split something up.
@SabotageAndi I tied but then I had some NullReferenceException
from SpecFlow.Plus.Runner.Reporting.exe
@adrusz As we are discussing this in an already closed issue, let's move us this to a new issue or the community forum. We are spamming 4 people with notifications at the moment.
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.
SpecFlow Version:
Used Test Runner
Version number: dotnet version: 3.1.202
Project Format of the SpecFlow project
packages.config
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation
NuGet packageSpecFlowSingleFileGenerator
custom toolVisual Studio Version
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settingsAre the latest Visual Studio updates installed?
<Major>.<Minor>.<Patch>
.NET Framework:
Test Execution Method:
dotnet test
<SpecFlow> Section in app.config or content of specflow.json
specflow.json:
Issue Description
Tests run fine both when I run through Visual Studio and from command line with
dotnet test
on a Windows machine. When I push to our CI system, which uses a linux based docker image:mcr.microsoft.com/dotnet/core/sdk
, which essentially just does this in the container:the tests look like they pass, but then I get the following error:
I've tried: 1) Using .NET Core 2.2 instead of 3.1 2) Using Microsoft.NET.Test.SDK 16.5.0 instead of 16.6.1 3) Using the preview versions of the Specflow packages, but since they aren't all available through Visual Studio, it doesn't seem possible to use them at the same time
My csproj:
Steps to Reproduce
To follow