Top Banner
Bordas Shop Unit Tests 27th October 2013
16

Unit Test Presentation

Apr 15, 2017

Download

Documents

Sayedur Rahman
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Unit Test Presentation

Bordas Shop

Unit Tests27th October 2013

Page 2: Unit Test Presentation

Objective

Automated testTest for core methods onlyIntegrated with Jenkins

Build success only if all test success

Total 496 test cases for 6 core methods

Page 3: Unit Test Presentation

Testing Framework – NUnit

Version 2.6Written entirely in C#Many advantages of .NET.

E.g. custom attributes and reflection.

Jenkins NUnit Plugin for build automationNUnit = xUnit of .NET languagesFree

Page 4: Unit Test Presentation

Change of plan

VisualStudioUnit

TestingFramework

NUnit

Page 5: Unit Test Presentation

Naming

Roy osherovAuthor of “Art of unit testing”blog “Naming standards for unit tests”

[UnitOfWork_StateUnderTest_ExpectedBehavior]GetProducts_Availability_NotNullExpected

GetProducts_CheckPriceLessThanOrEqualZero_CountZeroExpected

GetStreet_CheckDuplicateId_InputPostCode1113_CountZeroExpected

Page 6: Unit Test Presentation

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.

Page 7: Unit Test Presentation

A A AArrange, Act, Assert

Page 8: Unit Test Presentation

Sample test case 1Check by different combination

Page 9: Unit Test Presentation

Sample test case 2Don’t miss boundary values

Page 10: Unit Test Presentation

Sample test case 3Make sure exception is thrown where is should

Page 11: Unit Test Presentation

NUnit

Page 12: Unit Test Presentation

Jenkins

Page 13: Unit Test Presentation

Goals

Glitch free methods Tested methods Fully functional methods Tension free modificationA form of documentation. Confidence

Page 14: Unit Test Presentation

Demonstration

Page 15: Unit Test Presentation

Q & A

Page 16: Unit Test Presentation

Thank you