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

Notification

Icon
Error

NCrunch renders "escaped" text as test name?
GreenMoose
#1 Posted : Wednesday, April 4, 2018 1:56:10 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 397

Thanks: 89 times
Was thanked: 42 time(s) in 41 post(s)
[v3.15.0.1]

Hi,

1) Shouldn't the test name be rendered "non escaped", i.e. display Unicode characters and alike? (If I recall correctly previous versions rendered the actual Unicode characters in UI?)
2) Why does it escape the single quote?

Test code (NUnit)
Code:

        [TestCase("foo")]
        [TestCase("foo'bar")]
        [TestCase("foo\u263Abar")]
        [TestCase("foo\\'bar")]
        [TestCase("foo\"bar1")]
        [TestCase(@"foo""bar2")]
        public void TestCaseTest(string testCase)
        {
            Console.WriteLine($@"testCase: {testCase}");
        }

(same when using TestCaseSource)

UI output:

UI test names

Thanks.
Remco
#2 Posted : Wednesday, April 4, 2018 8:13:07 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,374

Thanks: 705 times
Was thanked: 878 time(s) in 835 post(s)
Hi, thanks for sharing this.

This isn't a use case we're currently testing for, so it's hard for me to be certain how NCrunch would behave when fed escape sequences inside test names. There are multiple layers of complexity involved here, including the test framework itself. It's quite possible that there is a layer deliberately mangling or removing the sequences to try and prevent downstream problems.

I've made a note for us to investigate how these cases get handled, to see if they need further attention. Generally though, I would recommend avoiding the use of any kind of escape sequence inside test case parameter data. This is because the parameter data is used to construct a part of the visible test name, which is rendered extensively through the UI, ranging everywhere from popups to HTML reports. Given the different rendering contexts, fonts and other considerations, it's hard to predict how different areas of the UI will behave when fed these sequences. If you need to use them for testing your code, I'd recommend declaring them inside test methods rather than using them as test case parameters.
1 user thanked Remco for this useful post.
GreenMoose on 4/5/2018(UTC)
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.038 seconds.