Why does the Custom Attribute decrease the speed of test discovery in MSTest?

199 Views Asked by At

I have defined a new class name MyTestMethodAttribute and it is been inherited from TestMethod I have changed nothing in this custom attribute other than overriding the Execute Method:

[AttributeUsage(AttributeTargets.Method)]
public class MyTestMethodAttribute : TestMethodAttribute
{
    public override TestResult[] Execute(ITestMethod testMethod)
    {
        // do some stuff here ...

        return base.Execute(testMethod);
    }
 }

So the issue is when I am using [MyTestMethod] attribute over test methods it takes more than 10 minutes to discover test cases of 800 tests but instead when I`m using [TestMethod] attribute it takes less than a few seconds to discover all of the tests and then starting to testing them one by one.

I have also tested it directly using putting the parameters to vstest.console.exe which the TestExproler used to do that as well.

I need to add that even I have not overridden the execute method I am getting the same issue as well.

0

There are 0 best solutions below