Revision #89 has been created by rackycz on Nov 23, 2021, 8:41:19 PM with the memo:
Tests
« previous (#88) next (#90) »
Changes
Title
unchanged
Yii v2 snippet guide III
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,yii2,beginer
Content
changed
[...]
```php
php ./vendor/bin/codecept run
```
This will run Unit and Functional tests. They are defined in folder tests/unit and tests/functional. Functional tests run in a hidden browser and do not work with JavaScript I think. In order to test complex JavaScript, you need Acceptance Tests. How to run them is to be found in file README.md in both demo applications. If you want to run these tests in your standard Chrome or Firefox browser, you will need JDK[Java JDK](https://www.oracle.com/java/technologies/downloads/) and file
[selenium-server*.jar
](https://www.selenium.dev/downloads). See links in README.md. Once you have the JAR file, place is to your project and
callrun it:
```php[...]
```
Now you can rerun your tests. Make sure that you have working URL of your project in file acceptance.suite.yml, section WebDriver. For example http://localhost/yii-basic/web. It depends on your environment. Also specify browser. For me works well setting "browser: chrome".
If you receive error "WebDriver is not installed", you need to caal this composer command:
```php
composer require codeception/module-webdriver --dev
```