我浏览 stackoverflow 已经有几天了,试图找到如何重新运行整个测试类,而不仅仅是一个@Test步骤。许多人说 TestNG 和 不支持此功能IRetryAnalyzer,而有些人已经发布了解决方法,但实际上并没有用。有没有人设法做到这一点?并且只是为了澄清其原因,以避免回答说不支持的目的:TestNG 不仅是开发人员的工具。意思是 sw 测试人员也用于 e2e 测试。E2e 测试可以包含依赖于前一个测试的每个步骤。所以是的,重新运行整个测试类是有效的,而不是简单的@Test,这很容易通过IRetryAnalyzer.
我想要实现的一个例子是:
public class DemoTest extends TestBase {
@Test(alwaysRun = true, description = "Do this")
public void testStep_1() {
driver.navigate().to("http://www.stackoverflow.com");
Assert.assertEquals(driver.getCurrentUrl().contains("stackoverflow)"));
}
@Test(alwaysRun = true, dependsOnMethods = "testStep_1", description = "Do that")
public void testStep_2() {
driver.press("button");
Assert.assertEquals(true, driver.elementIsVisible("button"));
}
@Test(alwaysRun = true, dependsOnMethods = "testStep_2", description = "Do something else")
public void testStep_3() {
driver.press("button2");
Assert.assertEquals(true, driver.elementIsVisible("button"));
}
}
Run Code Online (Sandbox Code Playgroud)
假设 …
下载插件后,无法访问Jenkins服务器.我正在使用Windows 7.我试图手动启动Windows Jenkins服务,但我收到以下消息:
"Windows无法在Local COmputer上启动Jenkins服务.错误1067:进程意外终止"
我也尝试从安装目录运行jenkins.exe,但没有成功.在错误日志中,我看到以下内容:
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
???? 06, 2014 11:31:46 ?? hudson.model.DownloadService$Downloadable doPostBack
INFO: Obtained the updated data file for hudson.tools.JDKInstaller
???? 06, 2014 11:32:18 ?? hudson.model.UpdateCenter doSafeRestart
INFO: Scheduling Jenkins reboot
???? 06, 2014 11:33:00 ?? hudson.model.UpdateCenter$DownloadJob run
INFO: Starting the installation of FTP-Publisher Plugin on behalf of anonymous
???? 06, 2014 11:33:15 ?? hudson.model.UpdateCenter doRestart
INFO: Scheduling the core downgrade
???? 06, 2014 11:33:25 ?? hudson.model.UpdateCenter$UpdateCenterConfiguration download
INFO: Downloading FTP-Publisher …Run Code Online (Sandbox Code Playgroud) 我的testNG测试中有以下格式:
@Test(alwaysRun = true, dependsOnMethods = "testStep_1", description = "Enter the names, and verify that they are appearing correctly ")
public void testStep_2() throws Exception{
}
Run Code Online (Sandbox Code Playgroud)
有没有办法实现可以读取所有测试描述的东西,并通过生成测试文档.我尝试以某种方式包含ITestNGMethod getDescription() 到afterInvocation(IInvokedMethod method, ITestResult testResult)每个方法运行后,返回描述,但没有成功.有没有人尝试类似的东西?
在作业配置中,有一个复选框"限制可以运行此项目的位置".如果选择它,则会有一个关于Label Expression的输入字段.有没有办法在那里插入正则表达式,而不是确切的名称?如果是的话,你能提供一个例子吗?这背后的整个概念是,我想将限制作业分配给自动创建的具有相似名称的从属
我正在运行以下代码:
DateFormat fullDate = new SimpleDateFormat("HHmmdd/MMMyy");
Date date = fullDate.parse("035627/NOV15");
Run Code Online (Sandbox Code Playgroud)
并抛出以下异常:
Exception in thread "main" java.text.ParseException: Unparseable date:"035627/NOV15
Run Code Online (Sandbox Code Playgroud)
任何想法,为什么抛出异常,而格式有效说明?