I am using C# on the .NET 4.5 framework with Visual Studio 2015. I am attempting to plug NUnit support into an automated test system that was built around MSUnit tests. As part of the system, I need to find methods marked with TestAttribute
and TestCaseAttribute
in provided .dll files using Reflection. Currently this system has NuGet packages installed for NUnit version 3.2.1.
Question: is there a way to detect these attributes on tests that were created using older versions of NUnit? For example, I have some tests that were created using NUnit version 2.6.4, but their corresponding attributes are not found because the system is looking for attributes from NUnit 3.2.1.
Here is a snippet of code used to detect the test classes marked with TestFixtureAttribute
in the provided .dll:
var testClasses = testAssembly
.SelectMany(a => a.GetTypes())
.Where(a => a.IsDefined(typeof(TestFixtureAttribute), false));
Again, this snippet doesn't find any test classes on the provided .dll because the older TestFixtureAttribute
is not the same as the one in NUnit 3.2.1
I have successfully run older NUnit tests on the nunit3-console.exe, so discovering the tests is the big roadblock for now.
Thanks in advance for any help!
Aucun commentaire:
Enregistrer un commentaire