问题标签 [errorcollector]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 使用 Junit 执行 Selenium 测试用例时在 excel 文件中存储错误
我想在使用 Junit 对 HTML 字段执行 Selenium 测试用例时将错误存储在 excel 文件中。
我的代码是:
}
这段代码工作正常。
但是如何检索变量或数据类型中的所有错误。我正在使用以下代码:
mockito - 如何在 Mockito 中使用软断言?
我知道我们可以使用不会立即通过单元测试的软断言ErrorCollector
(AssertJ或TestNG)。
它们如何与 Mockito 断言一起使用?或者如果他们不能,Mockito 是否提供任何替代方案?
代码示例
问题
在这段代码中,如果验证失败,则测试将失败,这将中止剩余的verify
语句(可能需要多次测试运行,直到显示此单元测试的所有失败,这很耗时)。
java - JUnit5 是否有类似的 ErrorCollector 规则
JUnit4 中有 ErrorCollector 规则,现在我们必须在迁移到 JUnit5 期间切换到扩展。此处描述了 ErrorCollector 的用法https://junit.org/junit4/javadoc/4.12/org/junit/rules/ErrorCollector.html JUnit5 中 是否有类似的扩展。我在 assert-j https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/junit/jupiter/SoftAssertionsExtension.html中找到了一个,但是是一样的JUnit 5 仍然支持作为扩展?
注意:我想在系统测试级别上使用它。所以我将有 Step 1 -> assertion -> Step 2-> assertion->... assertAll 在我看来是更糟糕的选择,因为我必须存储用于验证的值并在测试结束时断言它们,而不是在地方我从哪里得到这些值。
这种方法看起来不清晰,看起来比这里描述的更糟糕https://assertj.github.io/doc/#assertj-core-junit5-soft-assertions