vendredi 22 mars 2019

Pass variable to Laravel Dusk Test Case from Controller

I'm currently working on some tests for my laravel project. I've created a test factory (test function inside the tests folder), which basically just executes testing steps that have been generated automatically. The problem I'm facing now is that I want to pass a single test case as variable to the function.

I'm starting a single test by using shell_exec('cd ../ && php artisan dusk --filter testSubmission');.

I've tried achieving this by setting global variables in following two ways:

  • config (Laravel)
  • GLOBALS

Test Case Generation function

...
// Either
config(['testing.testCase' => $testCase]);

// Or
$GLOBALS["testCase"] = $testCase;
...

and than in:

Test Case Execution function

//Either
$testCase = config('testing.testCase');

//Or

$testCase = $GLOBALS["testCase"];


Does anyone has any idea how to solve this problem?

Thanks for your help in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire