【发布时间】:2012-02-08 10:22:54
【问题描述】:
我不希望 Junit 按顺序调用我的测试方法/硒测试用例。但我希望执行特定的测试用例,否则应该根据我的需要调用它。
示例代码:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class demo2 {
Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.co.in/");
selenium.start();
selenium.setTimeout("6000");
}
@Test
public void test_3() throws Exception {
selenium.open("/");
selenium.type("q", "3");
}
@Test
public void test_4() throws Exception {
selenium.open("/");
selenium.type("q", "4");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
注意
我希望根据条件调用 test_3,test_4.... 方法。
【问题讨论】: