Getting started with unit test SimpleTest and getting started with simpletest
Recently, I used PHPunit to test the learning unit test. As a result, there were a lot of installation problems, so I immediately gave up and tried simpletest. It was much simpler. The steps are listed below.
1. Download simpletest (version 1.1.0), http://www.winsite.com/Development/Miscellaneous/SimpleTest/
Get a folder named simpletest
2. Put the folder in the root directory of your project.
3. Write the file to be tested, Sum. php, a simple Sum class, which is stored in the project root directory.
4. Write the test file testSum. php to the root directory of the project.
We can see that there are 2 test classes and 5 test projects, of which 2 test results do not meet our expectations. during the test, you can directly execute the file without instantiating test classes 1 and 2. the result is as follows:
2/2 indicates that there are two test classes. The result is 3 passed and 2 errors. The error causes are listed.
Let's modify the code to get rid of the wrong input:
Result:
Test passed!
4. The above is just a simple example, the actual test must be more complex. Next is to see the document: https://pan.baidu.com/s/1nv0HOZv
5. Read the English document