Advertisement
isavchenko

Untitled

Dec 17th, 2018
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.70 KB | None | 0 0
  1. class bigapp_app_unit_test definition for testing.
  2.   private section.
  3.     class-data:
  4.       mif_app type ref to zbigapp_if_cntrl.
  5.     classmethods:
  6.       class_setup.
  7.     methods:
  8.       test_printing for testing.
  9. endclass.
  10. class bigapp_app_unit_test implementation.
  11.   method class_setup.
  12.  
  13.     data:
  14.       lif_mod type ref to zbigapp_if_model.
  15.  
  16.  
  17. * safe in the knowledge that the app will use the test configuration
  18. * and any other test injectables we have, such as database persistence
  19. * overriding classes or a dummy user interface implementation.
  20.     test_mode.
  21.  
  22. * instantiate the application model. The injection is performed
  23.  
  24. * inside of this call.
  25.  
  26.     lif_mod = zbigapp_cl_model_fact=>load(
  27.       exporting
  28.         i_key = ‘0042/DMO/000/00’ ).
  29.  
  30. * instantiate the application controller.
  31.     mif_app = zbigapp_cl_cntrl_fact=>create(
  32.       exporting
  33.         i_model = lif_mod ).
  34.  
  35.   endmethod.
  36.  
  37.   method test_printing.
  38.  
  39. * make sure the test device is configured for the app.
  40. * the real IMG configuration may have an alternative value
  41. * for the current user, but the test configuration class
  42. * overrides this so weuse a specific device during testing.
  43.  
  44.  
  45.     cl_aunit_assert=>assert_equals(
  46.       act = mif_app->m_device
  47.       exp = ‘TEST_DEVICE’
  48.       msg = ‘Test device was not configured for application’).
  49.  
  50.  
  51. * tell the application to print some data.
  52.     mif_app->action( zbigapp_if_cntrl=>mcc_print ).
  53.  
  54.  
  55. * check our test device to see whether the data was ok.
  56.     cl_aunit_assert=>assert_equals(
  57.       act = zbigapp_test_device=>m_printdata_ok( )
  58.       exp = ‘X’
  59.       msg = ‘Test device reports print data was not ok’).
  60.   endmethod.    
  61. endclass.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement