Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit Testing Tomas Žvirgžda IFM-9/2.

Similar presentations


Presentation on theme: "Unit Testing Tomas Žvirgžda IFM-9/2."— Presentation transcript:

1 Unit Testing Tomas Žvirgžda IFM-9/2

2 Agenda What is Unit Testing? Benefits? What should it cover?
Who should do it? Tomasa Žvirgžda

3 Agenda What are benefits of automated unit testing?
Test-driven development and Unit testing. Boundary between unit test and integration test. Containing boundary between unit and integration test. Tomasa Žvirgžda

4 What is Unit Testing? “The software literature (notably the military standards) define a unit along the lines of the smallest collection of code which can be [usefully] tested”. “Unit testing is a method by which individual units of source code are tested to determine if they are fit for use“. Tomasa Žvirgžda

5 Benefits? It's not good for time and resources consumption:
Maintenance (time and resources) Time spend to write test cases It's good for errors finding and QA: More errors are found at this stage then others Better QA Tomasa Žvirgžda

6 What should it cover? Test plan: Implementation Test process
Test strategy Responsibilities Standards, tools... Implementation Tomasa Žvirgžda

7 Who should do it? “Because unit testing is primarily focussed on the implementation, and requires an understanding of the design intent, it is much more efficiently done by the designers rather then by independent testers” Tomasa Žvirgžda

8 What are benefits of automated unit testing?
Saves time and resources: No need to write same test case again Faster testing process Easier maintenance Other benefits Tomasa Žvirgžda

9 Test-driven development and Unit testing.
When software is developed using a test-driven approach, the unit test may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior. Tomasa Žvirgžda

10 Boundary between unit test and integration test.
A unit test should usually not go outside of its own class boundary: No database activity No network activity No other activity Other vise, it's an integration test. Tomasa Žvirgžda

11 Containing boundary between unit and integration test.
You will not cross a boundary between unit and integration test if you use “fakes” and “mock” objects. “fakes” or “mock” objects mimics a state of the object which is accessing database, network and etc. You can prepare a substituting object with any state you want. Tomasa Žvirgžda

12 Summary Unit testing is a method by which individual units of source code are tested to determine if they are fit for use. Unit testing is much more efficiently done by the designers rather then by independent testers. Automated unit testing saves time and resources. Use “fakes” and “mock” objects to contain boundary between unit and integration testing. Tomasa Žvirgžda

13 Questions What is unit testing?
Can unit testing by applied to bottom-up testing approach? What are benefits of unit testing? What drawbacks you can see in unit testing? How can you save time and resources applying unit testing? Tomasa Žvirgžda


Download ppt "Unit Testing Tomas Žvirgžda IFM-9/2."

Similar presentations


Ads by Google