Skip to content

Commit 0fddad0

Browse files
committed
Enhance Testrunner
1 parent 678ae9c commit 0fddad0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test-runner.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TestRunner extends PHPUnit\Framework\TestCase
4242
//random amount for transactions/subscriptions
4343
public static function getAmount()
4444
{
45-
return 12 + (rand(1, 900000)/12);
45+
return 12 + (rand(1, 9000)/10);
4646
}
4747
//random email for a new customer profile
4848
public static function getEmail()
@@ -70,12 +70,14 @@ public function testAllSampleCodes()
7070
list($apiName, $isDependent, $shouldRun)=explode(",", $line);
7171
$apiName = trim($apiName);
7272
echo "\nApi name: " . $apiName."\n";
73+
fwrite(STDOUT, print_r("\nStarting Test: " . $apiName."\n", TRUE));
7374
}
7475
if ($apiName && (false === strpos($apiName, SAMPLE_CODE_NAME_HEADING))) {
7576
echo "should run:".$shouldRun."\n";
7677
if ("0" === $shouldRun) {
77-
echo ":Skipping " . $sampleMethodName . "\n";
78+
echo ":Skipping " . $apiName . "\n";
7879
} else {
80+
//Try the request twice
7981
for ($i=0; $i<=1; $i++) {
8082
if ("0" === $isDependent) {
8183
echo "not dependent\n";
@@ -89,7 +91,9 @@ public function testAllSampleCodes()
8991
//request the api
9092
echo "Running sample: " . $sampleMethodName . "\n";
9193

94+
fwrite(STDOUT, print_r($apiName . "Start Time: " . date("H:i:s."). gettimeofday()['usec'] . "\n", TRUE));
9295
$response = call_user_func($sampleMethodName);
96+
fwrite(STDOUT, print_r($apiName . "Finish Time: " . date("H:i:s."). gettimeofday()['usec'] . "\n", TRUE));
9397

9498
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
9599
break;
@@ -99,6 +103,7 @@ public function testAllSampleCodes()
99103
//response must be successful
100104
$this->assertNotNull($response);
101105
$this->assertEquals($response->getMessages()->getResultCode(), "Ok");
106+
echo $sampleMethodName . " - OK \n";
102107
$runTests++;
103108
}
104109
}

0 commit comments

Comments
 (0)