Bordas Shop
Unit Tests
27th October 2013
Objective
Automated test
Test for core methods only
Integrated with Jenkins
Build success only if all test success
Total 496 test cases for 6 core methods
Testing Framework – NUnit
Version 2.6
Written entirely in C#
Many advantages of .NET.
E.g. custom attributes and reflection.
Jenkins NUnit Plugin for build automation
NUnit = xUnit of .NET languages
Free
Change of plan
Visual
Studio
Unit
Testing
Framework
NUnit
Naming
Roy osherov
Author of “Art of unit testing”
blog “Naming standards for unit tests”
[UnitOfWork_StateUnderTest_ExpectedBehavior]
GetProducts_Availability_NotNullExpected
GetProducts_CheckPriceLessThanOrEqualZero_CountZeroExp
ected
GetStreet_CheckDuplicateId_InputPostCode1113_CountZeroEx
pected
A A A
Arrange: setup everything needed.
Act: Invoke the code under test.
Assert: Specify the pass criteria for the
test, which fails it if not met.
In 2003 William C. Wake blogged about
using Arrange Act Assert pattern in unit
tests.
A A A
Arrange, Act, Assert
Sample test case 1
Check by different combination
Sample test case 2
Don’t miss boundary values
Sample test case 3
Make sure exception is thrown where is should
NUnit
Jenkins
Goals
Glitch free methods
Tested methods
Fully functional methods
Tension free modification
A form of documentation.
Confidence
Demonstration
Q & A
Thank you

Unit Test Presentation