Good and excellent for VS 2012, but issues with VS2013: 01) Tests hang - the first one gets a green arrow but then nothing happens; 02) Test names are full qualified name in stead of just the method name.
Works fine with 2013. Essential to enable use of more common/free testing tools, e.g. when creating open/shared source solutions (people may want to open and run tests without the premium visual studio/MSTest version available).
I have VS 2012 Update 3.
I try to run my tests with xUnit.net runner 0.99.0 but no chance.
There is test output
------ Run test started ------
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)
at Xunit.TestClassCallbackHandler.OnTest(XmlNode xml)
at Xunit.TestClassCallbackHandler.OnXmlNode(XmlNode xml)
at Xunit.XmlNodeCallbackHandler.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
at System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
--- End of inner exception stack trace ---
I have a similar issue (using FsCheck) - my tests all pass so far but as soon as one test throws a exception I get a TargetInvocationException due to a NullReferenceException.
I checked/debuged the FsCheck code and the problem seems not to be in the our code there.
Here is a stacktrace (in german - sorry):
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei Xunit.TestClassCallbackHandler.OnTest(XmlNode xml)
bei Xunit.TestClassCallbackHandler.OnXmlNode(XmlNode xml)
bei Xunit.XmlNodeCallbackHandler.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
bei System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
bei Xunit.Sdk.ExecutorCallback.CallbackEventHandlerCallback.Notify(String value)
bei Xunit.Sdk.Executor.OnTestResult(ITestResult result, ExecutorCallback callback)
bei Xunit.Sdk.Executor.RunTests.<>c__DisplayClass12.<.ctor>b__11(ITestResult result)
bei Xunit.Sdk.TestClassCommandRunner.Execute(ITestClassCommand testClassCommand, List`1 methods, Predicate`1 startCallback, Predicate`1 resultCallback)
bei Xunit.Sdk.Executor.ThreadRunner(Object threadStart)
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, B
After upgrading to Version 0.99.0 from Version 0.9.5.4, my xUnit.net tests completely refuse to run. The first one gets a green arrow, and then nothing more happens. Tried creating a new empty solution. MsTests work fine. My development flow is now completely crippled! Is there a way to quickly downgrade?
I was able to download the ASP.NET WebStack source code, which contains ~ 14k tests written in xUnit.net 1.9.1, and they discovered and ran fine with the 0.99.0 runner in VS2013.
I then upgraded the tests to use xUnit.net 1.9.2, and once again, they all discovered and ran correctly.
Can either of you provide a repro project that demonstrates the problem you're having?
Hi, got the exactly same problem
i can reproduce on any solution - even empty, with an empty test method - co i guess it could be a visual studio configuration problem or something like that
when debuging i get an exception thrown after the end of the test
- details http://pastebin.com/uT3PH7hu
also couldn't find the symbols for xUnit 1.9.2 so i could debug further are they located anywhere public? (i know i could build mine, but that's not the same)
Thank you. The Codeplex link did the job, and now everything works ok again.
I can confirm that I get the same exception. I have provided the test project I used (although I can also reproduce this with ANY test). I have also provided an IntelliTrace file of the exception.
Please note that when running the test normally (not debugging it), no exception is reported. The test just hangs.
On a sidenote, the test NAME is different in the 0.99 version. Instead of just the local method name, I get the whole qualified method name. (Which pretty much makes it impossible to read the most significant part if you have Test Explorer docked in the default fasion.)
I can confirm that I have the same issues running VS2013 on Win8.1, xunit runner 0.99:
01) Tests hang - the first one gets a green arrow but then nothing happens;
02) Test names are full qualified name in stead of just the method name.
The TargetInvocation issue will be fixed in 0.99.1.
The test name will be configurable in 0.99.1 (and default back to the short name).
I an new to VS and xunit. I had created two tests in two separate files, when tried to run 'All Tests' only test present in one file got executed, other test didn't execute, can someone please let me know how to do that
We have solution with unmanaged c project that we test from managed c# code using xunit via c# interop wrapper. We're using tests that are defined as unsafe. After running tests and changing something in c# code build fails with following error: 'The command "copy C:\devel\project\Debug C:\devel\project\managed.Tests\bin\Debug\*" exited with code 1.'. Try to manually delete c:\devel\project\managed.Tests\bin\Debug\unmanaged.dll ends with system error 'Cannot delete file, because file is open in vstest.executionengine.x86.exe' (it may not sound like that in english version of windows, it's loose translation from my native language :)). The solution is to close visual studio and open it again, then build succeeds. Resharper runner works fine, on the other hand.
Thanks for awesome piece of software, we're using it extensively, it's the only problem we've with it.
Have you tried with the latest runner? This problem may be solved now through a different bug fix (we now automatically shut down the VS execution engine after running tests, which should unlock all DLLs).
I’m having a problem with running all xUnit.net tests in the solution. Test runner terminates with out of memory exception and in the Task manager I can see that vstest.executionengine.exe memory usage constantly grows and finally the process crashes. There are about 4000 tests, we are doing lot of mocking with Moq and ninject automocking kernel, somehow I suspect that's the guilty party for this.
But, when I try to run same tests inside Resharper Unit test session, all tests are run successfully without any excessive memory usage.
When the TFS build is configured to run the tests, same thing happens on the build server machine, out of memory.
My question would be, is there something we could configure so that VS test runner behaves the same as Resharper test runner so that we can run these tests as part of TFS build?
No, DeploymentItem is a feature of MSTest. xUnit.net does not support it.
There are two strategies you can use, since shadow copying is employed.
One is that you can locate files relative to the test assembly's CodeBase (the runner will make your bin folder the current directory when it runs your tests), but this has the problem of being somewhat fragile if you have tests which change the current directory. You can, of course, read the CodeBase property of the running assembly to find the path, and then find the files relative to that.
The other (and this is my preferred method) is to embed the content as a resource rather than setting it a content. Then you can read the contents of the resource directly using the resource APIs and not worry about where the content is located on disk.
Hi, is there any way to have access to the previous run's outputs ?
I dont know if they are stored somewhere, or where that would be.
Using process explorer, I see where the runner is located :
But there are no files in sight.
Is this possible to see Console output/Trace output from the test run?
I would like to test my NHbiernate queries and see the resulting SQL. Also I would like to see progress of db creation before test run
Click on the test in Test Explorer. The details window at the bottom of Test Explorer will include a link titled "Output". Click this, and you'll see any console/trace/debug output that was captured during the test run.
Unfortunately, the design of xUnit.net v1.x is that it buffers all output until the test is complete (a bad decision that we're fixing in v2). However, I'm not 100% sure how the VS test runner would surface live output, so when v2 is getting close to ready, we will need to reevaluate the runner code and see what can be done (for example, detecting that you're running inside of a debugger and dump everything to the Debug console live).
Honestly, I've never investigated the rules.
When xUnit.net creates the AppDomain for running your tests in, it uses the config file for the DLL by default. So, if you add an App.config file to your test project, during compilation that will get copied into the appropriate config file (for example, if your assembly is MyTests.dll, it will be get named MyTests.dll.config). The only thing I'm unsure about is whether .NET will take binding redirects from this config file, or only from the config file that launched the process.