Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lars Heesakkers 37 posts 193 karma points
    Oct 21, 2019 @ 12:28
    Lars Heesakkers
    0

    Using Umbraco.Tests in NUnit test project.

    Hi,

    I am trying to set up unit tests for an Umbraco website for which I need the UmbracoContext. I included the Umbraco.Tests.dll using this package: https://github.com/kedde/Our.Umbraco.Community.Tests And I installed Nunit with NuGet.

    When I create a Normal test-case everything works as expected. But as soon as I use "BaseRoutingTest" (to get the UmbracoContext). NUnit does not find my testcase, causing it to not run.

    Below is my testcase code:

    [TestFixture]
    public class NewTests : BaseRoutingTest
    {
        [Test]
        public void ShouldLoadContext()
        {
            var context = UmbracoContext.Current;
            Assert.True(context != null);
        }
    }
    

    The output for my tests is:

    [21/10/2019 14:18:46 Informational] Executing test method 'MyWebsite.NewTests.ShouldLoadContext' [21/10/2019 14:18:46 Informational] ------ Run test started ------ [21/10/2019 14:18:47 Informational] NUnit Adapter 3.15.1.0: Test execution started [21/10/2019 14:18:47 Informational] Running all tests in C:...\MyWebsite\bin\Debug\MyWebsite.dll [21/10/2019 14:18:47 Informational] NUnit failed to load C:...\MyWebsite\bin\Debug\MyWebsite.dll [21/10/2019 14:18:47 Informational] NUnit Adapter 3.15.1.0: Test execution complete [21/10/2019 14:18:47 Warning] No test matches the given testcase filter 'FullyQualifiedName=MyWebsite.NewTests.ShouldLoadContext' in C:...\MyWebsite\bin\Debug\MyWebsite.dll [21/10/2019 14:18:47 Informational] ========== Run test finished: 0 run (0:00:01,0771566) ==========

    Do you guys have any idea what I am doing wrong?

Please Sign in or register to post replies

Write your reply to:

Draft