testng 相关问题

TestNG是一个测试框架,专注于提供Java编程语言中的单元和功能测试功能。它支持并行测试,数据提供程序,依赖项,组和其他功能。

如何使用Testng重新运行失败的测试用例的整个测试类?

我想重新运行失败的测试用例的失败测试类,以便我可以反驳所有之前的依赖测试用例。 尝试使用 ITestListener 和 IRetryAnalyzer,使用 onTestFailure 类...

回答 1 投票 0

如何将单个 dataProvider 用于一系列测试用例?

我的用例是,我有一个使用数据提供程序的基本测试用例,并且该数据提供程序的单个实例由一系列测试用例使用。 @Test(dataProvider="TestData",

回答 1 投票 0

测试/场景未使用 testng Cucumber 执行

从 TestNG 运行程序类(Testng-Cucumber)执行测试后获得以下输出,但没有执行任何测试 - [RemoteTestNG] 检测到 TestNG 版本 7.4.0 通过:运行场景(“

回答 1 投票 0

无法使用 Testng 运行 Cucumber。但是如果我在功能文件中执行,它就可以工作

在 TestNg Runner 中我没有执行代码,但是使用功能文件我得到了结果 我需要使用 TestNg runner 执行。显示以下错误 [TestNG] 未找到测试。没有运行任何内容 用途: 在 TestNg Runner 中我没有执行代码,但使用功能文件我得到结果 我需要使用 TestNg runner 执行。显示以下错误 [TestNG] No tests found. Nothing was run Usage: <main class> [options] The XML suite files to run Options: -alwaysrunlisteners Should MethodInvocation Listeners be run even for skipped methods Default: true -configfailurepolicy Configuration failure policy (skip or continue) -d Output directory -dataproviderthreadcount Number of threads to use when running data providers -dependencyinjectorfactory The dependency injector factory implementation that TestNG should use. -excludegroups Comma-separated list of group names to exclude -failwheneverythingskipped Should TestNG fail execution if all tests were skipped and nothing was run. Default: false -generateResultsPerSuite Should TestNG consider failures in Data Providers as test failures. Default: false -groups Comma-separated list of group names to be run -ignoreMissedTestNames Ignore missed test names given by '-testnames' and continue to run existing tests, if any. Default: false -includeAllDataDrivenTestsWhenSkipping Should TestNG report all iterations of a data driven test as individual skips, in-case of upstream failures. Default: false -junit JUnit mode Default: false -listener List of .class files or list of class names implementing ITestListener or ISuiteListener -methods Comma separated of test methods Default: [] -methodselectors List of .class files or list of class names implementing IMethodSelector -mixed Mixed mode - autodetect the type of current test and run it with appropriate runner Default: false -objectfactory List of .class files or list of class names implementing ITestRunnerFactory -overrideincludedmethods Comma separated fully qualified class names of listeners that should be skipped from being wired in via Service Loaders. Default: false -parallel Parallel mode (methods, tests or classes) Possible Values: [tests, methods, classes, instances, none] -port The port -propagateDataProviderFailureAsTestFailure Should TestNG consider failures in Data Providers as test failures. Default: false -reporter Extended configuration for custom report listener -spilistenerstoskip Comma separated fully qualified class names of listeners that should be skipped from being wired in via Service Loaders. Default: <empty string> -suitename Default name of test suite, if not specified in suite definition file or source code -suitethreadpoolsize Size of the thread pool to use to run suites Default: 1 -testclass The list of test classes -testjar A jar file containing the tests -testname Default name of test, if not specified in suitedefinition file or source code -testnames The list of test names to run -testrunfactory, -testRunFactory The factory used to create tests -threadcount Number of threads to use when running tests in parallel -threadpoolfactoryclass The threadpool executor factory implementation that TestNG should use. -usedefaultlisteners Whether to use the default listeners Default: true -log, -verbose Level of verbosity -xmlpathinjar The full path to the xml file inside the jar file (only valid if -testjar was specified) Default: testng.xml 要通过 TestNG 运行 Cucumber 功能,请确保完成以下步骤: 包含 Cucumber-testNG 依赖项:https://mvnrepository.com/artifact/io.cucumber/cucumber-testng Cucumber runner 类已创建,例如: package testrunners; import io.cucumber.testng.AbstractTestNGCucumberTests; import io.cucumber.testng.CucumberOptions; @CucumberOptions( features = "src/test/resources/features", glue = {"stepdefinitions"}, plugin = { "pretty", "json:cucumber.json" } ) public class TestRunner extends AbstractTestNGCucumberTests {} 该类必须扩展 AbstractTestNGCucumberTests 类 src/test/resources/features 是包含 .feature 文件的文件夹的路径 stepdefinitions 是包的名称,其中包含已实现步骤的代码的类。 TestNG XML 运行上述步骤中的 Cucumber 运行程序类,例如: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Default Suite" configfailurepolicy="continue" time- out="60000"> <test name="Main tests"> <classes> <class name="testrunners.TestRunner"/> </classes> </test> </suite> 通过此设置,您应该能够运行 TestNG XML,它将执行位于指定文件夹中的所有 .feature 文件中的所有场景。

回答 1 投票 0

如何在playwright java和testng框架中录制以自定义文件名作为测试方法名称的测试视频

我的测试类定义为 - 公共类示例扩展 BaseTest { 私有登录页面登录页面; @覆盖 公共无效初始化(){ 登录页面 = createInstance(登录页面.class)

回答 3 投票 0

在jmockit单元测试中设置系统属性

结合使用testng和jmockit来做一些单元测试。在我正在测试的方法中,它尝试访问我使用 JBoss 部署脚本设置的系统属性,因此我的单元测试......

回答 2 投票 0

Mockito,@InjectMocks 最终字段的奇怪行为

我看到了我认为是错误的行为。 @InjectMocks 似乎并没有在每个测试方法之前创建一个新的测试主题。正如@Mock 所做的那样。在下面的例子中,如果Subject.section是...

回答 1 投票 0

为什么我收到“会话 ID 为空。调用 quit() 后使用 WebDriver?” SeleniumWebdriver 中的异常?

我收到“org.openqa.selenium.NoSuchSessionException:会话 ID 为空。调用 quit() 后使用 WebDriver?”我运行测试用例时出现异常。 我的测试课是这样的; ...

回答 1 投票 0

如何仅在从jenkins运行时运行特定代码?

我有下面的代码用于调用 chromedriver。在所有 chrome 选项中,仅当我从

回答 1 投票 0

从 Maven 运行特定的 TestNG 组

我有两组测试用例,如下所述。 @Test(组=“一个”,dataProvider =“TestData”) 公共无效firstTest(字符串数据){ //代码 } @Test(组=“一个”,dataProvider =“TestData”) 酒吧...

回答 2 投票 0

子类不继承父类变量

我是硒的新手。我尝试创建一个自动化测试项目。在那里,我为每个网页创建了类,并在我的测试包中创建了一个 baseTest 类,在其中启动浏览器和操作...

回答 1 投票 0

testng 测试用例中的调试问题

我使用的是intelliJ v2021.3.2(社区版) 我的项目是 java Maven TestNG (v7.4.0) 项目 当我运行测试用例时,它执行成功,但是当我尝试调试时,出现以下错误...

回答 3 投票 0

使用 Maven 使用 TestNG 执行 Selenium 测试期间出现“java.lang.Error:未解决的编译问题”

我使用 Selenium 和 TestNG 进行自动化测试。我使用 Maven 作为软件项目管理和理解工具。我的类路径中有所有 Maven 依赖项。但我还是因为:

回答 2 投票 0

如何对字符串变量使用threadlocal并在并行类执行期间存储不同的运行时值?我面临多个问题

ISSUE1:我有一个变量“名称”,它将具有一些运行时值,并且我在跨包的类中使用该值,而且我无法在方法中返回该值,因为我已经返回了

回答 1 投票 0

来自多个魅力报告的汇总数据

Allure 报告工具旨在为每次测试运行显示一份报告。开发人员警告过我这一点。无论如何,我需要这个方便的工具提供更多功能。 您是否想过将诱惑报告保留几天/...

回答 1 投票 0

倾城标题注释

Allure Report 是否可以默认显示不更改的测试名称? 当前行为:它将测试名称按单词分隔,并为测试名称中的每个单词设置大写字母。 我正在使用 TestNG 测试

回答 1 投票 0

如何在 IntelliJ IDE 中配置 testNG

我有一个带有nestNG插件的testNG项目在Eclipse上运行,但我想配置pom.xml以便也能够在IntelliJ上运行。 我尝试使用与应用程序相同版本的 testNG...

回答 2 投票 0

TestNG 是否可以在@BeforeMethod失败时截屏?

有一些典型的解决方案可以在@Test失败时捕获屏幕截图,但是是否可以在@Before/After Class/Method失败时执行此操作? 为什么我需要那个? - 特别是对于@来说会很好

回答 3 投票 0

如何使用TestNG/Selenium/Java声明全局变量?

我对自动化测试完全陌生。 出于练习目的,我想使用 TestNG 在 Selenium 中为联系表单创建测试。这是我用来练习的页面。我创建了几个测试c...

回答 1 投票 0

如何使用 testng 对列表中的所有数据运行相同的测试用例?

我正在使用数据提供程序和测试 ng 使用列表中的不同值多次运行相同的测试。但是,我有几个测试,我希望它们都一一运行,所以测试 1 -> 测试...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.