ReSharper 2018.1.2 NUnit TestCaseSource (.NET Core / VS2017)
NUnit test cases supplied with [TestCaseSource()] are not discovered by ReSharper's Unit Test Explorer. They are, however, discovered by Visual Studio's built in test explorer. All my test projects have the exact same PackageReferences:
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
It's especially frustrating because while it was always temperamental, it used to work enough of the time. Now it works none of the time. Can someone help me sort this out?
Please sign in to leave a comment.
Hello Alexander!
Thank you for contacting us.
Unfortunately cannot reproduce the problem from scratch.
Could you please provide some sample solution demonstrating the issue? You can do it privately via 'Submit a request' form.
Thank you.
I submitted a request.
@Angelina - when can I expect someone to get to this issue? It's preventing me from profiling my code.
I'm also getting this issue with JetBrains ReSharper Ultimate 2018.2.3 Build 182.0.20180912.70621
sample code:
public static List<TestCaseData> GetAllCategory(string category)
var testDataContext = new testDataContext (Test_ConnectionString);
var testData = testDataContext.TestData
.Where(ri => ri.IsActive == true && ri.Category == category)
.Select(ri => new TestCaseData(ri.Name,
ri.Expected,
ri.MoreData,
ri.Category)
.SetName($"Test_Category_{ri.Category}_{ri.Name}"))
.ToList();
return testData;
}
[TestCaseSource(nameof(GetAllCategory), new object[] {"MyCategory})]
public async Task Test_Category_PerCategory_MyCategory(string name, string moreData, string expected, string category)
{
// Do Something
Assert.That(actual, Is.Equal(expected), name);
}
Hello Brian!
Thank you for the feedback.
Unfortunately I couldn't reproduce the problem.
Could you please try the latest ReSharper 2018.3.3 - https://www.jetbrains.com/resharper/download/.
If the problem is still reproduced some sample solution demonstrating the problem will be highly appreciated. You can share it using 'Submit a request' form.
Thank you.
I just had the same issue. Apparently having a file in my root folder "Global.cs" messed up a lot with the resharper test runner. It also caused some tests to appear in a weird <RootNameSpace>.
Sample code:
[NUnit.Framework.SetUpFixture]
// ReSharper disable once CheckNamespace
public class Global
{
[NUnit.Framework.OneTimeSetUp]
public void SetUp()
{
//Do global setup
}
}
I used it to configure a console appender for log4net. After removing the file and restarting visual studio, everything worked like expected.
I'm on version 2019.2.2 and I continue to get this issue.
It may be related to if the TestDataSource is querying a database to return the list of test cases.
I have other TestCaseData where the data source is file based and I do not get this issue.
This is a screenshot of MSTest and Resharper Test Explorers overlooking the same test cases with TestCaseData
Hello everyone,
we'd be grateful if you could provide some sample solution demonstrating the problem, cause we cannot reproduce the problem based on the descriptions you've provided.
You can share the solution privately via 'Submit a request' form at the top of the page. NDA could be also signed if it's needed.
Thank you.
Did that, hope you are able to reproduce the issue.
Cheers
Thanks to Kevin we could reproduce the problem with old NUnit versions, the fix will be included in upcoming ReSharper 2019.3.
I'm getting the same problem. Minimal test code:
using System;
using NUnit.Framework;
namespace Minimal
{
public class Min
{
[Test]
[TestCaseSource(nameof(Payers))]
public void TestPayer(string payer)
{
Console.WriteLine(payer);
}
public static string[] Payers
{
get
{
var payers = new[]
{
"One", "Two", "Three"
};
return payers;
}
}
}
}
VS2019
JetBrains ReSharper Ultimate 2019.3.1 Build 193.0.20191219.91525 built on 2019-12-19
ReSharper 2019.3.20191219.94350
I can confirm, I also have the issue, hopefully can be fixed, I use this Resharper test runner quite a bit.