diff options
author | Matt Ward <matt.ward@microsoft.com> | 2018-01-22 14:54:45 +0300 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2018-01-22 16:21:25 +0300 |
commit | e65117ca616fbb484f96d07b1da9c97afbc0fd9d (patch) | |
tree | ca726e6938f7b0ab8c57793ea35af81c879a60d8 /main/src/addins/MonoDevelop.UnitTesting.NUnit | |
parent | 7652102b3799b9f81cac463d1a693d1b2c44a58d (diff) |
[NUnit] Fix load error displayed for ignored tests
When a test used an Ignore attribute the Unit Tests window would
show a load error for the entire project and prevent any tests from
being run. The problem was that the load error check was looking for
a _SKIPREASON property on every test-suite xml element in the xml
produced by NUnit v3. When an Ignore attribute is used the xml has a
_SKIPREASON property for the test case and that was being found and
treated as an error. To avoid this only a test-suite xml element that
has a type of Assembly and has a runstate of NotRunnable is checked
for a _SKIPREASON.
VSTS 544671
Diffstat (limited to 'main/src/addins/MonoDevelop.UnitTesting.NUnit')
-rw-r--r-- | main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnitTestRunner.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnitTestRunner.cs b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnitTestRunner.cs index 93002f6305..903745c6b0 100644 --- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnitTestRunner.cs +++ b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnitTestRunner.cs @@ -149,6 +149,15 @@ namespace NUnit3Runner bool CheckXmlForError(XmlElement root, out string result) { + if (root.GetAttribute ("type") != "Assembly" || root.GetAttribute ("runstate") != "NotRunnable") { + // Only interested in _SKIPREASON if the test-suite is an assembly and the + // state is NotRunnable. This will indicate a load failure. This check + // prevents Ignore attributes incorrectly indicating an error since these + // also have a _SKIPREASON. + result = null; + return false; + } + var elements = root.GetElementsByTagName ("properties"); var skipReasonString = string.Empty; foreach (XmlElement element in elements) |