-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An exception occurred in the driver while loading tests. #270
Comments
I have compiled my SampleNUNIT.dll with the following command: mcs SampleNUnit.cs -target:library -r:NUnit.3.7.1/lib/net40/nunit.framework.dll -out:SampleNUnit.dll |
What version of Mono do you have installed? We've had issues with several recent 4.x and 5.x releases, although different than that. Can you also try running with the Does it help if you run |
I am running Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4) The -inprocess flag returns: An exception occurred in the driver while loading tests. Running "mono nunit3-console.exe" does not change the outcome. Any other recommendations? |
Give me a bit. I am trying to repro on my Linux box, but MonoDevelop is refusing to add NuGet packages to my new project. As I said, Mono hasn't been very stable for us recently |
Compiling in a docker container the same way that you did give me a different but similar error using Mono 5.0.1.1. I think it is something to do with the way you are compiling. Is there a reason you aren't compiling the project, but just a single file?
|
If however I compile the solution and run the tests on that, it works fine. I expect that there are settings that need to be set for
Then,
|
I am going to close this issue as a question. If you need further help, just post here. We will see it. |
Please reopen this. As outlined in https://stackoverflow.com/questions/45291234/running-nunit-tests-on-ubuntu-an-exception-occurred-in-the-driver-while-loading there should be no reason not to use mcs. I am using Mono JIT compiler version 5.0.1.1 and get the same weird error message which does not make any sense to me. It looks like the issue is comparable to the situation a while ago at: https://stackoverflow.com/questions/12393425/on-osx-with-monodevelop-run-nunit-tests-from-terminal-command-line It would be great to have a working command line that does not use visual studio, xamarin or mono develop. |
@WolfgangFahl - please try using the console from this PR: #304 - you can either build the source, or find a package here: https://ci.appveyor.com/project/CharliePoole/nunit-console/build/3.8.0-ci-03798-issue-228b/artifacts This won't solve the problem, but should give you a more in depth error message so you can diagnose better. |
I agree that it should be possible to build with simple Mono commands on Linux, without using xamarin or monodevelop. Some of our discussion of Linux support has become derailed - at least in my view - by focusing on how "escapees" from the Microsoft world typically build when working on Linux. But long-time users of Mono on linux typically use a command-line to build one file at a time and then link the object files together, generally as part of a script that provides a functional equivalent to a project file. We could tell those folks we don't support the old methods, of course, but since distros like Debian that require building the packages they distribute from source actually build NUnit itself in that way, it's really in our interest that it should continue to work. As the @nunit/core-team members already know, I plan to work separately on Linux support after my transition out of the NUnit team is complete. |
@ChrisMaddock and @CharliePoole with the result below. Unfortunately this project is not in my focus right now and my resources for it are too limited to follow a side track like this. I had hoped that with just a few lines of code things would work. The build script at this time is:
and the test script ist:
I tried to use a fritztest.csproj file and msbuild but that format is far more complex than the few lines above. E.g. i am trying to add an NUnit reference according to mono version
output
|
I have worked around the issue with https://github.com/WolfgangFahl/fritz-csharp-api/blob/master/fritzsimpletest.cs - i now feel foolish since i only needed to show a few comparisons and this is easily done with a single checkMD5 function. |
I've spent several days trying to solve this issue as well, but only there isn't enough information how to use Mono and NUnit using only command line on Linux. So, I've tested in Ubuntu 17.10 and Docker with Alpine 3.7 and I've used some extra environment vars to specify in export MONO_PATH, where mono should find this post was very useful to find a solution. I hope this information is useful. Example
folder structure
script.sh#!/bin/bash
#Make sure the mono is finding those assemblies first
CLASSES=~/csharp/classes
TESTS=~/csharp/tests
TOOLS=~/csharp/vendor/NUnit.ConsoleRunner.3.7.0/tools
NET=~/csharp/vendor/NUnit.3.9.0/lib/net45
export MONO_PATH=$CLASSES:$TOOLS:$NET
$mcs $CLASSES/HelloWorld.cs -t:library
$mcs $TESTS/HelloWorldTest.cs -r:$NET/nunit.framework.dll,$CLASSES/HelloWorld.cs -t:library
mono $TOOLS/nunit3-console.exe HelloWorldTest.dll execute script
output
Extra informationInformation about Mono, NUnit and NUnit.Runners on Ubuntu
================ Information about Mono, NUnit and NUnit.Runner on Docker with Alpine using Docker Alpine glibc
|
Please reopen this issue. It is a pitty if it is not tracked as such. |
@WolfgangFahl I would be happy to re-open the issue if it is an NUnit problem and not a configuration problem. @davidenq managed to get it working above. When you compile, is the referenced nunit.framework.dll assembly copied into the same directory as your test.dll? Are other referenced assemblies? If not, do the tests run if you manually copy the files in? |
As for the debian compile from source issue, that is separate, this issue talks about compiling test assemblies from the command line, not compiling NUnit from the command line. Besides, Debian hasn't released a version of NUnit since 2.6.4, https://packages.debian.org/search?keywords=nunit&searchon=names&suite=stable§ion=all. It isn't recent changes that caused that. |
@rprouse Actually, I have neither copied nor moved any *.dll assembly from its own folder to another directory. I've only referenced from my script to the nunit.framework.dll assembly and all my tests there have been executed without any error. See the above example (the script and folder structure), nothing is moved, it's only done references. |
@davidenq if I am reading your issue right, you had to add environment variables so that |
Normally, when you compile a |
I guess that those assemblies are not copied into the build directory. At least, I have not seen that that happen. But, I going to do new tests to verify what is the real behavior. I guess that it will be more useful share with you a dockerfile file preconfigured with Mono, NUnit and scripts to test. What do you think? |
@davidenq the NUnit console needs to be able to find the framework DLL and load it to run your tests, so it needs to be in the probing path. The most common place for that is in the same directory as the test assembly. Building with MSBuild or XBuild performs that step for you, although it might be You can compile NUnit tests with If you want to figure this out and document it, I would be happy to change this to a documentation issue and turn it over to you. To me, it isn't much different than C++. I can compile and link individual CPP files, but would never do that. Even for smaller projects I would use a simple make file. I compile at the command line all the time, but I would still rather type; nuget restore .\NUnitCommandLine.sln
MSBuild.exe .\NUnitCommandLine.sln /t:build than, C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference
:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorl
ib.dll" /reference:C:\src\Spikes\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\
v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NE
TFramework\v4.5\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Micr
osoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\NUnitCommandLine.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterpri
se\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /utf8output TestClass.cs Properties\AssemblyInfo.cs "C:\Users\rob.prouse\AppData\Local\Te
mp\.NETFramework,Version=v4.5.AssemblyAttributes.cs" Or the Even cleaning that up and removing unnecessary references leads to,
|
I think a preconfigured dockerfile that is maintained by the Nunit team would be a major asset. |
@WolfgangFahl how would the dockerfile work? Wouldn't you still need to modify the build steps to include different test files, modify references, etc? Or are you talking about a dockerfile to build NUnit itself? We have a batch file in the framework that builds NUnit in a Linux container, we could do something similar here. |
I have the following setup:
ubuntu@ip-172-25-250-228:~$ ./NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe SampleNUnit.dll -noresult
NUnit Console Runner 3.7.0
Copyright (c) 2017 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Linux 4.4.0.1020
CLR Version: 4.0.30319.17020
Test Files
SampleNUnit.dll
When I run the test I get the following:
Errors, Failures and Warnings
An exception occurred in the driver while loading tests.
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
at (wrapper remoting-invoke) NUnit.Engine.Agents.RemoteTestAgent:Run (NUnit.Engine.ITestEventListener,NUnit.Engine.TestFilter)
at NUnit.Engine.Runners.ProcessRunner.RunTests (ITestEventListener listener, NUnit.Engine.TestFilter filter) <0x40700ce0 + 0x000ae> in :0
Test Run Summary
Overall result: Failed
Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2017-07-24 21:39:48Z
End time: 2017-07-24 21:39:48Z
Duration: 0.404 seconds
I would appreciate any help.
The text was updated successfully, but these errors were encountered: