我无法弄清楚问题。
方法testTest1()未执行。它应该打开yahoo.com。
package example1;
import org.testng.annotations.*;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class SimpleTest extends SeleneseTestCase {
private DefaultSelenium selenium;
@BeforeSuite(alwaysRun = true)
public void setUp() throws Exception {
echo("in setup.");
selenium = new DefaultSelenium("localhost",
4444, "*opera", "http://localhost:8080/");
echo("selenium instance created:"+selenium.getClass());
selenium.start();
echo("selenium instance started. Opening website...");
}
@Test(sequential=true)
public void testTest1() throws Exception {
echo("testTest1:testing assertion.");
selenium.open("http://www.yahoo.com");
}
// Cleanup the selenium environment
@AfterSuite(alwaysRun = true)
private void stopTest() {
selenium.stop();
echo("selenium stopped.");
}
private void echo(String msg){
System.out.println(msg);
if(new Boolean(System.getProperties().getProperty("DEBUG")))
System.out.println(msg);
}
}
脚本没有打开yahoo.com 最后说:
Total tests run: 0, Failures: 0, Skips: 0
任何人都可以告诉我需要什么吗?
提前致谢。
答案 0 :(得分:0)
你好jzd
我是这样跟着的
用于启动服务器
srinath @ srinath-Vostro1510:〜/ Desktop / testws / lib $ java -jar selenium-server.jar -multiwindow
20:17:34 INFO - 版本Jetty / 5.1.x
20:17:34 INFO - 启动HttpContext [/ selenium-server / driver,/ selenium-server / driver]
20:17:34 INFO - 启动HttpContext [/ selenium-server,/ selenium-server]
20:17:34 INFO - 启动HttpContext [/,/]
20:17:34 INFO - 在0.0.0.0:4444上启动SocketListener
20:17:34 INFO - 开始org.mortbay.jetty.Server@3487a5cc
现在运行命令启动脚本:
setClassPath:
INIT:
清洁:
[删除]删除目录/ home / srinath / Desktop / testws / build
编译:
[回声]制作目录...
[mkdir]创建了目录:/ home / srinath / Desktop / testws / build
[echo] classpath:/home/srinath/Desktop/testws/lib/junit.jar:/home/srinath/Desktop/testws/lib/selenium-java-client-driver-tests.jar:/home/srinath/Desktop/ testws / lib目录/硒-Java的客户端driver.jar:/home/srinath/Desktop/testws/lib/selenium-server-0.9.1-20070223.200626-116-standalone.jar:/家庭/ srinath /桌面/ testws / LIB /硒的server.jar:/home/srinath/Desktop/testws/lib/testng-5.5-jdk15.jar:/home/srinath/Desktop/testws/lib/testng.jar
[echo]编译...
[javac] /home/srinath/Desktop/testws/build.xml:68:警告:'includeantruntime'未设置,默认为build.sysclasspath = last;对于可重复的构建,设置为false
[javac]将1个源文件编译为/ home / srinath / Desktop / testws / build
运行:
[testng] [Parser]跑步:
[testng] /home/srinath/Desktop/testws/config/testng.xml
[testng]
设置中的[testng]
[testng] selenium实例创建:class com.thoughtworks.selenium.DefaultSelenium
[testng] selenium实例开始了。开通网站...
[testng]
[testng] ===============================================
[testng] suite1
[testng]总测试运行:0,失败:0,跳过:0
[testng] ===============================================
[testng]
建立成功的作用
总时间:1分59秒