Error running Nunit test routine by command prompt

Asked

Viewed 44 times

-2

The following error is shown when executing the command:

NUnit.Engine.NUnitEngineException : The path specified in --result TestResult.xml could not be written to
  ----> System.UnauthorizedAccessException : O acesso ao caminho 'C:\Windows\System32\TestResult.xml' foi negado.

--NUnitEngineException
The path specified in --result TestResult.xml could not be written to
   em NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
   em NUnit.ConsoleRunner.Program.Main(String[] args)
--
UnauthorizedAccessException
O acesso ao caminho 'C:\Windows\System32\TestResult.xml' foi negado.
   em System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   em System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   em System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   em NUnit.Engine.Services.NUnit3XmlResultWriter.WriteResultFile(XmlNode resultNode, String outputPath)
   em NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)

The test file . dll path is correct, but the test is not run. How to fix this error?

  • by the error seems to be an authorization problem for writing (trying to write something in system32 is kind of weird anyway), but I believe it will solve if you open cmd as admin

  • As mentioned the error is permissible... but why the hell are you willing to write testresult in that directory?

  • It was not I who "devils" set up this path. Nunit has already set the default. The --work= command can be used to define the destination folder. But thanks for the help.

1 answer

0

The --work= command can be used to define the destination path where Nunit will save the test file. The command prompt looks like this:

nunit3-console C:\Users\bruno.silva\Desktop\ProjetoTeste\bin\Debug\ProjetoTeste.dll --work=C:\Users\bruno.silva\Desktop\ProjetoTeste\Output\TestResult.xml

Browser other questions tagged

You are not signed in. Login or sign up in order to post.