Testing Joomla Extensions with Codeception: Difference between revisions
From Joomla! Documentation
Kshitij1995 (talk | contribs) |
Javiparati (talk | contribs) No edit summary |
||
| Line 24: | Line 24: | ||
php codecept.phar run acceptance --debug 1stInstallTestCept.php | php codecept.phar run acceptance --debug 1stInstallTestCept.php | ||
</source> | </source> | ||
== Best Practices at Testing == | |||
=== When do not use contains === | |||
We do not recommend to use the function contains on XPath because is not specific and can create false positives at tests. | |||
See: https://github.com/joomla-projects/GSOC-Webdriver_system_tests_for_CMS/pull/99#issuecomment-69004191 | |||
[[Category:Automated Testing]] | [[Category:Automated Testing]] | ||
Revision as of 10:35, 7 January 2015
Note: this page is under construction
What is Codeception?
Codeception PHP Testing Framework is designed to work just out of the box. This means its installation requires minimal steps and no external dependencies preinstalled (except PHP, of course). Only one configuration step should be taken and you are ready to test your web application from an eye of actual user.
Structure of a test
The testing framework is built on the three layered testing architecture
1. Page Objects
Each page on your application has a class which we call page objects, each page class will have information about the URL, fields, Text present on the page. We use the best possible selector for any field on the page
2. Step Objects
Step Objects are classes which contains steps which are to be executed on the application to perform certain operations, step objects make use of page objects to perform thoose actions.
3. Cept Class
Cept or Test, it is the main class which contains steps of execution for the tests, Cept Class will call Step Class functions which will indirectly make use of page objects to perform operations
Running the test
Activating the debug mode
To activate the debug mode in Codeception just add the parameter --debug when you run the tests:
php codecept.phar run acceptance --debug 1stInstallTestCept.php
Best Practices at Testing
When do not use contains
We do not recommend to use the function contains on XPath because is not specific and can create false positives at tests. See: https://github.com/joomla-projects/GSOC-Webdriver_system_tests_for_CMS/pull/99#issuecomment-69004191