Unit Testing: Difference between revisions

Jump to navigation Jump to search
no edit summary
[unchecked revision][unchecked revision]
No edit summary
 
No edit summary
Line 1:
{{Convert}}
 
"'''Unit testing"''' means that, in addition to the implementation code, you also write a "test driver" that puts the implementation code through a set of trials, checking the returns for correctness. Note that this is done during development / testing - the "test driver" is not shipped with the released code.
 
!! The idea is that...
 
!!== The idea is that... ==
* if you later change things in the implementation code, the test driver tells you if the results remain the same (regression test);
* if you receive a bug report, you not only fix the implementation code, but also the test driver so that this bug could never be reintroduced again.
Line 10 ⟶ 9:
Unit testing is a great way to improve the reliability and correctness of your code. However, it requires that the code to-be-tested actually ''can'' be run under control of the test driver. It should be easy to see where this becomes tricky. While it ''should'' be possible to test most kernel functions in a "testbed" test driver, the really "juicy" stuff like interrupt handling, process dispatching or memory management are probably not unit-testable.
 
!!== Alternative / Additional Option: Run-Time Self-Tests ==
 
* before activating a memory provider, ask it for memory, record the address, free the memory and ask for memory again. Most allocators are expected to return the very same address in this case.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu