Screencast: SilverStripe Behaviour Testing Framework – GSoC 2012
During the second phase of GSoC an idea came into my mind. Why not allow other developers test their SilverStripe modules behaviourally?
There was already an extension created for basic interactions with the temporary database, but it was not in the state where you would be able to use it outside of the Sapphire framework.
But that’s the thing of the past. Now, let me introduce you to the new, shiny SilverStripeExtension.
SilverStripe relies heavily on AJAX interactions with feedback times varying from 200ms to multiple seconds. In order to make testing both stable and fast we needed a more sophisticated system than fixed timeouts.
This has already been implemented for the old spec-by-example module.
Using subcontexts with Behat and Mink is easy. You only need to remember to only extend MinkContext (or use Mink as subcontext) once, because it has some basic step definitions already defined and Behat doesn’t allow redundant step definitions.
In behat documentation, the topic of intercepting redirections is discussed in the context of using the profiler to test some of the features that hit specific browsers.
The solution proposed there has a specific drawback: it only works when you are trying to test using either
However, if some of the features you want to test using different driver too – like
selenium2, that supports redirections, but does not allow to intercept them – you have to try different approach.
Do yourself a favour and don’t even think about doing it, just go with the Composer method. Don’t waste time, seriously.
2.4.0at the time of writing), which is crucial in such edge technologies.
Today, Ingo introduced me to this Specification by Example book by Gojko Adzic. In his opinion it should explain the high-level goals we want to achieve during this project.
On 22.05 the 2012 edition of Google Summer of Code started and I’m lucky to be one of the participants, working with SilverStripe!
Here is an excerpt from my project summary:
SilverStripe has a decent coverage of unit tests, but these tests test mostly backend and don’t examine the CMS/framework from the user perspective. The goal of the project is to introduce acceptance tests (simulate user behaviour in the system to check most common actions).