hooks to run different setup and clean for each test case in mocha -
i developing mocha automation framework. in there 2 hooks beforeeach() , aftereach() executed each test case. have defined test setup , cleanup in these hooks. have different setup , cleanup each test case, cant able use beforeeach() , aftereach().
describe() { beforeeach(setup) //test setup it(test1) it(test2) it(test3) aftereach(cleanup)//test cleanup }
in above code, each test follows different setup , cleanup. there other hooks or methods satisfies condition, i.e. hooks allows different setup , cleanup individual test case?
if setup , cleanup different each test, should this:
function test1() { # setup test1setup(); # execute code under test # cleanup test1cleanup(); }
do see (or have encountered) issues that?
Comments
Post a Comment