使用phpunit测试硒时找不到echo命令 [英] echo command not found while testing selenium with phpunit

查看:168
本文介绍了使用phpunit测试硒时找不到echo命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个错误:未知命令:'echo',该命令使用phpunit执行硒脚本.根据输出,应在我的PHPUnit版本中包含echo命令.硒脚本确实在firefox硒IDE中成功执行.

I am getting an ERROR: Unknown command: 'echo' executing a selenium script with phpunit. Based on the output that echo command should be included in my version of PHPUnit. The selenium script does execute successfully in the firefox selenium IDE.

mkdir_build:

phpunit:
     [exec] PHPUnit 3.4.12 by Sebastian Bergmann.
     [exec] 
     [exec] .
     [exec]  TestFull
     [exec]  E
     [exec] 
     [exec] Time: 11 seconds, Memory: 6.50Mb
     [exec] 
     [exec] There was 1 error:
     [exec] 
     [exec] 1) TestFull::testNumberOne
     [exec] PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete().
     [exec] ERROR: Unknown command: 'echo'.
     [exec] 
     [exec] 
     [exec] /directory/to/tests/TestFull.php:14
     [exec] 
     [exec] FAILURES!
     [exec] Tests: 1, Assertions: 0, Errors: 1.

RC服务器输出:

$ java -jar selenium-server.jar -port 4445 -debug
13:23:08.426 INFO - Java: Sun Microsystems Inc. 14.2-b01
13:23:08.428 INFO - OS: Linux 2.6.28-15-server i386
13:23:08.439 INFO - v2.0 [a2], with Core v2.0 [a2]
13:23:08.439 INFO - Selenium server running in debug mode.

13:25:05.661 DEBUG - ---------retrieving CommandQueue for sel_93352
13:25:05.662 DEBUG - Browser 2c8b3b5657a640db9fb278ecbd01049e/:top sel_93352 posted ERROR: Unknown command: 'echo'
13:25:05.662 DEBUG - ---------retrieving CommandQueue for sel_93352
13:25:05.662 DEBUG - putting command: ERROR: Unknown command: 'echo'
13:25:05.662 DEBUG - ..command put?: true
13:25:05.662 DEBUG -    sel_93352 commandHolder sel_93352 getCommand() called
13:25:05.662 DEBUG - waiting for data for at most 10 more s
13:25:05.662 DEBUG - data from polling: ERROR: Unknown command: 'echo'
13:25:05.662 DEBUG -    sel_93352 commandResultHolder sel_93352 getResult() -> ERROR: Unknown command: 'echo'
13:25:05.663 DEBUG - Got result: ERROR: Unknown command: 'echo' on session 2c8b3b5657a640db9fb278ecbd01049e
13:25:05.663 INFO - Got result: ERROR: Unknown command: 'echo' on session 2c8b3b5657a640db9fb278ecbd01049e
13:25:05.663 DEBUG - Handled by org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
13:25:05.663 DEBUG - RESPONSE:
HTTP/1.1 200 OK
Date: Wed, 07 Apr 2010 20:25:05 GMT
Server: Jetty/5.1.x (Linux/2.6.28-15-server i386 java/1.6.0_16
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Connection: close

推荐答案

Selenium RC不支持Selenium IDE echo命令,而是应使用客户端语言将其回显到文件/控制台.例如,以下内容应打印到PHP的控制台中:

The Selenium IDE echo command is not supported in Selenium RC, instead you should use your client language to echo out to file/console. For example, the following should print to console in PHP:

print("Print this!" . "\n");

这篇关于使用phpunit测试硒时找不到echo命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆