xUnit tests not running

15 posts, 0 answers
  1. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 20 Sep 2011 Link to this post

    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

  2. Chris Eargle
    Chris Eargle avatar
    7 posts
    Member since:
    Aug 2009

    Posted 20 Sep 2011 Link to this post

    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.
  3. DevCraft banner
  4. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 20 Sep 2011 Link to this post

    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();
            }
        }
  5. Chris Eargle
    Chris Eargle avatar
    7 posts
    Member since:
    Aug 2009

    Posted 20 Sep 2011 Link to this post

    I verified the issue and will send the project to the team for feedback.
  6. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 20 Sep 2011 Link to this post

    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?
  7. Chris Eargle
    Chris Eargle avatar
    7 posts
    Member since:
    Aug 2009

    Posted 21 Sep 2011 Link to this post

    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?
  8. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 21 Sep 2011 Link to this post

    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
  9. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 27 Sep 2011 Link to this post

    Hi,

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

    Thanks,
    Ciaran
  10. Yanaki Yanakiev
    Admin
    Yanaki Yanakiev avatar
    16 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

  11. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 02 Oct 2011 Link to this post

    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
  12. Chris Eargle
    Chris Eargle avatar
    7 posts
    Member since:
    Aug 2009

    Posted 02 Oct 2011 Link to this post

    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.
  13. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 03 Oct 2011 Link to this post

    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();
            }
        }
    }
  14. Blagoev
    Admin
    Blagoev avatar
    49 posts

    Posted 05 Oct 2011 Link to this post

    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 >>

  15. Ciaran O'Neill
    Ciaran O'Neill avatar
    15 posts
    Member since:
    May 2010

    Posted 06 Oct 2011 Link to this post

    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
  16. Blagoev
    Admin
    Blagoev avatar
    49 posts

    Posted 07 Oct 2011 Link to this post

    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 >>

Back to Top
DevCraft banner