Javascript CasperJS将每个断言都计算为一个测试。。。那是不对的!如何对这些进行分组?

Javascript CasperJS将每个断言都计算为一个测试。。。那是不对的!如何对这些进行分组?,javascript,testing,integration-testing,casperjs,qa,Javascript,Testing,Integration Testing,Casperjs,Qa,我正在用CasperJS编写集成测试,但是输出有一个问题,IMO:它将每个断言作为一个测试,而不是允许测试中包含多个断言,如JUnit、Nunit等 有没有办法告诉Casper每个断言实际上不是一个测试,只是一个断言 例如: casper.test.begin("This is my first test", 3, function(test) { test.assert(true); test.assert(true); test.assert(true); test.done

我正在用CasperJS编写集成测试,但是输出有一个问题,IMO:它将每个断言作为一个测试,而不是允许测试中包含多个断言,如JUnit、Nunit等

有没有办法告诉Casper每个断言实际上不是一个测试,只是一个断言

例如:

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 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.
当我在TeamCity上报告这一点时,它显示通过了6个测试,这是不正确的。我只有两次测试,不是六次。每个测试有3个断言

相反,我希望看到以下输出:

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.
理想情况下,测试将根据它们来自的文件按套件分组,每个test.begin将准确地表示:一个新的测试。将每个断言作为一个测试进行计数是毫无意义的

有没有办法做到这一点?也许使用CasperJS和其他工具


谢谢

我不确定问题出在哪里。请展示一个示例输出和您期望的结果。另外,请查看您的回复。谢谢您的回复,我已经更新了我的问题。我确实在使用-xunit。我想知道我需要的是将Casper包装到另一个能够正确解释测试的工具中吗?断言!=Test@ArtjomB.他试图运行一组断言,并认为分组是1个测试。正如他所解释的,这就是其他测试套件的行为。我也有同样的问题,我正在寻找解决办法。Edy,如果您找到了使用CasperJS的解决方案,请分享:-