mardi 30 avril 2019

How to pass different data to multiple instances of the same test with Robo

What am I trying to achieve?

I made a test which logs into a web application I have, completes an exam and submits it at the end.

I need to test how many users the server can handle so my intention is to run the same test multiple times, but I need to be able to pass each instance a different user:password.

Right now I have an array with the credentials inside the test itself, and I made it so it takes a random item from the array. This works but obviously sometimes it takes the same credentials 2 times so this isnt a reliable solution.

This is my RoboFile:

public function parallelSplitTests()
  {
   // Split your tests by files
        $this->taskSplitTestFilesByGroups(5)
            ->projectRoot('.')
            ->testsFrom('tests/acceptance')
            ->groupsTo('tests/_data/paracept_')
            ->run();
    }
public function parallelRun()
    {
    $parallel = $this->taskParallelExec();

             for ($i = 1; $i <= 1; $i++) {

             $parallel->process(
              $this->taskCodecept() // use built-in Codecept task
            ->suite('acceptance') // run acceptance tests
            ->group("paracept_$i") // for all paracept_* groups
                ->xml("tests/_log/result_$i.xml") // save XML results
                );
            }

             return $parallel->run();
           }

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire