I'd like to write dynamic tests a-la scenario outlines for cucumber.
describe "Generic tests for all Cryptocurrencies", ->
#it "generates a describe for each implemented coin", ->
for coin in cryptoClassesList
describe "Generic tests for #{coin}",
it "has a code", ->
coin.should.have.a.property "code"
it "has a name", ->
coin.should.have.a.property "name"
coin.name.should.not.equal ""
my problem is that the **cryptoClassesList** dictionary is available only within a **it** function, not within **describe**. And if I create **describe** tests within a **it**, they are not run (wrong assertions pass).
Can one of those problems be solved ?
- make cryptoClassesList available at describe level
- Make describe built within a it discoverable and executable by mocha
As you can see
in the code, the cryptoClassesList dictionary is built dynamically, one element added per file in the directory. So I cannot try to import the variable with a require before the describe, as I would need to know what is the latest file that added an element to the variable.
Thank you for your help