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
vendor
tests/ab/reports
reports

View File

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

View File

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

View File

@ -2,11 +2,11 @@
"options": {"failByDrop": false},
"outdir": "./reports/servers",
"servers": [
{"agent": "AutobahnServer",
"servers": [{
"agent": "RatchetRFC/0.1.0",
"url": "ws://localhost:9001",
"options": {"version": 18}}
],
"options": {"version": 18}
}],
"cases": ["*"],
"exclude-cases": ["12.*","13.*"],
"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
wstest -m fuzzingserver -s fuzzingserver.travis.json &
wstest -m fuzzingserver -s fuzzingserver.json &
sleep 5
php clientRunner.php
sleep 2
php startServer.php 25 &
php startServer.php &
sleep 3
wstest -m fuzzingclient -s fuzzingclient.travis.json
sleep 2
wstest -m fuzzingclient -s fuzzingclient.json
sleep 2
killall php wstest

View File

@ -7,13 +7,6 @@ require_once __DIR__ . "/../bootstrap.php";
$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);
$server = new \React\Http\Server($socket);