com web/qa: Added a section with information on debugging unexpectedly failing .phpt cases: write-test.php
| From: | Johannes Schlüter | Date: | Tue, 10 Mar 2015 10:56:55 +0000 |
| Subject: | com web/qa: Added a section with information on debugging unexpectedly failing .phpt cases: write-test.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-67506@lists.php.net to get a copy of this message | ||
Commit: 10e1643fe01f4ae2cc41749e9fbca033f77d4ce7
Author: Freek Lijten <freeklijten@gmail.com> Tue, 10 Mar 2015 11:56:55 +0100
Parents: 6516a3ee1e3e7397ac786a99063ecddde1d74372
Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=10e1643fe01f4ae2cc41749e9fbca033f77d4ce7
Log:
Added a section with information on debugging unexpectedly failing .phpt cases
Changed paths:
M write-test.php
Diff:
diff --git a/write-test.php b/write-test.php
index f8e641b..b765cc9 100644
--- a/write-test.php
+++ b/write-test.php
@@ -155,6 +155,40 @@ some typing and ensure that you get a good basic format.
See <a href="autogenerate.php">test case generation</a> for instructions on
how to use it.</p>
+<h3><a name="debugging-tests" href="#debugging-tests"
class="anchor">#</a>Debugging tests</h3>
+<p>While writing tests you will probably run into tests not passing while you think they
should. The 'make test' command
+provides you with debug information. Several files will be added per test in the same directory as
the .phpt file itself.
+Considering your test file is named foo.phpt, these files provide you with information that can
help you find out what went wrong:
+ <ul type="none">
+ <li>
+ <i>foo.diff</i><br />
+ <!-- Give me some space! -->
+ A diff file between the expected output (be it in EXPECT, EXPECTF or another option) and the
actual output.
+ </li>
+ <li>
+ <i>foo.exp</i><br />
+ <!-- Give
me some space! -->
+ The expected output.
+ </li>
+ <li>
+ <i>foo.log</i><br />
+ <!-- Give
me some space! -->
+ A log containing expected output, actual output and results. Most likely very similar to info in
the other files.
+ </li>
+ <li>
+ <i>foo.out</i><br />
+ <!-- Give
me some space! -->
+ The actual output of your .phpt test part.
+ </li>
+ <li>
+ <i>foo.php</i><br />
+ <!-- Give
me some space! -->
+ The php code that was executed for this test.
+ </li>
+ </ul>
+</p>
+
+
<h3><a name="testing-tests" href="#testing-tests"
class="anchor">#</a> Testing your test cases</h3>
<p>Most people who write tests for PHP don't have access to a huge number of operating
systems but the tests are run
on every system that runs PHP. It's good to test your test on as many platforms as you can -
Linux and Windows