Skip to content

Removing Cept #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions docs/07-AdvancedUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ For example, you might need some tests to be executed in Firefox only, and some
The desired environments can be specified with the `@env` annotation for tests in Test and Cest formats:

{% highlight php %}

<?php
class UserCest
{
Expand All @@ -482,17 +481,6 @@ class UserCest
// I do something
}
}

{% endhighlight %}

For Cept you should use simple comments:

{% highlight php %}

<?php
// @env firefox
// @env chrome

{% endhighlight %}

This way you can easily control which tests will be executed for each environment.
Expand Down Expand Up @@ -524,20 +512,16 @@ $scenario->current('capabilities');

{% endhighlight %}

You can access `\Codeception\Scenario` in the Cept and Cest formats.
In Cept, the `$scenario` variable is available by default,
while in Cest you should retrieve it through dependency injection:
You can inject `\Codeception\Scenario` like this:

{% highlight php %}

<?php
public function myTest(\AcceptanceTester $I, \Codeception\Scenario $scenario)
{
if ($scenario->current('browser') == 'chrome') {
// ...
}
}

{% endhighlight %}

`Codeception\Scenario` is also available in Actor classes and StepObjects. You can access it with `$this->getScenario()`.
Expand Down Expand Up @@ -628,7 +612,7 @@ You can pass the `-c` option to any Codeception command (except `bootstrap`), to

$ php vendor/bin/codecept run -c ~/projects/ecommerce/
$ php vendor/bin/codecept run -c ~/projects/drupal/
$ php vendor/bin/codecept generate:cept acceptance CreateArticle -c ~/projects/drupal/
$ php vendor/bin/codecept generate:cest acceptance CreateArticle -c ~/projects/drupal/

{% endhighlight %}

Expand Down Expand Up @@ -678,18 +662,6 @@ public function testAdminUser()

{% endhighlight %}

For Cept files, use pseudo-annotations in comments:

{% highlight php %}

<?php
// @group admin
// @group editor
$I = new AcceptanceTester($scenario);
$I->wantToTest('admin area');

{% endhighlight %}

For `.feature`-files (Gherkin) use tags:

{% highlight gherkin %}
Expand Down Expand Up @@ -750,7 +722,7 @@ This will load all found `p*` files in `tests/_data` as groups. Group names will

## Formats

In addition to the standard test formats (Cept, Cest, Unit, Gherkin) you can implement your own format classes to customise your test execution.
In addition to the standard test formats (Cest, Unit, Gherkin) you can implement your own format classes to customise your test execution.
Specify these in your suite configuration:

{% highlight yaml %}
Expand Down