Testing Codes Yii2 Application, How To Do?

Hello guys,

I want to start writing tests for my code but never had any experience with these tools.

I’m racking my brain to get run single basic test that comes in the package of advanced application, but I can not do the test run without error.

I found no reference that can help me in this work of mounting the test environment. Can anyone point me to some good step by step tutorial? I found a lot of disjointed things, nothing geared specifically to the default installation Yii2 using Codeception and Webdriver.

I work on a Windows 7 machine and run the app on a virtual machine with Ubuntu. I thought of using Chrome, which is installed in the C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

While the pages of the definitive guide about the tests are not created, can someone give me a light, please?

Many many thanks!

Hi, Athos, sorry for that testing guide pages are not created yet ) dont have enough time and waiting for RC to be finished, so there will be no BC and guide can be done simply. As for you question for now docs are here in extension and yii2 application templates README.md files:




As for yii2-basic template that you are using, all that needed to be done is install yii2-basic, install codeception and additional its packages, than run commands that are listed in README.md in yii2-basic app. and thats it.

If you want to run UI tests in browser, than you need to download selenium 2 standalone from here , last one is 2.42.1 and run it with java -jar selenium-standalone-...jar. Than adjust codeception acceptance suite yaml config to use WebDriver module and set correct settings if needed. Thats it.

If you have some questions in particular , feel free to ask .

I’ve tried everything, I could not.

I give up. I’ll wait for the guide.

If possible, consider using webdriver when creating the guide. :rolleyes:

Can you say what have you tried? You also can check that tests are being executed on travis CI and works fine:

So same steps for you should work fine.

If your question is specific for WebDriver please let me know what you need to clarify.