发布新日志

  • Selenium timeout

    2010-04-29 13:59:02

    在使用SELENIUM RC进行测试时,总是会发现在打开网页的过程中TIMEOUT 30000MS的错误提示.

    这是因为打开网页时有一个默认的超时限制,更改这个默认值的命令是:

    selenium.set_timeout("60000")

    这个值最好是放在SetUP方法中.

    Some comments:

    • You don't need a wait_for_page_to_load after an open, that will cause you timeouts because once the page is loaded after the opeen, it will start waiting again and the page will not be loading.
    • Most of the failures you get from selenium (timeouts, object not found) can be caught with try-except statements
    • You should set the timeout in your tests withing the test itself (using set_timeout), that way it doesn't depend on the way you start the server, it will always wait the time you wanted
  • Selenium timeout

    2010-04-29 13:59:02

    在使用SELENIUM RC进行测试时,总是会发现在打开网页的过程中TIMEOUT 30000MS的错误提示.

    这是因为打开网页时有一个默认的超时限制,更改这个默认值的命令是:

    selenium.set_timeout("60000")

    这个值最好是放在SetUP方法中.

    Some comments:

    • You don't need a wait_for_page_to_load after an open, that will cause you timeouts because once the page is loaded after the opeen, it will start waiting again and the page will not be loading.
    • Most of the failures you get from selenium (timeouts, object not found) can be caught with try-except statements
    • You should set the timeout in your tests withing the test itself (using set_timeout), that way it doesn't depend on the way you start the server, it will always wait the time you wanted
  • Selenium1.0.1+Firefox3.6+Unable to delete parent.lock file

    2010-04-21 19:25:53

    工具: selenium RC 1.0.1 + Junit
    被测试浏览器:Firefox3.6
    在执行脚本过程中遇到如下问题
    java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Unable to delete file F:\temp\customProfileDir62d458aab59f4972a95342789f4262b8\parent.lock
        at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
        at firefox.Registerfailed.setUp(Registerfailed.java:14)
        at junit.framework.TestCase.runBare(TestCase.java:128)
        at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Unable to delete file F:\temp\customProfileDir62d458aab59f4972a95342789f4262b8\parent.lock
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
        at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
        at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:223)
        at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)
        ... 15 more

    分析问题:
     * 查看进程,有N个FIREFOX的进程在运行.
     * 查看了N次资料,好像是1.0.1与FIREFOX3.6不太兼容
    解决方案:
     * 下载最新的selenium 1.0.3可以实现也FIREFOX3.6的兼容
     * 第二种解决方案:这篇文档中的资料 (http://3lncr.wordpress.com/2010/03/04/selenium-rc-0-1-1-and-firefox-3-6-profile-issue/)

    3lncr's blog

    As simple as possible, but not any simpler…

    Firefox 3.6, Selenium 1.0.1 with selenium-rc-0.1.1 and “Lock file still present!” issue

    leave a comment »

    Have you just updated your shiny Firefox to version 3.6 and now you can’t make Selenium 1.0.1 (precisely: selenium-rc-0.1.1) working fine for you on this browser? Ooops… I got the same. :(

    Now, when you try to run one of your Selenium based UI tests on such a brand-new-and-up-to-date “combo” it just fails to start the browser and there is just some annoying exceptions in logs, similar to these:

    ERROR - Failed to start new browser session, shutdown browser and clear all session data java.lang.RuntimeException: Firefox refused shutdown while preparing a profile

    org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$
    FileLockRemainedException: Lock file still present! C:\DOCUME~1\{windows-username}\LOCALS~1\Temp\customProfileDir197b3da3c02244fb8407912c5e126b07\parent.lock

    Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Unable to delete file C:\DOCUME~1\{windows-username}\LOCALS~1\Temp\customProfileDir197b3da3c02244fb8407912c5e126b07\parent.lock

    There is a cure. A bit hacky, but still worth to try, if you really need to use Firefox 3.6.

    So do some search through your project dependencies JARs and find selenium-server.jar item. Unzip it, find all (of 5) “install.rdf” files inside this JAR (they are under customProfileDirCUSTFF and customProfileDirCUSTFFCHROME subfolders), open them in some text editing tool (they are XML based configuration files) and replace the max version of agent (browser) application from line like this:

    <em:maxVersion>3.5.*</em:maxVersion>

    into this:

    <em:maxVersion>3.6.*</em:maxVersion>

    Or just download customized selenium-server.jar (pathed, as above, to Firefox 3.6.*) from this place.

    Note: If you are using Grails with Selenium plugin (selenium-rc-0.1.1), you can find selenium-server.jar in your project plugins folder (e.g. {user-home}\.grails\{grails-version}\projects\{project-name}\plugins\selenium-rc-0.1.1\lib\server)

    Where:
    {user-home} stands for user home folder, e.g. C:\DOCUME~1\johndoe or C:\Users\johndoe
    {grails-version} is Grails version, e.g. 1.1
    {project-name} is your Grails project name, e.g. test-project

    Done. It should work now!



  • Junit+verify

    2010-01-27 15:46:20

    想使用selenium RC做浏览器兼容性测试,使用了eclipse+junit+ant作为测试平台.
    在selenium中同时支持assert和verify两种断言模式.
    如果使用assert,当遇到错误时,test case不会再继续被执行下去; 而如果使用verify,当遇到错误时,test case仍会继续运行,直到完成.
    但在junit中创建测试代码时发现,junit不识别verify方法.
    从网上搜索了N多次,都没有找到彻底的解决方法,后来咨询了单位一个做开发人员,这个问题总得有眉目了.
    1. 首先不使用junit中的testcase类,而是使用com.thoughtworks.selenium.SeleneseTestCase.
    import com.thoughtworks.selenium.*;
    2.使用上述类就可以使用verify方法了,需要注意一点是:
    This class adds a number of "verify" commands, which are like "assert" commands, but they don't stop the test when they fail. Instead, verification errors are all thrown at once during tearDown.
    所以需要在teardown方法中,加后check verification的方法

    public void tearDown() throws Exception {
            selenium.stop();
            checkForVerificationErrors();
    }

    注意:        checkForVerificationErrors();和      selenium.stop();的位置不要反了啊. 如果反了,当遇到verificationerror的情况,这个测试就不能关闭不了.
    3.teardown()方法,使用junit默认定义teardown方法是如下
    protected void tearDown() throws Exception {
            selenium.stop();
            checkForVerificationErrors();
    }

    但junit总是报一个错误:
    Cannot reduce the visibility of the inherited method from SeleneseTestCase  
    原因是:
    因为接口定义的方法默认是public的,意思就是你没有任何访问修饰符的情况下,系统给接口的方法加上了一个public的访问修饰符。你Test实现了接口,并且实现了接口定义的方法,于是方法的访问修饰符只能比接口的访问修饰符高,但是类的默认访问修饰符是freidnly,降低了访问级别,所以会报错. 所以你Test实现的方法前面加上public就对了(具体不知道什么意思,咨询了一个开发人员后说的,哈哈,本人不懂代码哦.)

    后来将teardown()方法改成如下后,问题解决:
    public void tearDown() throws Exception {
            selenium.stop();
            checkForVerificationErrors();
    }




  • Selenium Grid + Selenium RC

    2010-01-15 13:52:32

    Reference URL:
    http://stackoverflow.com/questions/1944209/setup-for-ie6-and-multiple-browsers-in-selenium-grid
    http://selenium-grid.seleniumhq.org/faq.html

    Body:

    1. Installation:

    http://selenium-grid.seleniumhq.org/step_by_step_installation_instructions_for_windows.html

    2.Run the demo

    http://selenium-grid.seleniumhq.org/run_the_demo.html

    3.Running the Tests in Parallel on Multiple Machines

    Notes:
    • 在所有的机器(比如GRID机,RC机)上,都必须要安装ANT和SELENIUM GRID
    • 必须在GRID机上先启动 ant-hub,然后再在其它的机器上启动RC,这样在localhost:4444/console中,你才能看到available remote control的信息.
    • 如果在某台机器上想用某种浏览器(e.g.safari)进行测试,那在在这台机器上,必须将支持此浏览器的RC启动起来,格式如下:ant -Dport=5556 -Dhost=192.168.1.4 -DhubURL=http://192.168.1.70:4444 -Denvironment="Safari on Windows" launch-remote-control

    4.Running the Demo Using a Different Browser

    In the demo, firefox is the default browser, if you want to run the demo with the Safari web browser, you need to follow the below steps:
    • ant launch-hub
    • Launch a remote control(in the other machine or in the same machine) declaring that it provides the Safari environment: ant -Dport= -Dhost= -DhubURL= -Denvironment="*safari" launch-remote-control
    • Launch the other remote controls the same way:
    • ant -Denvironment="*safari" -Dport=5556 launch-remote-control
      ant -Denvironment="*safari" -Dport=5557 launch-remote-control
    • Launch the demo overriding the browser system property:
      • ant -Dbrowser="*safari" run-demo-in-parallel




  • Eclipse+Junit Test Suite Error --java.lang.Exception: No runnable methods

    2010-01-15 09:30:12

    使用Eclipse+(Junit4.x+Junit3.x 2个单位测试插件)做回归测试, 单个执行TESTCASE的时候都是可以成功的,但是将TESTCASE放在TESTSUITE中执行时,提示
    java.lang.Exception: No runnable methods
        at org.junit.internal.runners.TestClassMethodsRunner.testAborted(TestClassMethodsRunner.java:42)
        at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:33)
        at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
        at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    以下是测试套件代码

    package Testsuite;

    import junit.framework.Test;
    import junit.framework.TestSuite;

    public class AllTests {

        public static Test suite() {
            TestSuite suite = new TestSuite("Test for Testsuite");
            //$JUnit-BEGIN$
            suite.addTestSuite(GoogleTest2.class);
            suite.addTestSuite(GoogleTest1.class);
            suite.addTestSuite(GoogleTest.class);
            //$JUnit-END$
            return suite;
        }

    }

    在网上查了一下,原因是因为我使用了Junit4.x进行单元测试,if you use the JUnit 4.4 core runner to execute a class, you must have "@Test" method in the class.

    有两种方法可以解决这个问题:

    (1)比较简单的方法: 使用Junit3.x, 右击TESTSUITE CLASS,选择RunAs-Run,在弹出的窗口中,Testrunner选择为Junit3,默认是Junit4.(本人才疏学浅,实在不是太懂JUNIT里面的道道,就采用了第一种方法)
    (2)修改TESTSUITE和TESTCASE测试代码,使其包含 the @Test annotation,修改后的代码
    import org.junit.runner.RunWith;
    import org.junit.runners.Suite;
    import org.junit.runners.Suite.SuiteClasses;


    @RunWith(value=Suite.class)
    @SuiteClasses(value={TestCase.class})
    public class AllTests {

    }

    import static org.junit.Assert.assertTrue;
    import org.junit.Test;

    public class TestCase  {
    @Test
       
    public void test1 {
            assertTrue
    (tmp.getTermin().equals(soll));(//注意以处要换成自己的测试代码,这只是一个例子)
       
    }
    }

    在以下这个网站上还找到其它可能引起No runnable method的原因:
    http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/

    This error is a catchall for anything else that might be wrong with your test class.  First make sure any of the below problems are not occurring. 

    Your unit test code is running JUnit4.  At least one test method must have the @Test annotation.  Otherwise this error occurs.

    If the class you are testing has @Required setters for Spring injections they must be set otherwise JUnit will mask the missing required exception as a no runnable methods exception.

    If you are initializing your mock objects outside of the @Begin method you will get this error.

    If you are attempting to mock the same class more than once you will get this error.




  • Eclipse+Junit test report

    2010-01-14 17:46:51

    转自 Generating a JUnit test report with eclipse

    clear instructions on how to use the built in functionality in eclipse to generate nice Junit reports in HTML using ant.

    Now that I have found a solution to this problem I will post it in hopes that it might help others:

    This approach is makes use of the eclipse2ant plug-in which is standard on Eclipse release 3.1M6 and higher (http://www.geocities.com/richard_hoefter/eclipse2ant/).
    (注释:如果使用的是3.1版本以上的ECLIPSE则不用考虑
    eclipse2ant插件问题)

    1) First generate an Ant build file for your project.
    In the Export page select "Ant Buildfiles" it is under General. Then select a project that contains your JUnit tests. The default JUnit output directory is appropriately named "junit".

    (注释:在你的workspace中相应的PROJECT目录下创建一个名为'junit'的文件夹,以便存放输出结果)

    2) Next resolve dependencies by making sure that the junit.jar is added to Ant's "Global Entries."
    Window->Preferences->Ant->Runtime->Global Entries and Add External JARs... Navigate to your "eclipse" directory (where eclipse is installed). It is under "plugins" directory and presently the junit.jar is in a directory named "org.junit_3.8.1". If this is missing then you will see error messages since junit is an optional Ant task.


    3) Run then right click on the Ant build file (by default build.xml) and Run As->Ant Build... This will display a list of targets. All of the launch configurations you have previously configured will have a corresponding target in your Ant build file. Select the desired target(s), and also select the "junitreport" target. Check the "Target execution order" text area to make sure the junitreport is run last.
    (注释:在TARTGET list中选择时,要选择需要执行的TESTCASE和JUNITREPORT)

    4) Access to junit output directory of your project from your workspace path, click on index.html you will see the test result in browser.



    Whenever you run a test case it will generate results and will be placed in the junit output directory. These results are formatted into an HTML report by the junitreport target and stored in the junit output directory. 
  • Eclipse+TestNG

    2010-01-14 15:21:55

    1.Eclipse集成TestNG:http://testng.org/doc/eclipse.html
    2.SeleniumRC的相关介绍:http://seleniumhq.org/docs/05_selenium_rc.html#reporting-results
    3.Selenium RC1.0以下的版本不支持启动FIREFOX 和 SAFARI,执行时报500(internet server error),换成1.0版本就可以解决些问题.
    4.当对SAFARI进行测试时,如果遇到以下错误,可以用2种方法解决:
    java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Safari could not be found in the path!

    • (1)Please add the directory containing ''Safari.exe'' to your PATH environment variable
    • (2)explicitly specify a path to Safari like this: *safaric:\blah\Safari.exe {selenium = new DefaultSelenium("localhost", 4444, "*safari D:\\Program Files\\Safari\\Safari.exe", url);}

       



  • Eclipse+Junit+SeleniumRC

    2010-01-13 17:53:01

    目前正在研究如何将SeleniumRC和Junit结合起来进行REGRESSION TESTING.

    按照zhangting85博客中的说明一步一步的进行设置:

    原文地址:http://e-pyramid.blogspot.com/2008/04/setting-up-selenium-rc-and-junit.html

    I recently started learning Selenium RC on my own. I read the materials available on the Selenium RC website. This material assumes that you are familiar withJavaand JUnit concepts. Therefore, it is difficult to setup a working Selenium RC with Java for people having worked onTestAutomation with limited knowledge of Java and JUnit.
    Following are the step by step instructions to setup Selenium RC with JUnit for test execution.

    1. Download Selenium RC from www.openqa.org
    2. Extract the files to the following location C:\selenium-rc
    3. Download JUnit 4.4 from www.junit.org.
    4. Extract the files to the following location C:\junit4.4
    5. Download and Install JDK 1.6 or above to the following location C:\jdk1.6
    6. Create a new folder C:\selenium_tests (This would be the location where you will save the test classes).
    7. Set an environment variable CLASSPATH as C:\selenium-rc\selenium-java-client-driver-1.0-beta-1\selenium-java-client-driver.jar;C:\selenium_tests\;C:\junit4.4\junit-4.4.jar;
    8. Make sure that C:\jdk1.6\bin is included in your PATH environment variable.
    9. Download the GoogleTest.java from the Java Tutorials available for Selenium RC at www.openqa.org. Save this file under selenium_tests directory you made eariler.
    10. Open a Command Prompt and go to the following location. C:\selenium-rc\selenium-server-1.0-beta-1
    11. Type the following command to start the selenium RC server for test execution.

    >java -jar selenium-server.jar -interactive

    12. Open another command prompt window and go the location where you saved GoogleTest.java file. i.e. C:\selenium_tests
    13. Compile the java file with javac as

    >javac GoogleTest.java

    14. This would create a class file that you can run with JUnit for testing purposes as

    >java junit.textui.TestRunner GoogleTest

    You will notice that it would open a firefox session with Selenium Test Runner and execute the tests. In the end you will get the status of the test result on the command prompt as


    C:\Selenium>java junit.textui.TestRunner GoogleTest
    .
    Time: 5.769

    OK (1 test)

    This shows that you have successfully run GoogleTest.java as a Selenium RC test using JUnit.

    You can experiment editing GoogleTest.java and see the changes in the output.

    I would also recommend using Selenium IDE for recording a new test, saving it as Selenium RC Java test and then executing it using Selenium RC and JUnit.


    在执行过程中发现了以下几个问题:
    1.找不到GoogleTest.java,在网上找了一下几个,编译时报错,自己重新DEBUG了一下,上传在附件中作为参考吧.
    2. GoogleTest 编译成功后,没有办法执行,报以下错误:
    (1) Exception in thread "main" java.lang.NoClassDefFoundError:
    junit/textui/TestRunner.出现这个问题的原因是CLASSPATH设置不正确造成的,你可以通过以下2种方式解决此问题:
    • 右击"我的电脑"-高级-环境变量: CLASSPATH=.;C:\j2sdk1.4.1_02\lib;C:\junit4.1\junit.jar;(根据自己的环境进行设置,这只是一个例子,在设置过程上要注意 . 和 C:\junit4.1\junit.jar)
    • 在DOS窗口中执行TESTCASE时,附带上JUNIT的路径 java -cp C:\junit3.8.1\junit.jar;. junit.textui.TestRunner MyTest 
    (2) 按照(1)所述,设置CLASSPATH后还是不行,报了另一个错:Exception in thread "main" java.lang.NoClassDefFoundError: GoogleTest (wrong name: com/example/tests/GoogleTest).到目前为止我也不知道问题原因在哪,不过通过eclipse将junit和SeleniumRC集成在一起后就解决了.

    2.Eclipse+junit+selenium
    • (1)Open eclipse and create a new Java Project.

    • (2)Create a lib folder and import the required libraries:

    • From the menu select File -> Import -> File system. Select your jar and select the folder lib as target.
      • selenium-java-client-driver.jarfromSELENIUM_HOME/selenium-java-client-driver-1.0-beta-1
      • junit-3.8.1.jardownloaded from sourceforge.

    • (3) Then select the libraries, right-click and selectBuild Path>Add to Build Path
    • (4)Under src, in the default package import the GoogleTest.java and save
    • (5)To run the test right-click on GoogleTest.java and select Run As > JUnite Test



  • Selenium RC - PHP Client server

    2008-05-17 16:20:27

    近期在学习Selenium,Selenium的工具有四种,四种工具各有不同,各种工具的比较参见:http://blog.csdn.net/yangxiaogang/archive/2006/12/25/1460452.aspx . 我选择了Selenium RC,我所采用的语言是PHP.
    PHPUnit集成了Selenium的API接口,通过直接调用Selenium的API即可完成测试动作和结果验证
    本章主要介绍如何通过PHPUni驱动PHP client server完成测试.
    1.下载selenium Rc:http://blog.csdn.net/yangxiaogang/archive/2006/12/25/1460452.aspx
    2.解压到一个目录下,我的解压到了d:\seleniumrc
    3.下载apache,我本机使用的是apache2.2.x
    4.下载PHP5.x windows安装版本,我本机安装的是php-5.2.6-win32-installer.msi
    5.安装PHP(我的安装路径D:\PHP),安装过程中注意选择安装"Extras"中的"PEAR Installer"
    6.安装PEAR:PHP安装完成后,并未自动安装PEAR,所以我们要到PHP安装目录中,运行go-pear.bat进行安装,详细安装的过程参见:http://www.phpchina.com/bbs/viewthread.php?tid=61542.我在这只把重要的几步写下来.
    (1)在go-pear命令窗口中,根据提示设定安装路径
    (2)PEAR安装成后,根据提示修改PHP安装目录中的"PHP.INI"文件和配置环境变量,以下是我本地机上安装成功后的提示:
    Would you like to alter php.ini <C:\WINDOWS\system32\php.ini>? [Y/n] : y

    php.ini <C:\WINDOWS\system32\php.ini> include_path updated.

    Current include path           : .;C:\php5\pear
    Configured directory           : D:\PHP\www\pear
    Currently used php.ini (guess) : C:\WINDOWS\system32\php.ini
    Press Enter to continue:

    ** WARNING! Old version found at D:\PHP\www\bin, please remove it or be sure to use the new d:\php\www

    The 'pear' command is now at your service at d:\php\www\bin\pear.bat

    ** The 'pear' command is not currently in your PATH, so you need to
    ** use 'd:\php\www\bin\pear.bat' until you have added
    ** 'D:\PHP\www\bin' to your PATH environment variable.
    (3)根据上述红色字体的提示,先打开PHP安装目录中的"PHP.INI"文件,找到如下段落
    ; Windows: "\path1;\path2"
    ; include_path = ".;c:\php\includes"
       将其修改为
    ; Windows: "\path1;\path2"
    include_path = ".;c:\php5\pear"

    (4)执行pear.bat使pear命令设置到PATH路径中.
    (5)右击我的电脑-高级-环境变量,将"D:\PHP\www\bin"加入"PATH"变量中.
    7.PEAR安装完成后,继续安装PHPunit
    (1) 首先加载PHPunit的chnnel,执行下列命令pear channel-discover pear.phpunit.de
    (2) 继续安装:pear install phpunit/phpunit
    (3) 直到出现提示" install ok: channel://pear.phpunit.de/PHPUnit-3.2.19",说明PHPUnit安装成功了.你可以在PEAR目录中找到它.
    8.执行测试,以selenium rc/selenium-php-client-server中的GoogleTest.php为例
    (1)保证selenium server一直运行.
    CMD-到selenium-server路径下输入-java -jar selenium-server.jar
    (2)启动测试用用例:
    CMD-到selenium-php-client-server路径下输入-phpunit Goole.Test.php
    (3)查看运行结果:
    执行完成后,可以看到执行结果,如下:

    FAILURES!
    Tests: 1, Errors: 1.


Open Toolbar