2

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?

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Could you please let me know in detail. I have run the above script, it work's perfect for me. But I want to know in detail. I am not able to find the docs/sources folder in codeception.
@PayalPandav I think it's kinda offtopic here, but I would try to answer. Codeception sources are hosted on github: github.com/Codeception/Codeception, docs can be found there in docs folder or online codeception.com/docs
I have checked whole documentation but I didn't get the PHP script with an object. $Codecept->run('your_test_suit_name'); I required the HTML report and all other option of Codecept object. I have tried the $Codecept = new \Codeception\Codecept(array( 'steps' => true, 'verbosity' => 1, 'html' => true, )); but not work for me. Can you please do needfull for me. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.