Perth Hackfest October 2012/Testing
From MoodleDocs
- David Monllaó demo of automated testing
- behat scripts are like user stories, e.g.
- In order to login As a moodle user I need to be able to validate the username and password against moodle
- behat language (gherkin) is translated to php and then communicates with selenium server
- Can run on windows/firefox/chrome/mobile
- Can run tests in parallel with Selenium Grid
- Can add fixtures to set up the test context using a set of steps definitions in the Background section or in the beginning of the Scenario
- Scripts will be distributed with core, but testing software still needs to be packaged up into an easily installable program
- Uses composer as installer
- Also need to write more step definitions
- Need to change the way core Moodle outputs html to make it more robust (CSS selectors for example)
- Next steps in automated testing
- Need help in setting up framework
- Need good set of general steps definitions
- Need users to write test cases (writing tests should be made easy that non developers can make them)
- Should have sprint dedicated to writing unit testing (after web services sprint)
- Need guidelines for when to add unit tests and functional tests
- New features will require phpunit tests and web services component written (unless there is a valid reason)
- Bug fixes should also have phpunit tests written, if applicable. For functional changes, will require tests later once framework is done.
- Should we have this heavy requirement? It might slow down bug fix contributions
- What happens with community contributed bug fixes? Moodle HQ can write the unit tests for them during review/testing
- Links:
- http://behat.org/
- Cucumber: http://cukes.info/
- Acceptance testing
- Behat integration
- Composer: http://getcomposer.org/
- Contributors/Volunteers
- Adrian
- Sam H
- Justin
- Dan
- Rex Lorenzo
- Raj
- Ankit
- Damyon
- Simon
- Rosie
- David Mo