Cleanup test automation

This commit is contained in:
Chris Boden 2016-01-10 10:42:48 -05:00
parent dce1ef5272
commit 35fa78c0c1
8 changed files with 24 additions and 53 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
composer.lock composer.lock
vendor vendor
tests/ab/reports tests/ab/reports
reports

View File

@ -1,28 +1,30 @@
<?php <?php
namespace Ratchet\RFC6455\Test; namespace Ratchet\RFC6455\Test;
class AbResultsTest extends \PHPUnit_Framework_TestCase class AbResultsTest extends \PHPUnit_Framework_TestCase {
{ private function verifyAutobahnResults($fileName) {
private function verifyAutobahnResults($fileName) if (!file_exists($fileName)) {
{ return $this->markTestSkipped('Autobahn TestSuite results not found');
$this->assertFileExists($fileName); }
$resultsJson = file_get_contents($fileName); $resultsJson = file_get_contents($fileName);
$results = json_decode($resultsJson); $results = json_decode($resultsJson);
$agentName = array_keys(get_object_vars($results))[0]; $agentName = array_keys(get_object_vars($results))[0];
foreach ($results->$agentName as $name => $result) { foreach ($results->$agentName as $name => $result) {
if ($result->behavior === "INFORMATIONAL") { if ($result->behavior === "INFORMATIONAL") {
continue; continue;
} }
$this->assertTrue(in_array($result->behavior, ["OK", "NON-STRICT"]), "Autobahn test case " . $name . " in " . $fileName); $this->assertTrue(in_array($result->behavior, ["OK", "NON-STRICT"]), "Autobahn test case " . $name . " in " . $fileName);
} }
} }
public function testAutobahnClientResults()
{ public function testAutobahnClientResults() {
$this->verifyAutobahnResults(__DIR__ . '/ab/reports/clients/index.json'); $this->verifyAutobahnResults(__DIR__ . '/ab/reports/clients/index.json');
} }
public function testAutobahnServerResults()
{ public function testAutobahnServerResults() {
$this->verifyAutobahnResults(__DIR__ . '/ab/reports/servers/index.json'); $this->verifyAutobahnResults(__DIR__ . '/ab/reports/servers/index.json');
} }
} }

View File

@ -209,8 +209,6 @@ function createReport() {
$testPromises = []; $testPromises = [];
getTestCases()->then(function ($count) use ($loop) { getTestCases()->then(function ($count) use ($loop) {
echo "Running " . $count . " test cases.\n";
$allDeferred = new Deferred(); $allDeferred = new Deferred();
$runNextCase = function () use (&$i, &$runNextCase, $count, $allDeferred) { $runNextCase = function () use (&$i, &$runNextCase, $count, $allDeferred) {
@ -219,7 +217,6 @@ getTestCases()->then(function ($count) use ($loop) {
$allDeferred->resolve(); $allDeferred->resolve();
return; return;
} }
echo "Running " . $i . "\n";
runTest($i)->then($runNextCase); runTest($i)->then($runNextCase);
}; };
@ -227,7 +224,6 @@ getTestCases()->then(function ($count) use ($loop) {
$runNextCase(); $runNextCase();
$allDeferred->promise()->then(function () { $allDeferred->promise()->then(function () {
echo "Generating report...\n";
createReport(); createReport();
}); });
}); });

View File

@ -2,11 +2,11 @@
"options": {"failByDrop": false}, "options": {"failByDrop": false},
"outdir": "./reports/servers", "outdir": "./reports/servers",
"servers": [ "servers": [{
{"agent": "AutobahnServer", "agent": "RatchetRFC/0.1.0",
"url": "ws://localhost:9001", "url": "ws://localhost:9001",
"options": {"version": 18}} "options": {"version": 18}
], }],
"cases": ["*"], "cases": ["*"],
"exclude-cases": ["12.*","13.*"], "exclude-cases": ["12.*","13.*"],
"exclude-agent-cases": {} "exclude-agent-cases": {}

View File

@ -1,13 +0,0 @@
{
"options": {"failByDrop": false},
"outdir": "./reports/servers",
"servers": [
{"agent": "RatchetRFC/0.0.0",
"url": "ws://localhost:9001",
"options": {"version": 18}}
],
"cases": ["1.*", "2.*", "3.*", "4.*", "5.*", "6.*", "7.*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}

View File

@ -1,10 +0,0 @@
{
"url": "ws://127.0.0.1:9001"
, "options": {
"failByDrop": false
}
, "outdir": "./reports/clients"
, "cases": ["1.*", "2.*", "3.*", "4.*", "5.*", "6.*", "7.*"]
, "exclude-cases": []
, "exclude-agent-cases": {}
}

View File

@ -1,12 +1,14 @@
cd tests/ab cd tests/ab
wstest -m fuzzingserver -s fuzzingserver.travis.json & wstest -m fuzzingserver -s fuzzingserver.json &
sleep 5 sleep 5
php clientRunner.php php clientRunner.php
sleep 2 sleep 2
php startServer.php 25 & php startServer.php &
sleep 3 sleep 3
wstest -m fuzzingclient -s fuzzingclient.travis.json wstest -m fuzzingclient -s fuzzingclient.json
sleep 2 sleep 2
killall php wstest

View File

@ -7,13 +7,6 @@ require_once __DIR__ . "/../bootstrap.php";
$loop = \React\EventLoop\Factory::create(); $loop = \React\EventLoop\Factory::create();
if ($argc > 1 && is_numeric($argv[1])) {
echo "Setting test server to stop in " . $argv[1] . " seconds.\n";
$loop->addTimer($argv[1], function () {
exit;
});
}
$socket = new \React\Socket\Server($loop); $socket = new \React\Socket\Server($loop);
$server = new \React\Http\Server($socket); $server = new \React\Http\Server($socket);