Skip to content

One background for different features #421

Closed Answered by PBuchmann
PBuchmann asked this question in Q&A
Discussion options

You must be logged in to vote

OK. It's hacky as hell but works:

            var feature = Activator.CreateInstance(type);
            var fieldInfo = type.GetField("testRunner", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
            fieldInfo.SetValue(feature, this.testRunner);
            var textContextProperty = type.GetProperty("TestContext");
            textContextProperty.SetValue(feature, this.testContext);
            var scenarioInitialize = type.GetMethod("ScenarioInitialize");
            scenarioInitialize.Invoke(feature, new object[] { this.scenarioContext.ScenarioInfo });
            var featureBackground = type.GetMethod("FeatureBackgroundAsync");
            v…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@PBuchmann
Comment options

@PBuchmann
Comment options

@PBuchmann
Comment options

Answer selected by PBuchmann
@ajeckmans
Comment options

@PBuchmann
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants