PHP教程:PHPUnit學習筆記(五)PHPUnit參數詳解

PHPUnit參數詳解:php

    本文直接翻譯自PHPUnit官方文檔,我的翻譯水平有限,可能會存在某些詞和意思翻譯不許的地方,進請諒解!

    Runs the tests that are provided by the class UnitTest. This class is expected to be declared in the UnitTest.php sourcefile.html

    UnitTest must be either a class that inherits from PHPUnit_Framework_TestCase or a class that provides a public static suite() method which returns an PHPUnit_Framework_Test object, for example an instance of the PHPUnit_Framework_TestSuite class.
    運行類UnitTest提供的全部測試,這個類須要定義在UnitTest.php這個文件中.
    類UnitTest須要從PHPUnit_Framework_TestCase繼承或者提供一個公開的靜態方法suite()返回一個PHPUnit_Framework_Test對象的實例.
    
phpunit UnitTest Test.php
    Runs the tests that are provided by the class UnitTest. This class is expected to be declared in the specified sourcefile.
    運行UnitTest提供的全部測試,這個類應該在定義在Test.php中
    
--log-junit

    Generates a logfile in JUnit XML format for the tests run.
    生成JUnit XML格式的日誌文件正則表達式


--log-tap

    Generates a logfile using the Test Anything Protocol (TAP) format for the tests run. 
    生成TAP格式的日誌文件
    
--log-dbus

    Log test execution using DBUS.
    使用DBUS記錄測試的執行狀況express


--log-json

    Generates a logfile using the JSON format.
    生成JSON格式的日誌文件
    
--coverage-html

    Generates a code coverage report in HTML format. 
    生成html格式的代碼覆蓋報告json


    Please note that this functionality is only available when the tokenizer and Xdebug extensions are installed.
    請注意這個功能只能在tokenizer和Xdebug安裝後才能使用bootstrap


--coverage-clover

    Generates a logfile in XML format with the code coverage information for the tests run. 
    生成xml格式的代碼覆蓋報告app


    Please note that this functionality is only available when the tokenizer and Xdebug extensions are installed.
    請注意這個功能只能在tokenizer和Xdebug安裝後才能使用ide


--testdox-html and --testdox-text

    Generates agile documentation in HTML or plain text format for the tests that are run. 
    生成記錄已運行測試的html或者純文本格式的文件文檔測試


--filter

    Only runs tests whose name matches the given pattern. The pattern can be either the name of a single test or a regular expression that matches multiple test names.ui


    只運行名字符合參數規定的格式的測試,參數能夠是一個測試的名字或者一個匹配多個測試名字的正則表達式


--group

    Only runs tests from the specified group(s). A test can be tagged as belonging to a group using the @group annotation.
    只運行規定的測試組,一個測試可使用@group註釋來分組
    The @author annotation is an alias for @group allowing to filter tests based on their authors.
    @author注視是一個和@group關聯的註釋標籤,用來根據做者來過濾測試


--exclude-group

    Exclude tests from the specified group(s). A test can be tagged as belonging to a group using the @group annotation.
    只包含規定的多個測試組,一個測試可使用@group註釋來分組


--list-groups

    List available test groups.
    列出可用的測試組
    
--loader

    Specifies the PHPUnit_Runner_TestSuiteLoader implementation to use.
    定義使用PHPUnit_Runner_TestSuiteLoader的接口


    The standard test suite loader will look for the sourcefile in the current working directory and in each directory that is specified in PHP's include_path configuration directive. Following the PEAR Naming Conventions, a class name such as Project_Package_Class is mapped to the sourcefile name Project/Package/Class.php.
    標準的standard test suite loader會在當前的目錄和php的include_path中根據PEAR的命名規則的類,一個叫作Project_Package_Class的類 會指向到文件Project/Package/Class.php
    
--repeat

    Repeatedly runs the test(s) the specified number of times.
    根據定義的數字重複運行測試
    
--tap

    Reports the test progress using the Test Anything Protocol (TAP).
    使用Test Anything Protocol格式報告測試進程
    
--testdox

    Reports the test progress as agile documentation.
    使用agile documentation格式報告測試進程


--colors

    Use colors in output.
    在輸出結果中使用顏色


--stderr

    Optionally print to STDERR instead of STDOUT.
    使用STDERR替代STDOUT輸出結果


--stop-on-error

    Stop execution upon first error.
    在遇到第一個錯誤時中止執行
    
--stop-on-failure

    Stop execution upon first error or failure.
    在遇到第一個失敗時中止執行
    
--stop-on-skipped

    Stop execution upon first skipped test.
    在遇到第一個跳過的測試時中止執行


--stop-on-incomplete

    Stop execution upon first incomplete test.
    在遇到第一個未完成的測試時中止執行


--strict

    Mark a test as incomplete if no assertions are made.
    當一個測試沒有定義任何斷言時將其標記爲未完成的測試


--verbose

    Output more verbose information, for instance the names of tests that were incomplete or have been skipped.
    輸出例如未完成的測試的名字,跳過的測試的名字


--wait

    Waits for a keystroke after each test. This is useful if you are running the tests in a window that stays open only as long as the test runner is active.
    在每一個測試開始以前等待用戶按鍵,這個在你一個保持打開的窗口中運行很長的測試時頗有幫助


--skeleton-class

    Generates a skeleton class Unit (in Unit.php) from a test case class UnitTest (in UnitTest.php).
    從一個測試類中生成一個概要測試類
    
--skeleton-test

    Generates a skeleton test case class UnitTest (in UnitTest.php) for a class Unit (in Unit.php). See Chapter 17 for more details.
    在Unit.php內爲類Unit生成一個概要測試類UnitTest


--process-isolation

    Run each test in a separate PHP process.
    在多個php進程中運行全部測試


--no-globals-backup

    Do not backup and restore $GLOBALS.
    不備份和還原$GLOBALS變量


--static-backup

    Backup and restore static attributes of user-defined classes.
    備份和還原用戶定義的類中的靜態變量


--syntax-check

    Enables the syntax check of test source files.
    對測試的代碼文件開啓語法檢查


--bootstrap

    A "bootstrap" PHP file that is run before the tests.
    定義測試前運行的bootstrap的php文件的路徑


--configuration, -c

    Read configuration from XML file. See Appendix C for more details.
    從xml文件中讀取配置,增長-c參數看更多的內容

    If phpunit.xml or phpunit.xml.dist (in that order) exist in the current working directory and --configuration is not used, the configuration will be automatically read from that file.
    若是phpunit.xml或phpunit.xml.dist(根據這個模式)在當前的目錄中存在且--configuration參數沒有使用的時候,配置信息會被自動讀取


--no-configuration

    Ignore phpunit.xml and phpunit.xml.dist from the current working directory.
    自動跳過當前目錄的phpunit.xml和phpunit.xml.dist配置文件


--include-path

    Prepend PHP's include_path with given path(s).
    在php的include_path增長路徑


-d

    Sets the value of the given PHP configuration option.
    定義php的配置屬性


--debug     Output debug information such as the name of a test when its execution starts.     輸出調試信息如測試的名稱及該測試何時開始執行      Note 提示 When the tested code contains PHP syntax errors, the TextUI test runner might exit without printing error information.  The standard test suite loader can optionally check the test suite sourcefile for PHP syntax errors, but not sourcefiles included by the test suite sourcefile. 當測試代碼中含有php語法錯誤的時候,測試器會退出且不會打印任何錯誤信息,standard test suite loader可選擇性檢查測試文件源代碼的PHP語法錯誤,可是不會檢查測試文件中引入的其餘的代碼文件的語法錯誤

相關文章
相關標籤/搜索