How to fix invalid ReSharper view of test names?
up vote
4
down vote
favorite
Im using NUnit (3.8.1) with Resharper (2018.2.3) like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return T("foo.bA..r@gmail.com", "foobar@gmail.com");
yield return T("foo.bA..r@example.com", "foo.ba..r@example.com");
yield return T("user.name+tag+sorting@example.com", "user.name@example.com");
yield return T("admin@mailserver1", "admin@mailserver1");
yield return T("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com");
}
private static TestCaseData T(string input, string output)
{
return new TestCaseData(input, output)
{
TestName = string.Format("'{0}' => '{1}'", input, output)
};
}
[Test]
[TestCaseSource(nameof(GetTests))]
public void Normalize(string input, string output)
{
//some test here
}
But when I run my tests, in Resharper window, I see my names cropped by some mystical logic:

What is causing my names to become like this? How to solve it?
c# nunit resharper
|
show 1 more comment
up vote
4
down vote
favorite
Im using NUnit (3.8.1) with Resharper (2018.2.3) like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return T("foo.bA..r@gmail.com", "foobar@gmail.com");
yield return T("foo.bA..r@example.com", "foo.ba..r@example.com");
yield return T("user.name+tag+sorting@example.com", "user.name@example.com");
yield return T("admin@mailserver1", "admin@mailserver1");
yield return T("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com");
}
private static TestCaseData T(string input, string output)
{
return new TestCaseData(input, output)
{
TestName = string.Format("'{0}' => '{1}'", input, output)
};
}
[Test]
[TestCaseSource(nameof(GetTests))]
public void Normalize(string input, string output)
{
//some test here
}
But when I run my tests, in Resharper window, I see my names cropped by some mystical logic:

What is causing my names to become like this? How to solve it?
c# nunit resharper
What do you mean by in Resharper window? something from underReSharper -> Windowsfrom the tool bar?
– Guy
Nov 12 at 9:42
1
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by.to show the simplified name.
– Guy
Nov 12 at 9:52
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58
|
show 1 more comment
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Im using NUnit (3.8.1) with Resharper (2018.2.3) like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return T("foo.bA..r@gmail.com", "foobar@gmail.com");
yield return T("foo.bA..r@example.com", "foo.ba..r@example.com");
yield return T("user.name+tag+sorting@example.com", "user.name@example.com");
yield return T("admin@mailserver1", "admin@mailserver1");
yield return T("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com");
}
private static TestCaseData T(string input, string output)
{
return new TestCaseData(input, output)
{
TestName = string.Format("'{0}' => '{1}'", input, output)
};
}
[Test]
[TestCaseSource(nameof(GetTests))]
public void Normalize(string input, string output)
{
//some test here
}
But when I run my tests, in Resharper window, I see my names cropped by some mystical logic:

What is causing my names to become like this? How to solve it?
c# nunit resharper
Im using NUnit (3.8.1) with Resharper (2018.2.3) like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return T("foo.bA..r@gmail.com", "foobar@gmail.com");
yield return T("foo.bA..r@example.com", "foo.ba..r@example.com");
yield return T("user.name+tag+sorting@example.com", "user.name@example.com");
yield return T("admin@mailserver1", "admin@mailserver1");
yield return T("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com");
}
private static TestCaseData T(string input, string output)
{
return new TestCaseData(input, output)
{
TestName = string.Format("'{0}' => '{1}'", input, output)
};
}
[Test]
[TestCaseSource(nameof(GetTests))]
public void Normalize(string input, string output)
{
//some test here
}
But when I run my tests, in Resharper window, I see my names cropped by some mystical logic:

What is causing my names to become like this? How to solve it?
c# nunit resharper
c# nunit resharper
asked Nov 12 at 8:19
eocron
3,552832
3,552832
What do you mean by in Resharper window? something from underReSharper -> Windowsfrom the tool bar?
– Guy
Nov 12 at 9:42
1
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by.to show the simplified name.
– Guy
Nov 12 at 9:52
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58
|
show 1 more comment
What do you mean by in Resharper window? something from underReSharper -> Windowsfrom the tool bar?
– Guy
Nov 12 at 9:42
1
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by.to show the simplified name.
– Guy
Nov 12 at 9:52
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58
What do you mean by in Resharper window? something from under
ReSharper -> Windows from the tool bar?– Guy
Nov 12 at 9:42
What do you mean by in Resharper window? something from under
ReSharper -> Windows from the tool bar?– Guy
Nov 12 at 9:42
1
1
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by
. to show the simplified name.– Guy
Nov 12 at 9:52
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by
. to show the simplified name.– Guy
Nov 12 at 9:52
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Looks like ReSharper is having issues with dots in test case names when it's running NUnit parameterized tests: it simply discards whatever precedes a dot.
There's no such problem with ReSharper running xUnit theories, for example, nor does NUnit's console runner seem to return anything weird that would seem to have an effect on ReSharper behavior.
What you can do to work around this issue is provide a descriptive name for each test case using the SetName() method, like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return new TestCaseData("foo.bA..r@gmail.com", "foobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (1)");
yield return new TestCaseData("foo.bA..r@example.com", "foo.ba..r@example.com").SetName("Example domain: dots intact, casing normalized to lower");
yield return new TestCaseData("user.name+tag+sorting@example.com", "user.name@example.com").SetName("Example domain: local part stripped from + and everything that follows");
yield return new TestCaseData("admin@mailserver1", "admin@mailserver1").SetName("Whatever you're checking here");
yield return new TestCaseData("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (2)");
}
As long as you're not using dots in the names, you should be fine:

Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258199%2fhow-to-fix-invalid-resharper-view-of-test-names%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Looks like ReSharper is having issues with dots in test case names when it's running NUnit parameterized tests: it simply discards whatever precedes a dot.
There's no such problem with ReSharper running xUnit theories, for example, nor does NUnit's console runner seem to return anything weird that would seem to have an effect on ReSharper behavior.
What you can do to work around this issue is provide a descriptive name for each test case using the SetName() method, like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return new TestCaseData("foo.bA..r@gmail.com", "foobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (1)");
yield return new TestCaseData("foo.bA..r@example.com", "foo.ba..r@example.com").SetName("Example domain: dots intact, casing normalized to lower");
yield return new TestCaseData("user.name+tag+sorting@example.com", "user.name@example.com").SetName("Example domain: local part stripped from + and everything that follows");
yield return new TestCaseData("admin@mailserver1", "admin@mailserver1").SetName("Whatever you're checking here");
yield return new TestCaseData("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (2)");
}
As long as you're not using dots in the names, you should be fine:

Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
add a comment |
up vote
2
down vote
accepted
Looks like ReSharper is having issues with dots in test case names when it's running NUnit parameterized tests: it simply discards whatever precedes a dot.
There's no such problem with ReSharper running xUnit theories, for example, nor does NUnit's console runner seem to return anything weird that would seem to have an effect on ReSharper behavior.
What you can do to work around this issue is provide a descriptive name for each test case using the SetName() method, like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return new TestCaseData("foo.bA..r@gmail.com", "foobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (1)");
yield return new TestCaseData("foo.bA..r@example.com", "foo.ba..r@example.com").SetName("Example domain: dots intact, casing normalized to lower");
yield return new TestCaseData("user.name+tag+sorting@example.com", "user.name@example.com").SetName("Example domain: local part stripped from + and everything that follows");
yield return new TestCaseData("admin@mailserver1", "admin@mailserver1").SetName("Whatever you're checking here");
yield return new TestCaseData("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (2)");
}
As long as you're not using dots in the names, you should be fine:

Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Looks like ReSharper is having issues with dots in test case names when it's running NUnit parameterized tests: it simply discards whatever precedes a dot.
There's no such problem with ReSharper running xUnit theories, for example, nor does NUnit's console runner seem to return anything weird that would seem to have an effect on ReSharper behavior.
What you can do to work around this issue is provide a descriptive name for each test case using the SetName() method, like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return new TestCaseData("foo.bA..r@gmail.com", "foobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (1)");
yield return new TestCaseData("foo.bA..r@example.com", "foo.ba..r@example.com").SetName("Example domain: dots intact, casing normalized to lower");
yield return new TestCaseData("user.name+tag+sorting@example.com", "user.name@example.com").SetName("Example domain: local part stripped from + and everything that follows");
yield return new TestCaseData("admin@mailserver1", "admin@mailserver1").SetName("Whatever you're checking here");
yield return new TestCaseData("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (2)");
}
As long as you're not using dots in the names, you should be fine:

Looks like ReSharper is having issues with dots in test case names when it's running NUnit parameterized tests: it simply discards whatever precedes a dot.
There's no such problem with ReSharper running xUnit theories, for example, nor does NUnit's console runner seem to return anything weird that would seem to have an effect on ReSharper behavior.
What you can do to work around this issue is provide a descriptive name for each test case using the SetName() method, like this:
private static IEnumerable<TestCaseData> GetTests()
{
yield return new TestCaseData("foo.bA..r@gmail.com", "foobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (1)");
yield return new TestCaseData("foo.bA..r@example.com", "foo.ba..r@example.com").SetName("Example domain: dots intact, casing normalized to lower");
yield return new TestCaseData("user.name+tag+sorting@example.com", "user.name@example.com").SetName("Example domain: local part stripped from + and everything that follows");
yield return new TestCaseData("admin@mailserver1", "admin@mailserver1").SetName("Whatever you're checking here");
yield return new TestCaseData("aaaafoo.bA..r@gmail.com", "aaafoobar@gmail.com").SetName("GMail: dots removed, casing normalized to lower (2)");
}
As long as you're not using dots in the names, you should be fine:

answered Nov 16 at 22:36
Jura Gorohovsky
8,8493136
8,8493136
Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
add a comment |
Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
Wow, thank you for pointing this out! You might as well create bug ticket on their bug tracker. Thanks!
– eocron
Nov 17 at 6:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258199%2fhow-to-fix-invalid-resharper-view-of-test-names%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you mean by in Resharper window? something from under
ReSharper -> Windowsfrom the tool bar?– Guy
Nov 12 at 9:42
1
I couldn't find any proof, but I suspect there is some logic which split the full test (including name space and class) name by
.to show the simplified name.– Guy
Nov 12 at 9:52
I mean window which open when you run tests by default. It is showing those cropped strings instead of correct ones.
– eocron
Nov 12 at 10:11
I'm not really sure what you mean, I don't have any window getting opened when I run tests.
– Guy
Nov 12 at 10:47
"Unit test sessions" window. Resharper => Unit tests => Unit test sessions
– eocron
Nov 12 at 10:58