Examples: Shows how to use a automation on scenarios with constructor and the hasParssed
// Test of hasPassed function on Scenarios and Feature import WithCtor = tagion.behaviour.BehaviourUnittestWithCtor; auto feature_with_ctor = automation!(WithCtor)(); feature_with_ctor.Some_awesome_feature(42, "with_ctor"); feature_with_ctor.Some_awesome_feature_bad_format_double_property(17); { // None of the scenario passes const feature_context = feature_with_ctor.run; version (behaviour_unitdata) "/tmp/bdd_sample_has_failed.hibon".fwrite(feature_context.result); assert(!feature_context.result.scenarios[0].hasPassed); assert(!feature_context.result.scenarios[1].hasPassed); assert(!feature_context.result.hasPassed); } { // One of the scenario passed WithCtor.pass_one = true; const feature_context = feature_with_ctor.run; version (behaviour_unitdata) "/tmp/bdd_sample_one_has_passed.hibon".fwrite(feature_context.result); assert(!feature_context.result.scenarios[0].hasPassed); assert(feature_context.result.scenarios[1].hasPassed); assert(!feature_context.result.hasPassed); } { // Some actions passed passes WithCtor.pass_some = true; WithCtor.pass_one = false; const feature_context = feature_with_ctor.run; version (behaviour_unitdata) "/tmp/bdd_sample_some_actions_has_passed.hibon".fwrite(feature_context.result); assert(!feature_context.result.scenarios[0].hasPassed); assert(!feature_context.result.scenarios[1].hasPassed); assert(!feature_context.result.hasPassed); } { // All of the scenario passes WithCtor.pass = true; /// Pass all tests! WithCtor.pass_some = false; const feature_context = feature_with_ctor.run; version (behaviour_unitdata) "/tmp/bdd_sample_has_passed.hibon".fwrite(feature_context.result); assert(feature_context.result.scenarios[0].hasPassed); assert(feature_context.result.scenarios[1].hasPassed); }