I began this second day with a presentation of Rspec, Behaviour Driven Development and Selenium Grid, by Jean Michel Garnier. He told us about the history of software testing, Test Driven Development and Behaviour Driven Development.
So what is TDD against BDD ? Quite the something, from a technical point of view; but in fact it diminishes the distance between the client and the software engineer.
BDD is about writing sentences to describe tests.
A story (from Dan North point of view) (As … I want … To …)is divided into scenarios ( Given … When … Then …).
The thing is, the people who write specs “could” write Rspec classes, but the syntax is still a bit technical …
Then Jean Michel told us about Autotest, a framework to automatically run tests when you modify a source code; Rcov a software to measure code coverage of your tests (gem install rcov ; rake spec:rcov and finally Heckle, a framework that modifies your source code to … check that your tests are useful !
Next, I’ve seen a presentation of the origins of Agile methods; introducing the Agile Manifesto, agile principles,agile methods like Scrum (3 actors : product owner, scrum master and the team; product backlog to prioritize stories, sprint backlog to split stories in different tasks, and the sprint; and eXtreme Programmingwith its values simplicity, respect, courage, etc…)
The orator also remind the audience about older, predictive methods like cascade and V…
I’ve also attended a session proposed by Guillaume Carré, from Xebia presenting unit tests and Easymocks, where the audience was able to distinguish stubs from mocks, mocks being more faithful to the real behaviour of the class.
Easymock uses interfaces to create mocks, so you get all the mock coding job done !(but you have to describe the behaviour of your mock object).
The orator also talked about Mockito, from ThoughtWorks, which gets the description of the mock object according to the method called on this mock; you still describe the behaviour of the mock, but this time you verify the value returned at the end of your test, not before (which makes test code more readable than Easymock).
To finish the day, Jean François Helie, from Octo coded in front of us a blog engine, based on hibernate, maven, Spring, and Spring MVC but … using a test driven approach.
Jean François used Java 5 annotations to describe JUnits tests and once the tests were done, coded the application classes.
He first wrote code for the DAO classes, using Hibernate entity beans annotations (it looks so good persistence without XML).
Then he decided to lighten the test class code with Spring 2.5, using annotations to autowire bean dependencies (yeah annotations look good)
Once the model was written, he continued to the service, writing the test first, of course, but also using mock objects to be able to distinguish errors from the model to errors from the service class; for that he used Easymock linked with Junitils4 with annotations.
Finally, he wrote the controller, always writing the test class first, using Spring MVC framework (specifying the url mapping in the controller class)
The demonstration was quite impressive, I really enjoyed that one! (it reminded me that Java is still on !)
My colleagues from Valtech were not on holidays this second day, they presented Test Driven Requirements, using Fitnesse; continuous integration with Hudson (getting very popular now) and contracting Agile projects.
These XP day(s) were a great experience, I really hope I’ll be there next year !