jeudi 24 août 2017

Should I write at least one "expect condition" in a test case?

This question could seem silly but I found no convention about it so I want to be sure.

I have a test suite that contains some tests. In one test case, I am testing something that does not return anything on success and throws an exception on error.

My question is : should I write at least one "expect-like" condition in the test ?

For example, in javascript jasmine :

describe("Test suite", () => {
  it("should pass without error", () => {
    object.doSomething(); // Throws an Error on error
    // No expect() here because I have nothing to check
  });
});

Aucun commentaire:

Enregistrer un commentaire