Commit 4ac6777c by Alexander Makarov

Very draft testing docs

parent 5db07a71
...@@ -112,7 +112,7 @@ if you are starting from `frontend` tests then you should run `yii migrate` in e ...@@ -112,7 +112,7 @@ if you are starting from `frontend` tests then you should run `yii migrate` in e
it will upgrade your database to the last state according migrations. it will upgrade your database to the last state according migrations.
To be able to run acceptance tests you need a running webserver. For this you can use the php builtin server and run it in the directory where your main project folder is located. For example if your application is located in `/www/advanced` all you need to is: To be able to run acceptance tests you need a running webserver. For this you can use the php builtin server and run it in the directory where your main project folder is located. For example if your application is located in `/www/advanced` all you need to is:
`cd /www` and then `php -S 127.0.0.1:8080` because the default configuration of acceptance tests expects the url of the application to be `/advanced/`. `cd /www` and then `php -S 127.0.0.1:8080 index-test.php` because the default configuration of acceptance tests expects the url of the application to be `/advanced/`.
If you already have a server configured or your application is not located in a folder called `advanced`, you may need to adjust the `TEST_ENTRY_URL` in `frontend/tests/_bootstrap.php` and `backend/tests/_bootstrap.php`. If you already have a server configured or your application is not located in a folder called `advanced`, you may need to adjust the `TEST_ENTRY_URL` in `frontend/tests/_bootstrap.php` and `backend/tests/_bootstrap.php`.
After that is done you should be able to run your tests, for example to run `frontend` tests do: After that is done you should be able to run your tests, for example to run `frontend` tests do:
......
...@@ -151,9 +151,9 @@ Testing ...@@ -151,9 +151,9 @@ Testing
------- -------
* [Overview](test-overview.md) * [Overview](test-overview.md)
* **TBD** [Unit Tests](test-unit.md) * [Unit Tests](test-unit.md)
* **TBD** [Functional Tests](test-functional.md) * [Functional Tests](test-functional.md)
* **TBD** [Acceptance Tests](test-acceptance.md) * [Acceptance Tests](test-acceptance.md)
* [Fixtures](test-fixtures.md) * [Fixtures](test-fixtures.md)
......
Acceptance Tests
================
> Note: This section is under development.
- http://codeception.com/docs/04-AcceptanceTests
- https://github.com/yiisoft/yii2/blob/master/apps/advanced/README.md#testing
- https://github.com/yiisoft/yii2/blob/master/apps/basic/tests/README.md
How to run php-server
---------------------
Functional Tests
----------------
> Note: This section is under development.
- http://codeception.com/docs/05-FunctionalTests
- https://github.com/yiisoft/yii2/blob/master/apps/advanced/README.md#testing
- https://github.com/yiisoft/yii2/blob/master/apps/basic/tests/README.md
Testing Testing
======= =======
> Note: This section is under development.
TODO:
- https://github.com/yiisoft/yii2/blob/master/extensions/codeception/README.md
Testing is an important part of software development. Whether we are aware of it or not, we conduct testing continuously. Testing is an important part of software development. Whether we are aware of it or not, we conduct testing continuously.
For example, when we write a class in PHP, we may debug it step by step or simply use echo or die statements to verify For example, when we write a class in PHP, we may debug it step by step or simply use echo or die statements to verify
that implementation is correct. In case of web application we're entering some test data in forms to ensure the page that implementation is correct. In case of web application we're entering some test data in forms to ensure the page
......
Unit Tests
==========
> Note: This section is under development.
TODO:
- https://github.com/yiisoft/yii2/blob/master/apps/advanced/README.md#testing
- https://github.com/yiisoft/yii2/blob/master/apps/basic/tests/README.md
A unit test verifies that a single unit of code is working as expected. In object-oriented programming, the most basic
code unit is a class. A unit test thus mainly needs to verify that each of the class interface methods works properly.
That is, given different input parameters, the test verifies the method returns expected results.
Unit tests are usually developed by people who write the classes being tested.
Unit testing in Yii is built on top of PHPUnit and, optionally, Codeception so it's recommended to go through their docs:
- [PHPUnit docs starting from chapter 2](http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html).
- [Codeception Unit Tests](http://codeception.com/docs/06-UnitTests).
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment