Selenium + include + loadTestData导致'testCase.debugContext.currentCommand is undefined'

时间:2014-10-24 09:46:47

标签: selenium selenium-ide

我遇到了Selenium与用户扩展相关的问题:
-datadriven
-flowcontrol
-includeCommand
如下文所述:
Issue running Selenium IDE test suite using Selenium Standalone server

我在Selenium IDE中使用了上面提到的不同版本的用户扩展。我会发布确切的那些,因为问题可能在那里。我之前提到SO帖子的原因是因为当我直接通过Selenium Core运行测试套件时我得到了同样的错误。

好的,完成环境描述的介绍,对认真的工作: 如果我运行我的testsuite,loadTestData将正确执行,我可以回显while循环中驻留在data.xml文件中的变量。当我包含另一个测试用例时,我也可以回显我刚刚保存或直接传递的变量。当执行endWhile时,错误发生在while循环结束时。

我得到以下日志,最后是错误:

[info] Playing test case LoadTestData
[info] Executing: |setSpeed | 1000 | 1500 |
[info] Executing: |loadTestData | data.xml | |
[info] Executing: |while | !testdata.EOF() | |
[info] Executing: |nextTestData | | |
[info] <test q="test1"/>
[info] Executing: |echo | ${q} | |
[info] echo: test1
[info] Executing: |store | ${q} | query |
[info] Executing: |echo | ${query} | |
[info] echo: test1
[info] Executing: |include | ./something.html | |
[info] Executing: |begin$Template$ | ./something.html | |
[info] Begin Template ./something.html at position 8
[info] Executing: |store | http://www.google.com | url |
[info] Executing: |open | ${url} | |
[info] Executing: |echo | ${query} | |
[info] echo: test1
[info] Executing: |sendKeys | id=gbqfq | ${query} |
[info] Executing: |end$Template$ | ./something.html | |
[info] End Template ./something.html at position 8
[info] Executing: |endWhile | | |
[error] testCase.debugContext.currentCommand(...) is undefined
[error] Unexpected Exception: TypeError: testCase.debugContext.currentCommand(...) is undefined. 

这是我使用的各种文件的内容:
IDE.html(套件):

<?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>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium">
<tbody>
    <tr><td><b>Test Suite</b></td></tr>
    <tr><td><a href="LoadTestData.html">LoadTestData</a></td></tr>
    <tr><td><a href="something.html">something</a></td></tr>
</tbody></table>
</body>
</html>

测试用例:
LoadTestData.html

<?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="D:/demo/" />
<title>LoadTestData</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">LoadTestData</td></tr>
</thead><tbody>
<tr>
    <td>setSpeed</td>
    <td>1000</td>
    <td>1500</td>
</tr>
<tr>
    <td>loadTestData</td>
    <td>data.xml</td>
    <td></td>
</tr>
<tr>
    <td>while</td>
    <td>!testdata.EOF()</td>
    <td></td>
</tr>
<tr>
    <td>nextTestData</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>echo</td>
    <td>${q}</td>
    <td></td>
</tr>
<tr>
    <td>store</td>
    <td>${q}</td>
    <td>query</td>
</tr>
<tr>
    <td>echo</td>
    <td>${query}</td>
    <td></td>
</tr>
<tr>
    <td>include</td>
    <td>./something.html</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>

something.html

<?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="D:/demo/" />
<title>Something</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Something</td></tr>
</thead><tbody>
<tr>
    <td>store</td>
    <td>http://www.google.com</td>
    <td>url</td>
</tr>
<tr>
    <td>open</td>
    <td>${url}</td>
    <td></td>
</tr>
<tr>
    <td>echo</td>
    <td>${query}</td>
    <td></td>
</tr>
<tr>
    <td>sendKeys</td>
    <td>id=gbqfq</td>
    <td>${query}</td>
</tr>
</tbody></table>
</body>
</html>

testdata:

<testdata>
    <test q="test1"></test>
    <test q="test2"></test>
</testdata>

用户扩展一体机(按上述顺序):
我是从上面的SO链接直接得到的。

0 个答案:

没有答案