Gizzmo
Gizzmo

Reputation: 739

How do you run a codeception test from within a php script?

I do not want to run a codeception test from the CLI:

php <pathToCodeCeption>/codecept run

I want to run it inside a PHP script:

<?php

$codeCeptionRunner = /* What to do here*/;
$codeCeptionRunner->run();

Does anyone has an idea how to accomplish this task?

Upvotes: 2

Views: 1181

Answers (1)

Alexander Kuntashov
Alexander Kuntashov

Reputation: 694

Start with this snippet:

<?php
require_once '/path/to/codeception/autoload.php';

$Codecept = new \Codeception\Codecept(array(
    'steps' => true,
    'verbosity' => 1,
    // some other options (see Codeception docs/sources)
 ));

 $Codecept->run('your_test_suit_name');

and then dig into Codeception sources. It is really clear and easy to understand.

Upvotes: 4

Related Questions