This is a migrated thread and some comments may be shown as answers.

xUnit tests not running

14 Answers 644 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ciaran O'Neill
Top achievements
Rank 1
Ciaran O'Neill asked on 20 Sep 2011, 03:45 PM
Hi,

I'm running JustCode 2011.2.916.0 on VS2010 x64.
I have just started a new project, added a test project and installed xUnit & FakeItEasy via nuget.
When I try to run my first test, JustCode is not running it.  The test appears in the unit test window, so the test runner understands that it is a test, but it has 0 pass, 0 failed, 0 ignored.

The icon beside the test just says Not Executed in the tooltip.  Do I have to do anything else to get JustCode to execute xUnit unit tests?

Thanks,
Ciaran

14 Answers, 1 is accepted

Sort by
0
Chris Eargle
Top achievements
Rank 1
answered on 20 Sep 2011, 11:53 PM
Can you provide more information about your tests? I set up a new project, added Xunit and FakeItEasy via NuGet, and it ran without any problems.
0
Ciaran O'Neill
Top achievements
Rank 1
answered on 21 Sep 2011, 12:22 AM
It's just a sample project I have in order to learn xUnit and FakeItEasy.  It's not doing anything special at all and the same code on my work pc runs with ReSharper configured for xUnit. (JustCode is installed on my home pc).  I have just started and so it has just 1 test:

public class AppointmentTests
    {
        private readonly IAppointmentManager appointmentManager = A.Fake<IAppointmentManager>();
        private readonly Appointments appointments;
 
        public AppointmentTests()
        {
            appointments = new Appointments(appointmentManager);
        }
 
        [Fact]
        public void UnderAgeUsersAreRefusedAppointment()
        {
            var user = new User { Age = Appointments.AgeOfConsent - 1 };
 
            var result = appointments.RequestAppointment(user);
 
            Assert.Equal(Result.UnderAge().ResultTextresult.ResultText);
 
            A.CallTo(() => appointmentManager.BookAvailableAppointment(user)).MustNotHaveHappened();
        }
    }
0
Chris Eargle
Top achievements
Rank 1
answered on 21 Sep 2011, 12:35 AM
I verified the issue and will send the project to the team for feedback.
0
Ciaran O'Neill
Top achievements
Rank 1
answered on 21 Sep 2011, 12:44 AM
Can you show me an excerpt of your code that you got to run successfully so that I can try and use a work-around while a bug fix is forthcoming?  Is it xUnit's test constructor or something that is causing the issue?
0
Chris Eargle
Top achievements
Rank 1
answered on 21 Sep 2011, 08:37 PM
I set up a simple test and didn't mock with FakeItEasy although I pulled it down with NuGet. Once I used your test code, the test failed.

I reopened the project today and found that your test is now working. Can you try reopening the solution and running the test again?
0
Ciaran O'Neill
Top achievements
Rank 1
answered on 21 Sep 2011, 11:43 PM
Hi,

I tried it again after a restart and re-opening Visual Studio and the same result - test not run.  When I try to debug the test, my breakpoint symbol appears as the one with the exclamation mark that usually appears when debug symbols are not loaded.

It there anyway that I can capture the output of JustCode attempting to run the test to send on to you?

Thanks,
Ciaran
0
Ciaran O'Neill
Top achievements
Rank 1
answered on 27 Sep 2011, 10:09 AM
Hi,

Just wondering if there is an update on this issue?  Will there be a patch released at some stage?

Thanks,
Ciaran
0
Yanaki Yanakiev
Telerik team
answered on 28 Sep 2011, 12:23 PM
Hello Ciaran O'neill,

Sorry for the delay we are still trying to reproduce your issue and it will be very helpful if you provide us information about the type of project in which you are adding the tests.
It will be even more helpful if you can send us a sample solution in which the issue is reproducible.
Thank you in advance.


Kind regards,
Yanaki
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ciaran O'Neill
Top achievements
Rank 1
answered on 03 Oct 2011, 02:11 AM
Hi,

I can't attach my zipped solution file as  zip file types don't seem to be allowed. But I have pasted all my code into the following link.  When I use the MS Test attributes, the test runner runs OK, but with xUnit attributes, it just doesn't run as indicated previously.

http://pastie.org/2629580

If there is somewhere I can upload a zipped solution file, let me know.

Thanks
0
Chris Eargle
Top achievements
Rank 1
answered on 03 Oct 2011, 02:49 AM
Thanks for posting the code, Ciaran!

The issue is that the tests are contained in an inner class. Put the methods in the outer class (xUnitStartTests) and it should work.
0
Ciaran O'Neill
Top achievements
Rank 1
answered on 03 Oct 2011, 11:21 AM
That was an oversight on my part alright, but even if I remove the inner class the test is not being run, however the exact same test with the ms test attributes runs :/

So now my test is as follows and doesn't run.

namespace xUnitTestProject
{
    public class xUnitStartTests
    {
        private readonly IAppointmentBooker appointmentBooker = A.Fake<IAppointmentBooker>();
        private Appointments appointments;
 
        [Fact]
        public void UnderAgeUsersDoNotGetAnAppointment()
        {
            appointments = new Appointments(appointmentBooker);
 
            // Given
            var user = new User { Age = Appointments.AgeOfConsent - 1 };
 
            // When
            var result = appointments.RequestAppointment(user);
 
            // Then
            Assert.Equal(Result.UnderAge().Message, result.Message);
            A.CallTo(() => appointmentBooker.BookFirstAvailableAppointment(user)).MustNotHaveHappened();
        }
    }
}
0
Blagoev
Telerik team
answered on 05 Oct 2011, 03:50 PM
Hi Ciaran O'neill,

I tried to reproduce the problem and unfortunately the issue is not showing on my environment. I downloaded  xUnit from NuGet as described on a clean project, did the same test as you and the test runs fine. Can you send us the JustCode log files so we can look into it to see if there are any messages regarding this problem. The logs are in %USERPROFILE%\AppData\Local\JustCode\logs. Zip all the files there and send us the file. 

Kind regards,
Blagoev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ciaran O'Neill
Top achievements
Rank 1
answered on 06 Oct 2011, 01:32 PM
Hi,

I have solved this issue.  Looking at the log files, the test runner could not find the xunit.dll as having been installed via nuget it was set to CopyLocal=false in the the test project.

This fails silently in the UI with the following taken from the log file:

2011-10-06 23:29:25.413: Unhandled Exception [HResult: 80070057] 
System.ArgumentException: Could not find file: C:\Users\Ciaran\Documents\Visual Studio 2010\Projects\Console\xUnitStart\Tests\bin\Debug\xunit.dll
   at Xunit.ExecutorWrapper..ctor(String assemblyFilename, String configFilename, Boolean shadowCopy)
   at Telerik.JustCode.UnitTesting.XUnit.Runner.XUnitRunner.RunTestTask(UnitTestRunTask testRunTask) in c:\B10\Manticore\Production2010_Release\Sources\UnitTesting.XUnit.Runner\XUnitRunner.cs:line 78
   at Telerik.JustCode.UnitTesting.TestExecutor.CurrentAppDomainHost.Execute(UnitTestRunTask task)
   at Telerik.JustCode.UnitTesting.TestExecutor.Executor.<>c__DisplayClass1.<Main>b__0() in c:\B10\Manticore\Production2010_Release\Sources\UnitTesting.TestExecutor\Executor.cs:line 70
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Log Site Stacktrace:
   at Telerik.JustCode.Common.Logging.ExceptionInfo..ctor(Exception exception, String message) in c:\B10\Manticore\Production2010_Release\Sources\Logging\ExceptionInfo.cs:line 16
   at Telerik.JustCode.Common.Logging.LogService.LogException(Exception ex, String message) in c:\B10\Manticore\Production2010_Release\Sources\Logging\LogService.cs:line 103
   at Telerik.JustCode.UnitTesting.TestExecutor.Executor.CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e) in c:\B10\Manticore\Production2010_Release\Sources\UnitTesting.TestExecutor\Executor.cs:line 92
   at Telerik.JustCode.UnitTesting.TestExecutor.CurrentAppDomainHost.Execute(UnitTestRunTask task)
   at Telerik.JustCode.UnitTesting.TestExecutor.Executor.<>c__DisplayClass1.<Main>b__0() in c:\B10\Manticore\Production2010_Release\Sources\UnitTesting.TestExecutor\Executor.cs:line 70
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Thanks for all your help,
Ciaran
0
Blagoev
Telerik team
answered on 07 Oct 2011, 12:31 PM
Hi Ciaran O'neill,

 It's good to know it's working again for you. Don't hesitate to send us more issues if you find anything blocking your work. We will be glad to help. As for the problem we will be adding a more meaningful message to the Test Runner so such issues are more easily discovered.  

Regards,
Blagoev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Ciaran O'Neill
Top achievements
Rank 1
Answers by
Chris Eargle
Top achievements
Rank 1
Ciaran O'Neill
Top achievements
Rank 1
Yanaki Yanakiev
Telerik team
Blagoev
Telerik team
Share this question
or