qa:testfesttalk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
qa:testfesttalk [2009/03/29 20:44] – added libxml2 dabaseqa:testfesttalk [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== PHPT roundup talk ====== ====== PHPT roundup talk ======
-This wikipage contains all extra information for the talk prepared for phptestfest 2009. They heavily rely on content written by other people before. Every resource of the talk, even the slides (in different formats) will be in this place. Other testfesters can use and modify this talk to save precious time.+This wikipage contains all extra information for the talk prepared for [[qa:testfest-2009|phptestfest 2009]]. They heavily rely on content written by other people before. Every resource of the talk, even the slides (in different formats) will be in this place. Other testfesters can use and modify this talk to save precious time. 
 + 
 +[[http://tinyurl.com/c9bqf4]] 
  
 ===== How is PHP Tested ===== ===== How is PHP Tested =====
Line 19: Line 21:
   * autoconf   * autoconf
   * gcc   * gcc
-  * bison or flex +  * flex-old  
-  * libxml2+  * libxml2-dev 
 +  * re2c 
 +  * Bison (before php 5.2)  
 +  * lcov / ggcov
  
  
Line 110: Line 115:
 You must use TEST_PHP_EXECUTABLE environment variable to explicitly select the php executable to be used to run the tests. That can either be the CLI or CGI executable. Command "make test" executes "run-tests.php" script with "php" binary.  Some test scripts such as session must be executed by CGI SAPI. Therefore, you must build PHP with CGI SAPI to perform all tests. You must use TEST_PHP_EXECUTABLE environment variable to explicitly select the php executable to be used to run the tests. That can either be the CLI or CGI executable. Command "make test" executes "run-tests.php" script with "php" binary.  Some test scripts such as session must be executed by CGI SAPI. Therefore, you must build PHP with CGI SAPI to perform all tests.
  
-NOTE: PHP binary executing "run-tests.php" and php binary used for executing test scripts may differ. If you use different PHP binary for executing "run-tests.php" script, you may get errors. This applys when you have php already installen on a machine.  
  
 +<code>
 +TEST_PHP_EXECUTABLE=sapi/cli/php
 +</code>
 +and 
 +<code>
 +export TEST_PHP_EXECUTABLE
 +</code>
  
 +==== All Tests ====
 +You can re-run the same Tests as executed in ''make test'' when you execute the file run-tests.php
  
 +<code>
 +php run-tests.php
 +</code>
  
-==== All Tests ====+==== Single Tests ==== 
 +It is possible to execute a single test or tests residing in one directory. Again run-tests.php helps here.  
 + 
 +A single Test 
 +<code> 
 +php run-tests.php tests/func/test010.phpt 
 +</code> 
 + 
 +A directory with tests  
 +<code> 
 +php run-tests.php tests/func/ 
 +</code> 
 + 
 +===== Write Tests ===== 
 +From here on it's easy to add own tests.  
 + 
 +<code> 
 +--TEST-- 
 +Hello world test 
 +--FILE-- 
 +<?php 
 +echo "Hello"; 
 +?> 
 +--CLEAN-- 
 +--EXPECT-- 
 +Hello 
 +</code>
  
-==== Single Test ==== 
 ===== Write good Tests... ===== ===== Write good Tests... =====
 There are certain guidelines you can follow when writing tests. There are several guidelines that you can follow to get working test code that is solid and makes sense.  There are certain guidelines you can follow when writing tests. There are several guidelines that you can follow to get working test code that is solid and makes sense. 
Line 210: Line 251:
   * Split into several smaller tests   * Split into several smaller tests
  
-==== Lazy Test ==== 
-// 
-This occurs when several test methods check the same  
-method using the same fixture (but for example check the  
-values of different instance variables). Such tests often only  
-have meaning when considering them together so they are  
-easier to use when joined using Inline Method (F:117).//  
- 
-Examples 
-  * Several Tests have the same parameters but different checks on return values 
- 
-Avoid by 
-  * group the tests together 
  
  
qa/testfesttalk.1238359461.txt.gz · Last modified: 2017/09/22 13:28 (external edit)