Geert Van Der Cruijsen gave a  Xamarin University guest lecture that I attended on behavior driven development (BDD) for mobile applications.

His website is http://mobilefirstcloudfirst.net/ and he has some great Xamarin blog posts (not all about automated testing). Geert is a technical expert and architect on mobile and cloud working as a lead consultant in the Netherlands. He is also a Xamarin University training partner.

The lecture started by going over what BDD is and why we use it. Geert explained that BDD has come about because of the following problem:

The product owner speaks in plain text; the developer speaks in code and the tester speaks in test plans.

The business guy has a great idea that will change the world and make a load of money. He needs a way to express this as requirements and communicate it to the developers without misunderstanding.

With each party speaking in their own language there is a cost to the translation which causes the requirements to blur and the end result is not necessarily what the customer wants, as such:

We need one ubiquitous language between all the parties which helps build a clear specification. This is where BDD comes in, If the PO can write a requirement and that wording exists in both the specification and the solution itself there is less room for miscommunication. Also the code itself should reflect the business terminology through domain driven development.

BDD tries to create a communication flow between the business and the developers (+testers). Requirements are split into (small) specific scenarios that the business can write in a well-known form that the developer knows and is directly translatable into the software features – this leads to improved understanding.

Enter: SpecFlow, NUnit, Gherkin, Xamarin.UITest, Xamarin Test Cloud

Geert introduced the above technologies and then focused on some of the specifics of implementing this process into a Xamarin mobile application and why. He gave the statistic that 26% of application downloads are abandoned after the first use and as such:

Mobile application quality is very important and the applications can be very complex. Having the application right the first time is very important.

He then walked through a demo Xamarin application and added some SpecFlow tests around its functionality and displayed running the tests on the Xamarin Test Cloud.

All in all the lecture was mainly about the benefits of BDD for the business and the customer and less on the implementation but it was an interesting talk and has highlighted two things to me:

  • Without input from the business on the content of the acceptance tests then they may not satisfy the customer requirements.
  • Domain driven design is very important for acceptance tests to be easily understood and implemented by developers as there is less translation required. If a feature is called ‘Updates basket’ on the UI and by the business then it should be called that in the code.

Question Time
During the mobile application development that I have done we hit a couple of testing challenges and I posed one of the bigger ones to Geert as a question to see what his advice would be to tackle it:

Question: Given the Xamarin Test Cloud can take a huge amount of time to run tests, how would you manage running  tests for an application with a large number of them.
Answer: He suggested the running of a few ‘core’ tests on the test cloud on a regular basis and running the full suite perhaps weekly. Also running them often locally. (This is how we managed it on our project which is good).