11. Types of tests
• Unit
• Functional
• Load
• Soak
25/10/12 www.agiletour.com
12. Unit tests
• They test units of code in isolation
• Interaction between components
• Describe the behaviour
• Drive the design
• Fast execution
25/10/12 www.agiletour.com
13. Be careful
• Test just public interfaces
• Do not abuse of mocking
25/10/12 www.agiletour.com
14. Adding a new class is not the trigger for a new test.
The trigger is the implementation of a new requirement.
25/10/12 www.agiletour.com
15. Functional tests
• They test the interaction with components
outside the context of our application
• They assure integration
• They might be slow
25/10/12 www.agiletour.com
16. public class When_getting_an_object_from_the_db
{
static int _objectId;
static DbWrapper _sut;
static object _object;
Establish that_there_is_an_object = ()=>
{
_objectId = 100;
ManuallyAddAnObjectInTheDb(_objectId);
}
Because we_get_the_object = ()=> _object = _sut.Get(_objectId);
It should_get_the_object = ()=> _object.ShouldNotBeNull();
}
25/10/12 www.agiletour.com
17. public class When_storing_an_object_in_the_db
{
static int _objectId;
static DbWrapper _sut;
static object _object;
Establish we_have_an_object_to_save = ()=>
{
_objectId = 100;
}
Because we_save_the_object = ()=> _object = _sut.Save(_objectId);
It should_store_the_object = ()=> _sut.Get(_objectId).ShouldNotBeNull();
}
25/10/12 www.agiletour.com
18. Be careful
• Do not mix tests
• Use context builders for data fixture
25/10/12 www.agiletour.com
19. Load tests
• Feedback on performance
• Feedback on volume limit
• Complicated to write
• Slow execution
25/10/12 www.agiletour.com
22. Types of tests
• End to end
• Integration
• Exploratory
25/10/12 www.agiletour.com
23. End to end tests
• They test the whole scope of a feature
• They are acceptance tests
• Understandable from non-techincal persons
• Slow execution
25/10/12 www.agiletour.com
24. They are not (only) interface tests.
25/10/12 www.agiletour.com
25. Integration tests
when the end to end aren't brave enough
• They test pieces of the application
• They test the integration
• Slow execution
25/10/12 www.agiletour.com