2010-04-07 25 views
0

我收到错误:未知命令:'echo'使用phpunit执行硒脚本。基于echo命令应该包含在我的PHPUnit版本中的输出。 selenium脚本在firefox selenium IDE中执行成功。使用phpunit测试硒时找不到echo命令

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 

回答

1

硒IDE echo命令硒RC不支持,而是你应该用你的客户端语言呼应了对文件/控制台。例如,以下内容应以PHP打印到控制台:

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