jeudi 15 octobre 2015

Testing with Expresso, importing functions to tests.js

Sorry for the really basic question, but I haven't written tests ever before. I decided to go with Expresso, which seemed like the most basic and simplistic testing framework.

Generally I can make sense of the examples, such as this one:

exports.testsStringLength = function(beforeExit, assert) {
    assert.equal(6, 'foobar'.length);
};

Now to the part that I don't understand and no tutorial actually mentions. I know that I have to put these tests in a separate file, like tests.js and run "expresso tests.js". But how do I move my code over to the tests.js file?

Am I supposed to copy-paste code over to tests.js? What is the general workflow?

Again, sorry for the really basic question. Zero experience with testing.

Aucun commentaire:

Enregistrer un commentaire