2012-03-26 5 views
1

私はyiiフレームワークを使用しており、いくつかのテストを行います。 1つはデータベースとモデル、1つはセレンによるテストです。PhiiによるYiiフレームワークテストの実行

私はこのテストを実行するためにphing用のXMLファイルを作成しようとしています(私はJenkinsを使用しています)。 しかし、phingは設定としてphpunit.xmlを取るのが好きではありませんでした。私のセレンテストは失敗します。

これは、PHPUnitのを使用してログです - >

phpunit functional/signupTest.php 

PHPUnit 3.6.10 by Sebastian Bergmann. 

Configuration read from /var/www/myProject/protected/tests/phpunit.xml 

............ 

Time: 01:29, Memory: 6.00Mb 

OK (12 tests, 0 assertions) 

これは、同じテストのためのPhingを使用してログです -

合計時間を終えた>

Buildfile: /var/www/myProject/protected/tests/build.xml 

myProject > test: 

    [phpunit] Testsuite: signupTest 
    [phpunit] Tests run: 6, Failures: 0, Errors: 6, Incomplete: 0, Skipped: 0, Time elapsed: 0.05331 s 
    [phpunit] testShow ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testCreate ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testUpdate ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testDelete ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testList ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testAdmin ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] Testsuite: SiteTest 
    [phpunit] Tests run: 3, Failures: 0, Errors: 3, Incomplete: 0, Skipped: 0, Time elapsed: 0.02317 s 
    [phpunit] testIndex ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testContact ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 
    [phpunit] testLoginLogout ERROR 
    [phpunit] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet? 

BUILD:0.2542秒

これはPHPunit.xmlの設定です - >

<phpunit bootstrap="bootstrap.php" 
     colors="false" 
     convertErrorsToExceptions="true" 
     convertNoticesToExceptions="true" 
     convertWarningsToExceptions="true" 
     timeout="30000" 
     stopOnFailure="false"> 

    <selenium> 
     <browser name="Google Chrome" browser="*chrome" /> 
     <browser name="Firefox" browser="*firefox" /> 
    </selenium> 

</phpunit> 

これは、build.xmlの(Phingの)構成です - >

<?xml version="1.0" encoding="UTF-8"?> 
<project name="myProject" default="test"> 

     <target name="test" description="Launch PHPUnit Testing"> 
       <phpunit bootstrap="bootstrap.php" printsummary="false"> 
         <formatter type="plain" usefile="false"/> 
         <batchtest> 
           <fileset dir="."> 
             <include name="unit/Test.php"/> 
             <include name="functional/*Test.php"/> 
           </fileset> 

         </batchtest> 
       </phpunit> 
     </target>   
</project> 

どのように私は私のYiiプロジェクトにジェンキンステストを実行できますか?

答えて

0

私はYiiを使ったことはありません。

あなたがテストを実行すると、テストフォルダから実行すると思います。また、phingを実行すると、プロジェクトのルートから実行されます。

修正するにはphuに、ルートフォルダからではなく、テストフォルダでPHPUnitを実行するように指示する必要があると思います。

関連する問題