I have a wierd instances where the order of execution is messed up
I have created a base class for all my steps definition
public abstract class BaseSteps
{
static BaseSteps()
{
Console.WriteLine("static Constructor");
}
protected BaseSteps()
{
Console.WriteLine("public Constructor");
}
[BeforeTestRun]
public static void BeforeTestRun()
{
Console.WriteLine("static void BeforeTestRun");
}
[AfterTestRun]
public static void AfterTestRun()
{
Console.WriteLine("static void AfterTestRun");
}
[Before]
public static void Before()
{
Console.WriteLine("Base Before Scenario");
}
}
[Binding]
public class SpecFlowFeature1Steps: BaseSteps
{
public SpecFlowFeature1Steps()
{
}
[BeforeScenario()]
public void Setup()
{
}
But it's wierd that the order of execution on my debug mode looks like this
- Base class static constructor
- [BeforeTestRun]
- Base class constructor
- Child class constructor
- Child class [BeforeScenario]
- Base class [BeforeScenario] ....
I was expecting it to be like ...
- Base class [BeforeScenario]
- Base constructor
- Child class constructor
- Child class [BeforeScenario]
...
Any idea why this behave this way?
TIA
Aucun commentaire:
Enregistrer un commentaire