Unit Test Presentation
-
Upload
sayedur-rahman -
Category
Documents
-
view
169 -
download
0
Transcript of Unit Test Presentation
![Page 1: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/1.jpg)
Bordas Shop
Unit Tests27th October 2013
![Page 2: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/2.jpg)
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](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/3.jpg)
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](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/4.jpg)
Change of plan
VisualStudioUnit
TestingFramework
NUnit
![Page 5: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/5.jpg)
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](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/6.jpg)
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](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/7.jpg)
A A AArrange, Act, Assert
![Page 8: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/8.jpg)
Sample test case 1Check by different combination
![Page 9: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/9.jpg)
Sample test case 2Don’t miss boundary values
![Page 10: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/10.jpg)
Sample test case 3Make sure exception is thrown where is should
![Page 11: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/11.jpg)
NUnit
![Page 12: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/12.jpg)
Jenkins
![Page 13: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/13.jpg)
Goals
Glitch free methods Tested methods Fully functional methods Tension free modificationA form of documentation. Confidence
![Page 14: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/14.jpg)
Demonstration
![Page 15: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/15.jpg)
Q & A
![Page 16: Unit Test Presentation](https://reader035.fdocuments.in/reader035/viewer/2022062901/58f150ff1a28abe4528b4625/html5/thumbnails/16.jpg)
Thank you