SPA2010   -   What's a wiki?   -   Recent changes   -   Search:
MattWynneNotes
My notes on [DanNorth](http://dannorth.net/) and [JoeWalnes](http://www.xpdeveloper.net/xpdwiki/Wiki.jsp?page=JoeWalnes)' session, in markdown syntax, do with them what you will.

Five artefacts: 1. Automation - the glue that binds the tests to the code 2. Vocabulary - the language that the tests are expressed in 3. Syntax - the technology that the tests are expressed in (C#, Java) 4. Intent - the actual scenario being tested 5. Harness - the thing that runs the tests and tells you if they passed

Four roles. People might fill more than one, or more than one person might be in a role: 1. Stakeholder 2. Analyst 3. Tester 4. Developer

Taking a requirement, the Stakeholder and the Analyst have a conversation.

	- what does that requirement *mean*?
	- how can we create a shared understanding?

Then the Analyst and the Tester have a conversation.
	- what is the scope of ('bigness') of this requirement?
	- how will we know when we're done?
	=> Scenarios (examples)

Tester then 'monkeyfies' the scenarios, using the following template:

**Given** ... - assumptions, context in which the scenario occurs.

**When** ... - user action, interaction with the system

**Then** ... - expected outcome

e.g. **Given** we have an account holder Joe and their current account contains $100 and the interest rate is 10% **When** Joe withdraws $120 **Then** Joe's balance should be $-22

The tester and the developer sit down and write an automated test to implement each scenario.

You might chain these up, but you can always categorise test code into these three partitions. This really helps how you look at test code.

#### Consistency Validation Between 'Units'

See the [Consumer Driven Contracts](http://martinfowler.com/articles/consumerDrivenContracts.html) paper on [Martin Fowler](http://martinfowler.com)'s website.

#### Tooling for Automation

Consider extending / creating the domain model to cover the application itself - the UI, the back end.

Loads of tools are availlable. Use whatever works and build on it.

#### Building a Vocabulary

Ubiquitous Language - Start with a shared language. It becomes ubiquitous when it appears *everywhere* - documents, code, databases, conversations.

You will use different vocabularies in different *bounded contexts*. A context might be your problem domain, testing domain, software domain, or the user interface domain.

Beware which roles understand you when you're talking in a particular domain. Often terms will span domains.

	e.g. NHibernateCustomerRepository
	  	 <--  1 --><-- 2--><-- 3  -->

1 = 3rd Party Provider Domain 2 = Problem Domain 3 - Software Domain

Make your tests tell a story - make it flow. Don't hide away things in Setup methods that will make the test hard to read. If that means a little bit of duplication, so be it. 'Damp not DRY'.

#### Syntax - Implementing Your Tests

		- keep it simple. don't fart around writing too fancy a DSL. you'll be surprised what testers / analysts / stakeholders will be prepared to read.
		- great way to learn
		- training wheels?
		- very nice.
		- create templates for each given / when / then which you can plug together with parameter values into scenarios
Basically what you need is a way to assemble different permutations and combinations of Given / When / Then with different parameters to make different scenarios.

#### Expressing Intent

Think in terms of narrative, flow. Think in terms of bounded contexts, and who the audience (role) is for that context. Who will understand that vocabulary?

Make sure the intent is clear - that's the main thing.

#### Harness

Do you want to hook into continuous integration build?

Which version of the code is it going to run against?

Keep the tests in two buckets:

Those which are in the 'done' bucket, **should always work**, those which are in progress are allowed to be failing, until you make them pass.

#### Getting Started

Things you can do today.

		* a bug is a scenario that you missed in the first place
#### Down The Line

What to aim for.

		* [helps with estimation](http://www.springerlink.com/content/vcq847l8ker3jc1d/)
		* just having thought about it helps - you may come back to automating it later.
		* helps build trust with stakeholders

#### Advice

		* doesn't mean you don't go test first
		* doesn't mean low quality code
		* does mean *how complete is the solution*? - how many scenarios / edge cases are you going to try and meet?

#### Summary

		* Automation, Vocabulary, Syntax, Intent, Harness

 
SPA2010   -   What's a wiki?   -   Recent changes   -   Search: