0

When I debug my parametrized TestFixture in VSCode .NET Testm the logs show this exception:

NUnit Adapter 4.4.0.0: Test discovery starting
NUnit Adapter 4.4.0.0: Test discovery complete
System.ArgumentException: Selected argument cannot be empty. (Parameter 'tests')
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.ValidateArg.NotNullOrEmpty[T](IEnumerable`1 arg, String parameterName)
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria..ctor(IEnumerable`1 tests, Int64 frequencyOfRunStatsChangeEvent, Boolean keepAlive, String testSettings, TimeSpan runStatsChangeEventTimeout, ITestHostLauncher testHostLauncher, TestSessionInfo testSessionInfo, Boolean debugEnabledForTestSession)
   at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.RunTests(TestRunRequestPayload testRunRequestPayload, ITestHostLauncher3 testHostLauncher, ITestRunEventsRegistrar testRunEventsRegistrar, ProtocolConfig protocolConfig)
   at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass27_0.<StartTestRun>b__0()

This is my base class:

[TestFixture]
public class BaseFixture
{
    public BaseFixture(string text)
    {
        
    }

}

This is my derived class:

[TestFixture("test")]
public class DerivedFixture :BaseFixture
{
    public DerivedFixture(string text):base(text)
    {
        
    }


    [SetUp]
    public void Setup()
    {
    }

    [Test]
    public void Test1()
    {
        Assert.Pass();
    }
}

Whenever I pass a parameter to the DerivedFixture by [TestFixture("test")] the debugger fails to start and the specified exception is shown.

I ran the test using "dotnet test" and the test passes.

I updated Omnisharp to latest version, but no luck.

SQB
  • 3,926
  • 2
  • 28
  • 49
Marty
  • 1
  • `Selected argument cannot be empty. (Parameter 'tests')` but in your posted code there is nothing named `tests`. You have `BaseFixture(string text)` and `DerivedFixture(string text)`. Probably the error is somewhere else. – Cleptus May 28 '23 at 21:13
  • Y also i dont understand its somehow connected with [TestFixture("test")] because when I run debug without parameter passed in TestFixture it does not show that exception. – Marty May 28 '23 at 21:19

0 Answers0