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

negative test filter requires at least one property (trait / category) to exist within the tested assembly #841

Closed
dmccaffery opened this issue Jun 5, 2017 · 3 comments
Assignees

Comments

@dmccaffery
Copy link

dmccaffery commented Jun 5, 2017

Description

When executing the vstest runner with a negative filter on an assembly that does not contain at least one property of the specified type, an exception occurs.

Steps to reproduce

  1. Create a new unit test project that does not define a category property or trait.
  2. Execute vstest with a TestCaseFilter that has a negative check for the category property or trait.
  3. Exception will occur indicating that no test contains the specified category property or trait.

Example:

dotnet test "<assembly>" --no-build --configuration "Debug" --filter "Category!=Platform-Not-MacOS"

(this will call vstest.console underneath with a --TestCaseFilter and --TestAdapterPath)

Expected behavior

All tests that do not have a category property or trait should execute based on the following logic: Category!=SomeValue is true when Category is not defined

Actual behavior

Exception filtering tests: No tests matched the filter because it contains one or more properties that are not valid (Category). Specify filter expression containing valid properties (DisplayName, FullyQualifiedName) and try again.

Environment

~ dotnet --info
.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4
 Commit SHA-1 hash:  af1e6684fd

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /Users/deavon/.dotnet/sdk/1.0.4
~ dotnet vstest
Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.
@Faizan2304
Copy link
Contributor

The issue is with xunit. I opened a bug in xunit repo (xunit/xunit#1314) to track this. I am closing it here.

@Faizan2304 Faizan2304 reopened this Jun 8, 2017
Faizan2304 pushed a commit to Faizan2304/vstest that referenced this issue Jun 8, 2017
Fix: Don’t throw exception if filter property is not belong to supported property list. Later TestCaseFilterExpression.MatchTestCase() is going to handle it properly.
Faizan2304 added a commit that referenced this issue Jun 9, 2017
* Issue: #841

Fix: Don’t throw exception if filter property is not belong to supported property list. Later TestCaseFilterExpression.MatchTestCase() is going to handle it properly.

* Move file TestCaseFilterExpression.cs from CrossPlat to common

* Address PR comment
@Faizan2304
Copy link
Contributor

Fixed!!

@jamescrosswell

@jrr
Copy link

jrr commented Dec 12, 2017

I still have this problem, with the following environment:

  • VS2017
  • SDK-style project targeting net462
  • xunit 2.3.1
  • Microsoft.NET.Test.Sdk 15.5

Both dotnet test (2.0.0) and vstest.console.exe (15.0.26929.2) produce this output:

[xUnit.net 00:00:01.3961216] Foo.Test: Exception filtering tests: No tests matched the filter because it contains one or more properties that are not valid (Bug). Specify filter expression containing valid properties (DisplayName, FullyQualifiedName) and try again.

What did I miss?

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

No branches or pull requests

3 participants