Examples: Show how to use the automation function and the hasError on a feature group
import WithCtor = tagion.behaviour.BehaviourUnittestWithCtor; auto feature_with_ctor = automation!(WithCtor)(); { // No constructor has been called for the scenarios, this means that scenarios and the feature will have errors const feature_context = feature_with_ctor.run; assert(feature_context.result.scenarios[0].hasErrors); assert(feature_context.result.scenarios[1].hasErrors); assert(feature_context.result.hasErrors); version (behaviour_unitdata) "/tmp/bdd_which_has_feature_errors.hibon".fwrite(feature_context.result); } { // Fails in second scenario because the constructor has not been called // Calls the construction for the Some_awesome_feature scenario feature_with_ctor.Some_awesome_feature(42, "with_ctor"); const feature_context = feature_with_ctor.run; assert(!feature_context.result.scenarios[0].hasErrors); assert(feature_context.result.scenarios[1].hasErrors); assert(feature_context.result.hasErrors); version (behaviour_unitdata) "/tmp/bdd_which_has_scenario_errors.hibon".fwrite(feature_context.result); } { // The constructor of both scenarios has been called, this means that no errors is reported // Calls the construction for the Some_awesome_feature scenario feature_with_ctor.Some_awesome_feature(42, "with_ctor"); feature_with_ctor.Some_awesome_feature_bad_format_double_property(17); const feature_context = feature_with_ctor.run; assert(!feature_context.result.scenarios[0].hasErrors); assert(!feature_context.result.scenarios[1].hasErrors); assert(!feature_context.result.hasErrors); version (behaviour_unitdata) "/tmp/bdd_which_has_no_errors.hibon".fwrite(feature_context.result); }