5

I tried to run flaUiTests with the command prompt with the following command:

pathToConsole\nunit3-console.exe pathToApp\App.dll --testparam:App=pathToExecutable\App.exe

In the testcode I use the testparam with te following code:

string lParameterPathExecutable = TestContext.Parameters["App"];

I tested if the command prompt can find al the files and he can. Anyway, I get still the error: System.ComponentModel.Win32Excetion: The system cannot find the file specified.

Does anyone know what the problem is? What it's wrong with this command? The testcode is in VisualStudio2019 and the version of NUnit3-console is 3.12.0.

Edit: The nunit3-console can be found. The nunit3-console runs I think. This is the testresult:

System.ComponentModel.Win32Exception : The system cannot find the file specified
--Win32Exception
The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
   at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
   at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-02-10 21:26:08Z
    End time: 2021-02-10 21:26:08Z
    Duration: 0.145 seconds

Results (nunit3) saved as TestResult.xml
Doortjuh
  • 71
  • 8
  • From your question, it's not clear if (1) nunit3-console cannot be found (and doesn't run) or (2) nunit3-console runs (displays its header) but then gives an error that something can't be found or (3) nunit3-console runs and the error comes for a specific test that uses the parameter you set. Each of these is a different potential problem. – Charlie Feb 10 '21 at 19:37
  • @Charlie, I edited my question and try to give more information – Doortjuh Feb 10 '21 at 21:28
  • This looks like NUnit console is unable to find the appropriate agent to run. So we should know how you installed NUnit console (i.e. nuget, msi, etc.) and in case you did it by just copying files, what it's directory structure looks like. You may also get some more information by running with --trace=Debug and examining the logs created. – Charlie Feb 12 '21 at 01:29
  • @Charlie, that's better. But I got the next error: System.InvalidCastException: Unable to cast transparent proxy to type 'System.Web.UI.ICallBackEventHandler'. I read something about the version of the engine. But the version of the engine is already 3.12.0. – Doortjuh Feb 12 '21 at 08:50
  • When I changed the NUnit console and engine to version 3.11.1 and the TestAdapter to 3.17, I got still the System.InvalidCastException error. – Doortjuh Feb 12 '21 at 09:48

2 Answers2

1

I am experiencing the same issue after upgrading to version 3.12.0. Downgrading to 3.11.1 solved the issue, however not a permanent fix.

Orlando
  • 21
  • 2
0

I solved this issue by running the runner directly from the nuget package:

packages\\NUnit.ConsoleRunner.3.15.0\\tools\\nunit3-console.exe [params]

One of my collegues added this workflow before, which doesn't work with newer versions of NUnit.ConsoleRunner:

  1. post-build event: copy "$(SolutionDir)packages\NUnit.ConsoleRunner.3.15.0\tools\*.*" "$(TargetDir)
  2. Run bin\\Release\\nunit3-console.exe [params]
Darkproduct
  • 1,062
  • 13
  • 28