-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from chrisdicarlo/pest-integration
Pest Integration
- Loading branch information
Showing
5 changed files
with
65 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<!-- count-failed.xsl --> | ||
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> | ||
<xsl:template match="/"> | ||
<xsl:value-of select="count(tests/test[@status='3'])" /> | ||
<xsl:value-of select="count(tests/test)" /> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,29 @@ | ||
#!/bin/bash | ||
|
||
logfile=./testdox.xml | ||
logfile=./junit.xml | ||
|
||
if test -f "$logfile"; then | ||
echo "Logfile found. Searching for failed tests..." | ||
if [ -f "./vendor/bin/pest" ]; then | ||
runner="./vendor/bin/pest" | ||
else | ||
runner="./vendor/bin/phpunit" | ||
fi | ||
|
||
# Strip out everything except the failed tests just in | ||
# case they were run using a different tool or script | ||
xmlstarlet tr ./vendor/chrisdicarlo/phpunit-failed-runner/prune.xsl testdox.xml > testdoxTMP.xml | ||
mv testdoxTMP.xml testdox.xml | ||
if test -f "$logfile"; then | ||
echo -e "Logfile found. Searching for previously failing tests... \U23F3" | ||
|
||
failed_tests="$(xmlstarlet tr --omit-decl ./vendor/chrisdicarlo/phpunit-failed-runner/failed-tests.xsl testdox.xml)" | ||
count_failed_tests="$(xmlstarlet tr ./vendor/chrisdicarlo/phpunit-failed-runner/prune.xsl junit.xml | xmlstarlet tr --omit-decl ./vendor/chrisdicarlo/phpunit-failed-runner/count-failed.xsl)" | ||
|
||
if [ "$failed_tests" = "" ]; then | ||
echo "No failed tests! Great job!" | ||
if [ "$count_failed_tests" = "0" ]; then | ||
echo -e "No failed tests! Great job! \U1F44D \U1F389" | ||
rm "$logfile" | ||
exit 0 | ||
else | ||
echo "Found failed tests, filtering..." | ||
./vendor/bin/phpunit --filter "'$failed_tests'" | ||
echo -e "Found $count_failed_tests previously failing tests, filtering... \U1F97A" | ||
filter=$(xmlstarlet tr ./vendor/chrisdicarlo/phpunit-failed-runner/prune.xsl junit.xml | xmlstarlet tr --omit-decl ./vendor/chrisdicarlo/phpunit-failed-runner/failed-tests.xsl); "$runner" --filter "$filter" --log-junit junit.xml | ||
fi | ||
else | ||
echo "Logfile not found. Running the full test suite..." | ||
./vendor/bin/phpunit | ||
fi | ||
|
||
# Strip out everything except the failed tests | ||
xmlstarlet tr ./vendor/chrisdicarlo/phpunit-failed-runner/prune.xsl testdox.xml > testdoxTMP.xml | ||
mv testdoxTMP.xml testdox.xml | ||
|
||
# If there are no more failed tests, remove the log file | ||
count_failed_tests="$(xmlstarlet tr --omit-decl ./vendor/chrisdicarlo/phpunit-failed-runner/count-failed.xsl testdox.xml)" | ||
|
||
if [ "$count_failed_tests" = "0" ]; then | ||
rm ./testdox.xml | ||
echo -e "Logfile not found. Running the full test suite... \U1F91E" | ||
"$runner" --log-junit junit.xml | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
<xsl:strip-space elements="*"/> | ||
<xsl:output omit-xml-declaration="no" indent="yes"/> | ||
|
||
<xsl:template match="node()|@*"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="node()|@*"/> | ||
</xsl:copy> | ||
<xsl:template match="/"> | ||
<tests> | ||
<xsl:apply-templates /> | ||
</tests> | ||
</xsl:template> | ||
|
||
<xsl:template match="test[not(@status='3')]"/> | ||
<xsl:template match="/testsuite"> | ||
<tests> | ||
<xsl:apply-templates select="testcase" /> | ||
</tests> | ||
</xsl:template> | ||
|
||
<xsl:template match="testcase[error|failure]"> | ||
<test> | ||
<xsl:value-of select="@class"/>::<xsl:value-of select="@name"/> | ||
</test> | ||
</xsl:template> | ||
</xsl:stylesheet> |