我在Mac上运行selenium时遇到问题,因此它运行一个简单的套件,只需一个简单的测试(参见下面的"TEST CASE"和"TEST SUITE"部分),使用以下命令行:
Java的罐子LIB /硒的server.jar -timeout 10 -log的server.log -browserSideLog browser.log -debug -htmlSuite '*火狐' http://google.com `pwd`/suite3`pwd`/selenium.html
我的问题是,当测试失败时,我没有得到预期的非零返回码,而且,我没有看到任何报告.
我尝试了以下变种:
使用给定的套件和测试用例文件:
指定-timeout选项(大量结束而不写入报告),或
不要指定-timeout选项.没有超时选项,selenium服务器永远不会关闭...即使帮助文档说:
Run a single HTML Selenese (Selenium Core) suite and then exit
immediately, using the specified browser (e.g. "*firefox") on the
specified URL (e.g. "http://www.google.com").
Run Code Online (Sandbox Code Playgroud)为了解决问题,我在测试用例中添加了一个额外的selenium命令来强制关闭服务器,如下所示:
.... previous commands ...
<tr>
<td>open</td>
<td>http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这确实消除了悬挂.浏览器关闭,进程终止..但我没有测试结果,我的退出代码是(错误地)零...不是非零,正如我所期望的那样.
TEST SUITE(需要使用名称'suite3'保存)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://google.com" />
<title>testcase3</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testcase3</td></tr>
</thead>
<tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>xbout Google</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
测试用例
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://google.com" />
<title>testcase3</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testcase3</td></tr>
</thead>
<tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>xbout Google</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在此先感谢谁能给我一个解决这个问题的线索!- 克里斯
我们在北京的同事陈云云在这里找到了诀窍.如果您重命名套件和测试用例文件,以便它们具有.html扩展名(并确保从套件到测试用例的ref更新以反映测试用例文件的新名称),那么一切都将按预期工作..谢谢, Chenyun - Chris Bedford 1分钟前
| 归档时间: |
|
| 查看次数: |
1443 次 |
| 最近记录: |