Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSTest task aborted when using TestCategory filters #561

Closed
mzboray opened this issue Nov 14, 2018 · 3 comments
Closed

VSTest task aborted when using TestCategory filters #561

mzboray opened this issue Nov 14, 2018 · 3 comments

Comments

@mzboray
Copy link

mzboray commented Nov 14, 2018

I am seeing an issue with NUnit 3.11 and VS adapter version 3.11 when running the vstest task in an Azure pipeline. While the tests run fine in Visual Studio 2017, when running with a test case filter like "TestCategory=Release & TestCategory!=Chaos & TestCategory!=DevOneOnly" I get the following error in the vstest task, aborting the run:

2018-11-14T19:34:18.1573807Z ##[debug]TestCaseFilter.GetFilteredTestCases : Starting filtering of discovered test cases.
2018-11-14T19:34:18.1778365Z ##[error]TestCaseFilter.FilterTests : Exception during filtering : System.ArgumentException: An item with the same key has already been added.
2018-11-14T19:34:18.1794869Z ##[debug]Processed: ##vso[task.logissue type=error;]TestCaseFilter.FilterTests : Exception during filtering : System.ArgumentException: An item with the same key has already been added.
2018-11-14T19:34:18.1795252Z at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
2018-11-14T19:34:18.1795351Z at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) 2018-11-14T19:34:18.1795538Z at MS.VS.TestService.TestPlatform.v2.TestCaseFilter.GetTestPropertiesInTraitDictionary(TestCase testCase) in D:\V2.0\A1\_work\56\s\Ta\Agent\VS.TestService.TestPlatform.v2\TestCaseFilter.cs:line 139 2018-11-14T19:34:18.1795678Z at MS.VS.TestService.TestPlatform.v2.TestCaseFilter.GetFilteredTestCases(IEnumerable1 testCases) in D:\V2.0\A1_work\56\s\Ta\Agent\VS.TestService.TestPlatform.v2\TestCaseFilter.cs:line 98
2018-11-14T19:34:18.1795802Z at MS.VS.TestService.TestPlatform.v2.TestCaseFilter.FilterTests(IEnumerable`1 testCases) in D:\V2.0\A1_work\56\s\Ta\Agent\VS.TestService.TestPlatform.v2\TestCaseFilter.cs:line 47

This is the configuration of our vs test task:

{
  "environment": {},
  "taskId": "ef087383-ee5e-42c7-9a53-ab56c98420f9",
  "version": "2.*",
  "name": "Run functional Tests",
  "refName": "",
  "enabled": true,
  "alwaysRun": false,
  "continueOnError": false,
  "timeoutInMinutes": 0,
  "definitionType": "task",
  "overrideInputs": {},
  "condition": "succeeded()",
  "inputs": {
    "testSelector": "testAssemblies",
    "testAssemblyVer2": "**\\publish\\**\\*.Test.*.dll",
    "testPlan": "",
    "testSuite": "",
    "testConfiguration": "",
    "tcmTestRun": "$(test.RunId)",
    "searchFolder": "$(System.DefaultWorkingDirectory)",
    "testFiltercriteria": "TestCategory=Release & TestCategory!=Chaos & TestCategory!=DevOneOnly",
    "runOnlyImpactedTests": "False",
    "runAllTestsAfterXBuilds": "50",
    "uiTests": "false",
    "vstestLocationMethod": "version",
    "vsTestVersion": "15.0",
    "vstestLocation": "",
    "runSettingsFile": "",
    "overrideTestrunParameters": "",
    "pathtoCustomTestAdapters": "",
    "runInParallel": "False",
    "runTestsInIsolation": "False",
    "codeCoverageEnabled": "False",
    "otherConsoleOptions": "",
    "distributionBatchType": "basedOnTestCases",
    "batchingBasedOnAgentsOption": "autoBatchSize",
    "customBatchSizeValue": "10",
    "batchingBasedOnExecutionTimeOption": "autoBatchSize",
    "customRunTimePerBatchValue": "60",
    "dontDistribute": "False",
    "testRunTitle": "Functional Test",
    "platform": "",
    "configuration": "",
    "publishRunAttachments": "true",
    "diagnosticsEnabled": "True",
    "collectDumpOn": "onAbortOnly",
    "rerunFailedTests": "False",
    "rerunType": "basedOnTestFailurePercentage",
    "rerunFailedThreshold": "30",
    "rerunFailedTestCasesMaxLimit": "5",
    "rerunMaxAttempts": "3"
  }

I am using the latest version of the agent 2.141.1 on a private host. I originally thought this was an agent issue but downgrading to nunit 3.10.1 fixes the issue for me, so it seems like an nunit framework/adapter issue. Note that this is a .net core 2.1 project.

This may be related to #559.

@OsirisTerje
Copy link
Member

I agree it looks like #559

OsirisTerje added a commit that referenced this issue Nov 19, 2018
…MSTest category types. Defaulting to MSTest to ensure #506 is still working.
OsirisTerje added a commit that referenced this issue Nov 20, 2018
@OsirisTerje
Copy link
Member

@mzboray I just made a fix and merged, so can you check the pre-release package: https://www.myget.org/feed/nunit/package/nuget/NUnit3TestAdapter/3.11.1-dev-00958

@OsirisTerje OsirisTerje added this to the 3.11.1 milestone Nov 20, 2018
@OsirisTerje
Copy link
Member

@mzboray 3.11.1 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants