Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. May require developing test driver modules or test harnesses.
to test including whole chain Business Module 1 Repository API Email client File API WS- Client Data source Provider Modules Web-service File system Email server Repository Database Business Module 2
File API WS- Client Data source Provider Modules(Classes) to be replaced as they are dependencies Modules to be used for Unit Testing Business Module 2
are external dependencies • No complex OOP encapsulations, as it is procedure language • Unit may change data storage physically • Test must be repeatable as anywhere else
datasets, you need to define: – The table, view or query that is changed by the program. – The table, view or query that is your expected result. • To emulate outcome: – Select <outcome..> from dual; – create table/view as Select <outcome...> from <table_under_SUT>
transaction • use the Setup procedure to insert our data, and the Teardown procedure to rollback the insert Example: PROCEDURE setup IS BEGIN INSERT INTO rooms VALUES (1, 'Dining Room'); INSERT INTO rooms VALUES (2, 'Living Room'); INSERT INTO rooms VALUES (3, 'Office'); END; PROCEDURE teardown IS BEGIN ROLLBACK; END; • Your program must not have ‘commit’ statement inside (System should not have presence of executed tests)
• pkg_sim_portal.change_services ➢ pmvnoref, varchar2, in /*Tenant name*/ ➢ pphoneno, varchar2, in /*Resource number*/ ➢ pservices, varchar2, in /*List of item names*/ ➢ perrmsg, varchar2, out /*Error text message*/ ➢ pimmediate, number, in, default – yes /*Flag, to do an order or not*/ • Define test cases in order to: 1) Test pre-requirements 2) Test post-requirements
to created tenant 3) Create Service Package, services (Service 1) 4) Instantiate Service Package as Entity Package on customer level 5) Create and assign MSISDN (493383390202) and other required resources to entity package
GTC GTC pPhoneNo 493383390202 <Fake number > or null 493383390202 493383390202 pServices Service A Service A null Service B Expected pErrmsg <Not empty> <Not empty> <Not empty> <Not empty> pImmediate null null null null ….and other fake/negative-values tests
via method replace • Refactoring of SUT and custom Mock object Result: • Several test cases just for single class • Two existing files(classes) were changed • Using of anti-pattern Public Morozov :-(
(reuse) 3) The Local hero (works here, doesn’t work there) 4) The Loudmouth (too much log messages) 5) The Enumerator (poor test method names) 6) The Slow Poke (too slow)