150 likes | 365 Views
CUnit & Coverage. Larry Shi. Agenda. Aim CUnit Screenshots(Automated) Demo TO-DO list. Aim. Unit test Test C code automatically Find bugs in tim e to i mprove quality Coverage How often each line of code executes What lines of code are actually executed Suggestion
E N D
CUnit & Coverage Larry Shi
Agenda • Aim • CUnit • Screenshots(Automated) • Demo • TO-DO list
Aim • Unit test • Test C code automatically • Find bugs in time to improve quality • Coverage • How often each line of code executes • What lines of code are actually executed • Suggestion • CUnit for unit test • GCOV, LCOV for coverage
CUnit • CUnit is a lightweight system for writing, administering, and running unit tests in C. • Several different interfaces are provided for running tests and reporting results
Demo ※ Please see it in the test machine • Several stepsbelow: • Write test cases • Compile with -ftest-coverage -fprofile-arcs • Run • Generated files: xx.gcda, xx.gcno for coverage • LCOV • Generated files: covinfo for coverage • genhtml (generate html format coverage report) • Confirm test report(xx.xml) • Confirm coverage report (./result)
TO-DO list • Team discuss if CUnit & LCOVcan satisfy our requirement for C code quality • Framework design • Unit test framework via CUnit • One example about framework proposal • Support for automated test • Support for modular test • Integrate the framework with existed source code • Integrate the framework with other test frameworks • Test cases Suggest that developers handle it