Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class bigapp_app_unit_test definition for testing.
- private section.
- class-data:
- mif_app type ref to zbigapp_if_cntrl.
- class–methods:
- class_setup.
- methods:
- test_printing for testing.
- endclass.
- class bigapp_app_unit_test implementation.
- method class_setup.
- data:
- lif_mod type ref to zbigapp_if_model.
- * safe in the knowledge that the app will use the test configuration
- * and any other test injectables we have, such as database persistence
- * overriding classes or a dummy user interface implementation.
- test_mode.
- * instantiate the application model. The injection is performed
- * inside of this call.
- lif_mod = zbigapp_cl_model_fact=>load(
- exporting
- i_key = ‘0042/DMO/000/00’ ).
- * instantiate the application controller.
- mif_app = zbigapp_cl_cntrl_fact=>create(
- exporting
- i_model = lif_mod ).
- endmethod.
- method test_printing.
- * make sure the test device is configured for the app.
- * the real IMG configuration may have an alternative value
- * for the current user, but the test configuration class
- * overrides this so weuse a specific device during testing.
- cl_aunit_assert=>assert_equals(
- act = mif_app->m_device
- exp = ‘TEST_DEVICE’
- msg = ‘Test device was not configured for application’).
- * tell the application to print some data.
- mif_app->action( zbigapp_if_cntrl=>mcc_print ).
- * check our test device to see whether the data was ok.
- cl_aunit_assert=>assert_equals(
- act = zbigapp_test_device=>m_printdata_ok( )
- exp = ‘X’
- msg = ‘Test device reports print data was not ok’).
- endmethod.
- endclass.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement