首页 > 解决方案 > TestNG Runner 类忽略测试

问题描述

我正在通过 TestNG 运行器类运行我的测试用例,但问题是当运行器类中只有 1 个类时,所有测试都正确执行。正确执行 xml 正确执行 XML 而如果在运行器类中有超过 1 个类,我会被忽略测试用例和套件仅从两个类运行 1 个测试用例(方法)。 不正确的 Xml 执行 有人可以建议。

标签: seleniumtestingselenium-webdriverintellij-ideatestng

解决方案


Try @Test(alwaysRun = true), For before methods ( beforeSuite, beforeTest, beforeTestClassand beforeTestMethod, but not beforeGroups):如果设置为 true,则无论它属于哪个组,都将运行此配置方法。对于 after 方法 ( afterSuite, afterClass, ...):如果设置为 true,即使之前调用的一个或多个方法失败或被跳过,也会运行此配置方法。


推荐阅读