File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments