samedi 3 août 2019

how do i use FeatureContext.Current.FeatureInfo.Title in ScenarioDependencies

i use from speckflow i want to use " FeatureContext.Current.FeatureInfo.Title " inside ScenarioDependencies

public static class TestContainerBuilder
{
    [ScenarioDependencies]
    public static ContainerBuilder CreateContainerBuilder()
    {
        var containerBuilder = new ContainerBuilder();

        containerBuilder.RegisterAssemblyTypes(
            typeof(Feature.SendNotificationSteps).Assembly)
            .AsSelf()
            .AsImplementedInterfaces()
            .InstancePerLifetimeScope();

        CompositionRoot.RegisterDependencies(containerBuilder);

        var featureName = FeatureContext.Current.FeatureInfo.Title;//this part of code is throw exception

        return containerBuilder;
    }
}

but when i have 1 speckflow feature this code run successfully, but whene i use more speckflow feature,FeatureContext is null. Is there a way to do this?

Thanks!

Aucun commentaire:

Enregistrer un commentaire