Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Number of Expectations pass through #4

Closed
jacobboland opened this Issue May 31, 2013 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

jacobboland commented May 31, 2013

Passing in a number of expectations for each test case is available, but how about expectations of all tests provided by the cases?

When the test cases of an empty object is run, the following test run would not result in a failure, ...because no tests will be run.

Qunit
.cases(someObj.threes)
.test("all are traversed", function(i){
equal(i, 3, "this element is exactly 3");
});

While this is easy to handle if we do a good job of validating visually that the tests were run to the expected number of times.

I propose adding a way to expect through the entire run, the number of assertions.

Qunit
.expect(2)
.cases(someObj.threes)
.test("all are traversed", function(i){
equal(i, 3, "this element is exactly 3");
});

This could result in a new test just asserting the number of assertions, which would save an extra written test for non-empty.

Another option would be to take this in as the [expect] argument, but there could be a case for this to be used to assert there are a certain number of assertions per test.

Thoughts?

Owner

AStepaniuk commented Jun 1, 2013

Hmm... it sounds like we need to have a test for tests (testcases).

It is a very good notice that tests are not run in case of empty object passed. I think there should be a default built-in verification for such a case.
Although it is a non-backward compatible change it makes sense to add such a verification.

When an empty test cases set is provided, an assertion, which always fails, should be added automaticaly . It would help to avoid the situations when tests are never run.

Owner

AStepaniuk commented Jun 5, 2013

Here is a branch for implementation this enhancenent https://github.com/AStepaniuk/qunit-parameterize/tree/Issue4

Owner

AStepaniuk commented Jun 9, 2013

Enhancement is available since v0.4

@AStepaniuk AStepaniuk closed this Jun 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment