'CasperJS counts each assertion as a Test... That's not right! How to group these?
I'm writing integration tests with CasperJS, but the output has an issue, IMO: it counts each assertion as a test, instead of allowing for tests to have multiple assertions in them (like JUnit, Nunit, etc).
Is there a way to tell Casper that each assertion is actually not a test, but just an assertion?
For example:
casper.test.begin("This is my first test", 3, function(test) {
test.assert(true);
test.assert(true);
test.assert(true);
test.done();
});
casper.test.begin("This is my second test", 3, function(test) {
test.assert(true);
test.assert(true);
test.assert(true);
test.done();
});
This will yield this output:
# This is my first test
PASS Subject is strictly true
PASS Subject is strictly true
PASS Subject is strictly true
# This is my second test
PASS Subject is strictly true
PASS Subject is strictly true
PASS Subject is strictly true
PASS 6 tests executed in 0.028s, 6 passed, 0 failed, 0 dubious, 0 skipped.
When I report this on TeamCity, it shows 6 tests passed, which is not true. I have just two tests, not six. Each test makes 3 assertions.
Instead, I'd expect to see the following output:
PASS This is my first test
- Subject is strictly true
- Subject is strictly true
- Subject is strictly true
PASS This is my second test
- Subject is strictly true
- Subject is strictly true
- Subject is strictly true
PASS 2 tests executed in 0.028s, 2 passed, 0 failed, 0 dubious, 0 skipped.
Ideally tests would be grouped by suites according to the file they come from, and each test.begin would signify exactly that: a new test. Having each assertion counting as a test makes no sense at all.
Is there a way to accomplish this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
