我用 JSF 2.2.12、Prime Faces 6 和 Omnifaces 创建了一个 java web 应用程序。在后端,我有 Spring、Hibernate 等标准层,我的应用服务器是 Glassfish 4.1.1,我正在使用 Arquillian 实现一些测试。奇怪的是,在 Linux(Ubuntu 16)上可以工作,但在 Windows 上却不行。
这是我的 Arquillian.xml 文件
<?xml version="1.0"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="glassfish" default="true">
<configuration>
<property name="remoteServerAddress">localhost</property>
<property name="remoteServerHttpPort">8080</property>
<property name="remoteServerAdminPort">4848</property>
</configuration>
</container>
<extension qualifier="webdriver">
<property name="browser">chrome</property>
<property name="remoteReusable">true</property>
</extension>
</arquillian>
这里是测试类的一个例子
public class IndexFrontendTest extends BaseArquillianTest {
@Drone
private WebDriver browser;
@ArquillianResource
private URL deploymentUrl;
@Page
private IndexPage indexPage;
private FrontendTestComponent frontendTestComponent;
@Before
public void setUp() {
browser.manage().window().setSize(new Dimension(1920, 1080));
browser.get(deploymentUrl.toExternalForm());
frontendTestComponent = new FrontendTestComponent();
}
@RunAsClient
@Test
public void testCarManufacturersAndModels() {
indexPage.getCarManufacturersDropdown().selectByVisibleText("Ajax");
frontendTestComponent.waitForJStoLoad(browser);
frontendTestComponent.checkSelect(indexPage.getCarModelsDropdown(), 1, true);
}
@RunAsClient
@Test
public void testContinentsAndCountries() {
indexPage.getContinentsDropdown().selectByValue("1");
frontendTestComponent.waitForJStoLoad(browser);
frontendTestComponent.checkSelect(indexPage.getCountriesDropdown(), 45, true);
}
}
BaseArquillianTest 类只有部署的静态方法
@RunWith(Arquillian.class)
public abstract class BaseArquillianTest {
@Deployment(testable = true)
public static WebArchive createDeployment() throws IOException {
...
...
}
}
我的开发机器有双启动。在 Linux 上,我的测试需要 60 秒。在 Windows 上需要 20 分钟,有时我会看到“错误请求”之类的错误。
我尝试了 2 种不同的浏览器(phantomjs 和 chrome),但情况是一样的
我试图在互联网上搜索,但似乎有人有这个错误。我想我在配置上犯了一些错误。
请问你能帮我吗?