User tests: Successful: Unsuccessful:
One of the latest PHPStorm EAP releases contained "initial support" for Behat which, in conjunction with Mink, can be used to write automated tests.
I had not heard of Behat before but it immediately caught my attention because of the way tests are written in natural language -- Like this:
Scenario: Check the top menu "Users"
Given I am on "/"
And I follow "Users"
Then I should see "Users List"
This is the whole test. Human readable. No code involved.
Since our test suite is not very extensive currently -- maybe we can explore this a bit.
I also added a method to login a dummy user or a dummy admin for testing purpose. This functionality should only be available in a "local" environment.
Not sure how/if it can be run on Travis. I remember there was the possibility to start some kind of HTTP server?
There is also support for Selenium2 - just prefix a feature with @javascript
and fire up the Selenium server.
This is meant as a start
See also: Testing Documentation
Hey man, we are really on one line: Behat is also part of my presentation next week on JAB. Gave a presentation about it 2 weeks ago at 010php; some slides the same as on JAB, see http://www.slideshare.net/HermanPeeren/behat-34469545
Behat automatically generates tests from that format in which some steps have to be filled in by us, the programmers. Some common step definitions can be put together in a collection. Like for instance for Drupal: https://drupal.org/project/drupalextension . Also see this nice intro-video by Lin Clark: http://lin-clark.com/blog/2013/11/26/quickstart-testing-with-behat-mink-selenium/
The main advantages I see with BDD (Behavioral Driven Depevepment) with Behat:
What I also like of Mink: you do not always need a complete Selenium browser emulation, which makes the test take very long (Javier told me it takes half a day, if I remember well, to do all Selenium tests for the Joomla CMS). When you don't use Javascript, you can also use a so called headless browser, like Goutte. Mink is a layer around those different browser emulations.
Codeception is another PHP framework for BDD. It can be used from PHP. That is easier for developers, but I personally think it is better to use domain language as much as possible. But an advantage of Codeception is also that it can be used for the PHPUnit-tests as well, once you are implementing on the class-level. Things can be combined. Also see this book: http://www.manning.com/smart/
OK, Behat is running on Travis
https://travis-ci.org/joomla/jissues/jobs/26402625
Description | <p>One of the latest <a href="http://blog.jetbrains.com/phpstorm/2014/05/phpstorm-8-eap-138-184/">PHPStorm EAP releases</a> contained "initial support" for <a href="http://behat.org/">Behat</a> which, in conjunction with <a href="http://mink.behat.org/">Mink</a>, can be used to write automated tests. <br> I had not heard of Behat before but it immediately caught my attention because of the way tests are written in natural language -- Like this:</p> <pre><code> Scenario: Check the top menu "Users" Given I am on "/" And I follow "Users" Then I should see "Users List" </code></pre> <p>This is the whole test. Human readable. No code involved.</p> <p>Since our test suite is not very extensive currently -- maybe we can explore this a bit.</p> <p>I also added a method to login a dummy user or a dummy admin for testing purpose. This functionality should only be available in a "local" environment.</p> <p>Not sure how/if it can be run on Travis. I remember there was the possibility to start some kind of HTTP server?</p> <p>There is also support for <a href="http://docs.seleniumhq.org/">Selenium2</a> - just prefix a feature with <code>@javascript</code> and fire up the Selenium server.</p> <p>This is meant as a start <img class="emoji" title=":wink:" alt=":wink:" src="https://assets-cdn.github.com/images/icons/emoji/wink.png" height="20" width="20" align="absmiddle"></p> <p>See also: <a href="https://github.com/joomla/jissues/blob/behat/Documentation/Development/Testing.md">Testing Documentation</a></p> | ⇒ | <p>One of the latest <a href="http://blog.jetbrains.com/phpstorm/2014/05/phpstorm-8-eap-138-184/">PHPStorm EAP releases</a> contained "initial support" for <a href="http://behat.org/">Behat</a> which, in conjunction with <a href="http://mink.behat.org/">Mink</a>, can be used to write automated tests. <br> I had not heard of Behat before but it immediately caught my attention because of the way tests are written in natural language -- Like this:</p> <pre><code> Scenario: Check the top menu "Users" Given I am on "/" And I follow "Users" Then I should see "Users List" </code></pre> <p>This is the whole test. Human readable. No code involved.</p> <p>Since our test suite is not very extensive currently -- maybe we can explore this a bit.</p> <p>I also added a method to login a dummy user or a dummy admin for testing purpose. This functionality should only be available in a "local" environment.</p> <p>Not sure how/if it can be run on Travis. I remember there was the possibility to start some kind of HTTP server?</p> <p>There is also support for <a href="http://docs.seleniumhq.org/">Selenium2</a> - just prefix a feature with <code>@javascript</code> and fire up the Selenium server.</p> <p>This is meant as a start <img class="emoji" title=":wink:" alt=":wink:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f609.png" height="20" width="20" align="absmiddle"></p> <p>See also: <a href="https://github.com/joomla/jissues/blob/behat/Documentation/Development/Testing.md">Testing Documentation</a></p> |
just crossreferencing for system testing. Similar pull but using Codeception instead of Behat/Mink joomla/joomla-cms#6463
Test are not that nice but human readable too: https://github.com/joomla/joomla-cms/pull/6463/files#diff-7392bf22f8e471d7cdd3253559928d2aR27
We need tests. Of everything. Can we do something with this?
We need a spare time for tests :( Codeception also is nice. Thanks @javigomez for JAB15 session ;) May be sometimes we will have a JTracker Tests Working Group?
Can't say I've done anything with Behat, but Codeception I've done a little bit with. The only "issue" with whatever platform gets used for tests around the UI is it's gotta be able to deal with our AJAX'd interface (which I think Codeception does, again don't know enough on Behat to comment there).
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-29 17:33:16 |
Closed_By | ⇒ | elkuku |
Apache server setup/startup can be found in the HTTP Package.
Cool idea :-)