Skip to content

Commit 6908105

Browse files
committed
Adding test for volt test to check different os
1 parent bceb0a0 commit 6908105

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/VoltTestTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use VoltTest\Exceptions\ErrorHandler;
7+
use VoltTest\VoltTest;
8+
9+
class VoltTestTest extends TestCase
10+
{
11+
protected function setUp(): void
12+
{
13+
parent::setUp();
14+
// Ensure error handlers are registered at the start of each test
15+
ErrorHandler::register();
16+
}
17+
18+
protected function tearDown(): void
19+
{
20+
// Clean up error handlers after each test
21+
ErrorHandler::unregister();
22+
parent::tearDown();
23+
}
24+
public function testVoltTest()
25+
{
26+
$voltTest = new VoltTest("test");
27+
$voltTest->setVirtualUsers(10);
28+
$scenario1 = $voltTest->scenario("Test Scenario")->setWeight(10);
29+
$scenario1->step("Step 1")->get('https://www.google.com');
30+
$scenario2 = $voltTest->scenario("Test Scenario 2")->setWeight(90);
31+
$scenario2->step("Step 1")->get('https://www.google.com');
32+
$result = $voltTest->run();
33+
$this->assertNotEmpty($result->getRawOutput(), "Raw output is empty");
34+
$this->assertGreaterThan(0, $result->getDuration(), "Duration is not greater than 0");
35+
$this->assertGreaterThan(0, $result->getAvgResponseTime(), "Average response time is not greater than 0");
36+
}
37+
}

0 commit comments

Comments
 (0)