OSD Lab 8 (Part 2 to lab 7)

This Lab continues off from lab 7, So to understand what this blog is talking about please read my lab 7 blog! Blog lab 7.

Testing Frameworks

In the first part of this lab, we had to pick a testing framework, to make sure the code we write, does exactly what we want it to do so these were the frameworks we could use:

  1. Jest
  2. Mocha
  3. Chai
  4. Sinon
  5. Cucumber

To follow the professor’s instruction, I decided to stick to Jest. It was pretty simple to use, and the code was provided to write a test.

var seneca = require('./seneca');

test('isValid returns true for simple myseneca address', function() {
  var simpleEmail = 'someone@myseneca.ca';
  expect(seneca.isValidEmail(simpleEmail)).toBe(true);
});

Now we had to make sure, that the test we write works and passes the Travis CI. Unfourtnenly mine does not, and I’m currently looking at it why it won’t pass.

Later in this lab, we were told to write our own code to make multiple tests.

Conclusion

This lab was very useful since I have not done much code testing. The only time I was ever told to test my code was in java with Junit. So it was nice to learn how to test a diff language.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s