iensu / mocha-cakes-2

A BDD plugin for Mocha testing framework
MIT License
43 stars 10 forks source link

Data driven testing? #7

Closed keyjm closed 7 years ago

keyjm commented 7 years ago

Hi,

Is it possible to create data driven tests with this library? I am using this with chakram and would like to avoid creating multiple test cases for same same assertion. Any examples? Thanks,

iensu commented 7 years ago

Hi @kunalmalviya!

Could you give me a concrete example of what you mean? I assume it's something like the code below, but correct me if I'm wrong:

listOfTestData.forEach((testData) => {
   scenario(`Testing ${testData.description}`, () => {
      given(...);
      ...
   });
});

That should work fine. I've done similar things like that in plain mocha and there should be no difference. Please tell me if you encounter any issues.

keyjm commented 7 years ago

Thank you. It seems I was able to make it work.

iensu commented 7 years ago

Ok great! I'll close this issue then! :)