如果一个TestCase(Class)失败,为什么TestNG会继续执行测试?
例如,testoutput是:
1 test passed, 1 test failed.(3599,0 s)
TestSuite FAILED
run FAILED: check5=3 Expected: <3> got: <5>
run passed (1.0s) // <--- this should not have been executed
Run Code Online (Sandbox Code Playgroud)
为什么第二次运行甚至被执行?我的testngsuite.xml:
<suite name="TestSuite_03">
<test name="TestCase_17">
<groups>
<run><include name="functest"/></run>
</groups>
<classes>
<class name="TestStep_003" desc="will fail" />
<class name="TestStep_012" desc="will pass" />
</classes> ...
Run Code Online (Sandbox Code Playgroud)
我通过NetBeans使用Maven,TestNG和Java
我的结构:
public abstract class TestCommon
{
@BeforeSuite(groups={"functest})
public void BeforeSuite()
{
// clean report folder
}
@BeforeTest(groups={"functest})
public void BeforeTest()
{
// start selenium browser
}
@AfterMethod(groups={"functest})
public …Run Code Online (Sandbox Code Playgroud) 这按预期工作,测试失败(由于haltTesting())并重复2x
public class A0001_A0003Test extends TestControl {
private Kunde kunde = Kunde.FR_WEHLITZ;
@Test(retryAnalyzer = TestRepeat.class, groups = {TestGroups.FAILED}, description = "verify adress")
public void testkundenDaten_Angaben() throws Exception {
bifiTestInitial();
testActions.selectKunde(kunde);
haltTesting();
}
}
Run Code Online (Sandbox Code Playgroud)
但因为我在一个类中有多个测试,所以我在类级别定义了重复分析器
@Test(retryAnalyzer = TestRepeat.class)
public class A0001_A0003Test extends TestControl {
private Kunde kunde = Kunde.FR_WEHLITZ;
@Test(groups = {TestGroups.FAILED}, description = "verify adress")
public void testkundenDaten_Angaben() throws Exception {
bifiTestInitial();
testActions.selectKunde(kunde);
haltTesting();
}
}
Run Code Online (Sandbox Code Playgroud)
但随后测试不再重复,文档说:
类级别@Test注解的作用是使该类的所有公共方法即使没有注解也成为测试方法。如果您想添加某些属性,您仍然可以在方法上重复 @Test 注释。
所以这应该是可能的,还是我期待错误的结果?
我无法使用 Appium 向下滚动到 Android 应用程序中任何页面的底部。尝试了多种方法,包括在 Stack Overflow 上找到的方法。(这个挑战似乎很常见。)然而,所有的尝试都失败了。
环境:
System.out.println(driver.getContext());,结果是NATIVE_APP请分享可以解决此问题的任何替代方案或改进。非常感谢任何有用的建议!
以下总结了尝试的各种方法:
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(resourceId(\"send-to-email-app\"));").click();
try {
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Send\"))");
}catch(Exception e) {
System.out.println("We got an error scrolling!");
}
driver.swipe(0, Startpoint,0,scrollEnd,1000);
...touchAction.longPress(fromX, fromY).moveTo(toX, toY).release().perform();
TouchAction touchAction = new TouchAction(driver);
touchAction.longPress(10, 10).moveTo(x, y).release().perform();
我对Maven和Netbeans一无所知,我更新了我的netbeans,现在我的测试不再适用了:
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): pr-dfs-bank- 00.emea.isn.corpintra.net: Unknown host pr-dfs-bank-00.emea.isn.corpintra.net -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Run Code Online (Sandbox Code Playgroud)
如何使用netbeans激活-e或-X开关,我看到很多带有"mvn clean"等的例子,但我通过Netbeans安装了Maven,所以我没有在命令行的文件夹上.我没有收到错误消息,想要查看更详细的日志. …
我的Maven:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<groups>
com.rubberduck.TestState.Ready
</groups>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的课:
package com.rubberduck;
public class TestState
{
public interface Ready {
/* to allow filter ready tests as groups */
}
public interface InProgress {
/* to allow filter ready tests as groups */
}
public interface NotTested {
/* to allow filter ready tests as groups */
}
}
Run Code Online (Sandbox Code Playgroud)
我的测试:
@Test(timeout = 60000)
@Category(TestState.Ready.class)
public void test() throws Exception {
assertEquals(true, true);
}
Run Code Online (Sandbox Code Playgroud)
我的错误:
Failed to execute goal …Run Code Online (Sandbox Code Playgroud) 为什么结果不同?如果我使用浮动它得到,675如果我使用双我得到,674 ...不是很奇怪?
float f = 12345.6745;
double d = 12345.6745;
Locale l = Locale.forLanguageTag("es-ES");
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(l);
print(df.format(f));
>> 12.345,675
l = Locale.forLanguageTag("es-ES");
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(l);
print(df.format(d));
>> 12.345,674
Run Code Online (Sandbox Code Playgroud)
谢谢
我有两个项目
D:\Project_A\src...
D:\Project_B\src...
Run Code Online (Sandbox Code Playgroud)
现在我想通过Project_A从Project_B访问Java文件.
如果解决方案不涉及IDE中的任何点击,我将不胜感激,因为它应该是独立于IDE的.
即:
package Project_A
import Project_B.src.test.meow.wuff.MyClass
MyClass x = new MyClass();
Run Code Online (Sandbox Code Playgroud)