Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Long test names cause Visual Studio UI hangs with NCrunch enabled
jamezor
#1 Posted : Wednesday, February 7, 2018 9:58:08 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/9/2012(UTC)
Posts: 13
Location: Auckland

Was thanked: 1 time(s) in 1 post(s)
With an otherwise empty project/solution, and all default NCrunch settings, the following test experiences very poor performance with the Visual Studio UI hanging for 1 - 2 seconds per keystroke; disabling NCrunch immediately resolves the issue.

Code:
    internal class TestClass
    {
        private static IEnumerable<TestCaseData> TestCaseSource()
        {
            return Enumerable.Range(0, 10).Select(i => new TestCaseData(i).SetName(new string('*', 2000) + i.ToString()));
        }

        [TestCaseSource(nameof(TestCaseSource))]
        public void Given_a_test_case_source_with_long_test_names_When_running_NCrunch_Then_the_Visual_Studio_UI_hangs_a_lot(int i)
        {
            Assert.That(i, Is.GreaterThan(0));
        }
    }


As the test names get longer or the number of tests with long names grows the slowdown seems to get exponentially worse. We've taken to presenting a MD5 hash of the test name to NUnit/NCrunch instead of the actual long name to avoid this issue but that is not very elegant.

NCrunch 3.12.0.15, Visual Studio 2017 15.5.6, Windows 10 64bit.
Remco
#2 Posted : Wednesday, February 7, 2018 10:31:53 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this.

With your sample code, I can reproduce a problem in the UI that causes NCrunch to eat up the main thread while it tries to render the long test name. This will definitely slow VS right down.

We'll take a look and see if we can get this fixed. Using a hash for the test name is a good workaround for the time being.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.028 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download