简体   繁体   English

DependONGroups注释测试

[英]DependONGroups annotation testng

I am using DependOnGroups parameter in @test annotation.the code looks like, 我在@test批注中使用DependOnGroups参数。代码看起来像这样,

@Test(groups={"datacompare"},dependsOnGroups = {"AzkabanFlow"})

Now the requirement is we need to run the test only for the group datacompare which is done by specifying the maven parameter, 现在的要求是我们只需要对组数据比较运行测试,这是通过指定maven参数完成的,

clean test site -DtestGroup=datacompare

Since the above group has dependency with the group azkban flow, i am getting the error 由于上述组与组azkban流具有依赖性,因此我得到了错误

[ERROR] DependencyMap::Method "DataValidationTestSuite.data_Comparison(java.lang.reflect.Method)[pri:0, instance:com.kohls.test.automation.framework.testsuite.DataValidationTestSuite@1608e1a]" depends on nonexistent group "AzkabanFlow"

Can someone suggest me a way to run the test for datacompare without removing the parameter DependOnGroups and also not calling the particular group mentioned in dependOnGroup parameter in maven parameter for test run. 有人可以建议我一种方法来运行数据比较测试,而不删除参数DependOnGroups,也不要在maven参数中调用dependOnGroup参数中提到的特定组进行测试运行。

You might want to change your @Test annotation to something like below 您可能需要将@Test批注更改为如下所示的内容

@Test(groups={"datacompare"},dependsOnGroups = {"AzkabanFlow"}, ignoreMissingDependencies=true)

This would cause TestNG to ignore missing dependencies and hopefully it should solve your problem as well. 这将导致TestNG忽略缺少的依赖关系,并希望它也可以解决您的问题。

Javadocs for the same can be referred here . 可以在这里引用相同的Javadocs。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM