PHPUnitManual:5.1
- 5.1 Command-Line switches
다음 코드를 통해, PHPUnit 의 command-line tool 의 스위치들을 살펴봅시다.
phpunit --help
PHPUnit 3.7.0 by Sebastian Bergmann.
Usage: phpunit [switches] UnitTest [UnitTest.php]
phpunit [switches] <directory>
--log-junit <file> Log test execution in JUnit XML format to file.
--log-tap <file> Log test execution in TAP format to file.
--log-json <file> Log test execution in JSON format.
--coverage-clover <file> Generate code coverage report in Clover XML format.
--coverage-html <dir> Generate code coverage report in HTML format.
--coverage-php <file> Serialize PHP_CodeCoverage object to file.
--coverage-text=<file> Generate code coverage report in text format.
Default to writing to the standard output.
--testdox-html <file> Write agile documentation in HTML format to file.
--testdox-text <file> Write agile documentation in Text format to file.
--filter <pattern> Filter which tests to run.
--group ... Only runs tests from the specified group(s).
--exclude-group ... Exclude tests from the specified group(s).
--list-groups List available test groups.
--loader <loader> TestSuiteLoader implementation to use.
--printer <printer> TestSuiteListener implementation to use.
--repeat <times> Runs the test(s) repeatedly.
--tap Report test execution progress in TAP format.
--testdox Report test execution progress in TestDox format.
--colors Use colors in output.
--stderr Write to STDERR instead of 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 Run tests in strict mode.
-v|--verbose Output more verbose information.
--debug Display debbuging information during test execution.
--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore $GLOBALS for each test.
--static-backup Backup and restore static attributes for each test.
--bootstrap <file> A "bootstrap" PHP file that is run before the tests.
-c|--configuration <file> Read configuration from XML file.
--no-configuration Ignore default configuration file (phpunit.xml).
--include-path <path(s)> Prepend PHP's include_path with given path(s).
-d key[=value] Sets a php.ini value.
-h|--help Prints this usage information.
--version Prints the version and exits.
Option | 내용 |
phpunit UnitTest | UnitTest 클래스에 정의되어 있는 테스트를 실행합니다. 이 클래스는 UnitTest.php 파일에서 정의되어 있어야 합니다.
UnitTest 는 PHPUnit_Framework_TestCase 를 계승하는 클래스거나, 혹은 PHPUnit_Framework_TestCase 오브젝트를 return 하는 메소드를 제공하는 클래스 (예: PHPUnit_Framework_TestSuite) 여야 합니다. |
phpunit UnitTest UnitTest.php | UnitTest 클래스에 정의되어 있는 테스트를 실행합니다. 이 클래스는 지정 파일에 정의되어 있어야 합니다. |
--log-junit | JUnit XML 포맷을 사용하여 테스트의 실행 결과 로그를 작성합니다. "18장 로그 출력"을 참조해 주세요. |
--log-tap | Test Anything Protocol (TAP) [1] 포맷을 사용하여 테스트의 실행 결과 로그를 작성합니다. "18장 로그 출력"을 참조해 주세요. |
--log-json | JSON [2] 포맷을 사용하여 테스트의 실행 결과 로그를 작성합니다. "18장 로그 출력"을 참조해 주세요. |
--coverage-html | code coverage 레포트를 HTML 형식으로 작성합니다. "14장 code coverage 해석" 을 참조해 주세요.
이 기능은, tokenizer 확장 모듈 및 Xdebug 확장 모듈이 인스톨되어 있는 경우, 사용 가능합니다. |
--coverage-clover | 테스트 결과를 XML 형식의 로그 파일로 작성하고, code coverage 정보도 포함시킵니다. "18장 로그 출력"을 참조해 주세요.
이 기능은, tokenizer 확장 모듈 및 Xdebug 확장 모듈이 인스톨되어 있는 경우, 사용 가능합니다. |
--coverage-php | 연속적인 (serialized) PHP_CodeCoverage 오브젝트를 생성하고, code coverage 정보도 포함시킵니다.
이 기능은, tokenizer 확장 모듈 및 Xdebug 확장 모듈이 인스톨되어 있는 경우, 사용 가능합니다. |
--coverage-text | 테스트 실행시, 로그 파일 혹은 command-line 출력으로 code coverage 정보를 생성합니다. "18장 로그 출력"을 참조해 주세요.
이 기능은, tokenizer 확장 모듈 및 Xdebug 확장 모듈이 인스톨되어 있는 경우, 사용 가능합니다. |
--testdox-html and --testdox-text | 실행한 테스트 결과를 HTML 혹은 text 파일 형식의 문서로 생성합니다. "15장 테스트의 기타 사용법" 을 참조해 주세요. |
--filter | 지정 패턴과 일치하는 테스트만을 실행합니다. 패턴으로 지정 가능한 것은 테스트의 이름이나 정규식 [3] 입니다. |
--group | 지정 그룹의 테스트만을 실행합니다. 테스트를 그룹에 포함시키기 위해서는 @group 선언을 사용합니다.
@author 선언은 @group 의 일종으로, 테스트의 작성자 별로 테스트를 필터링합니다. |
--exclude-group | 지정한 그룹을 테스트에서 제외합니다. 테스트를 그룹에 포함시키기 위해서는 @group 선언을 사용합니다. |
--list-groups | 사용 가능한 테스트의 그룹의 리스트를 표시합니다. |
--loader | PHPUnit_Runner_TestSuiteLoader 를 구현한 클래스 중, 실제로 사용하는 클래스를 지정합니다.
표준 test suite loader 는 현재의 작업 디렉토리와 PHP 설정항목 include_path 에 지정된 디렉토리에서 소스 파일을 검색합니다. PEAR 명명규칙에 따라 Project_Package_Class 클래스는 소스파일의 패스 Project/Package/Class.php 를 의미합니다. |
--printer | 결과를 표시하기 위해 사용하는 프린트 클래스를 지정합니다. 이 프린트 클래스는 PHPUnit_Util_Printer 를 계승하는 동시에 PHPUnit_Framework_TestListener 의 인터페이스를 구현한 것이어야 합니다. |
--repeat | 지정 횟수만큼 테스트를 반복합니다. |
--tap | Test Anything Protocol (TAP) [4] 를 사용하여 테스트의 진행 상황을 보고합니다. "18장 로그 출력"을 참조해 주세요. |
--testdox | 테스트의 진행 상황을 agile 문서로 보고합니다. "15장 테스트의 기타 사용법" 을 참조해 주세요. |
--colors | 색을 사용하여 출력합니다. |
--stderr | 출력을 STDOUT 가 아닌 STDERR 로 지정합니다. |
--stop-on-error | 첫번째 에러에서 테스트를 중단합니다. |
--stop-on-failure | 첫번째 에러나 실패에서 테스트를 중단합니다. |
--stop-on-skipped | 첫번째 테스트 skip 에서 테스트를 중단합니다. |
--stop-on-incomplete | 첫번째 불완전한 테스트에서 테스트를 중단합니다. |
--strict | strict 모드에서 테스트를 실행합니다. |
--verbose | 보다 자세한 정보를 출력합니다. 예를 들어, 불완전 테스트나 skip된 테스트의 이름이 표시됩니다. |
--process-isolation | 각각의 테스트를 개별 PHP 프로세스로 실행합니다. |
--no-globals-backup | $GLOBALS 백업과 복구를 하지 않습니다. "Global State" 를 참조해 주세요. |
--static-backup | 사용자 정의 클래스의 정적 속성을 백업, 복구합니다. "Global State" 를 참조해 주세요. |
--bootstrap | 테스트 전에 실행되는 "bootstrap" PHP 파일을 지정합니다. |
--configuration, -c | XML 파일에서 설정을 로드합니다. "부록C XML 설정 파일" 을 참조해 주세요.
phpunit.xml 혹은 phpunit.xml.dist (이 순서로 사용합니다) 가 현재의 작업 디렉토리에 존재하고, 또한 --configuration 가 사용되지 않은 경우, 해당 파일로부터 설정을 자동적으로 로드합니다. |
--no-configuration | 현재의 작업 디렉토리에 있는 phpunit.xml 과 phpunit.xml.dist 를 무시합니다. |
--include-path | PHP 의 include_path 의 처음부분에 지정 패스를 추가합니다. |
-d | 지정한 PHP 설정 옵션값을 설정합니다. |
--debug | 테스트의 이름 등 디버그 정보를 테스트 실행이 시작될 때 출력합니다. |
phpunit 의 옵션들 |