Awat Z. Hamad Unit Testing and Mocking
Awat Z. Hamad Unit Testing and Mocking
Awat Z. Hamad Unit Testing and Mocking
Prepared by
Awat Z. Hamad
Emerging Technologies
Under Supervision
Assistant Prof. Dr. Rebwar M. Nabi
Aims
To introduce Unit test and mocking in software development
Presentation Objectives
Input
Testing: Running the program on carefully selected inputs
and checking the results.
Process
Output
Mocking is a process used in unit testing when the unit being tested has external dependencies.
Mocking
Developer 1 Developer 2
Function Add
Unit Testing Advantage & Disadvantages
Advantage
Disadvantages
• Follow clear and consistent naming conventions for your unit tests
• Bugs identified during unit testing must be fixed before proceeding to the next phase in SDLC
NUnit https://nunit.org/
JUnit https://junit.org/junit5/
MSTest
https://docs.microsoft.com/en-us/visualstudio/test
xUnit
UnitTest
PHPUnit https://phpunit.de/
Summary
• Unit Test a type of software testing where individual units or components of a software are tested
• Unit testing is very important to learn if you want to develop complex software products
• Mocking is very useful concept when the project is distributed among many team members
Any questions about our subject?