Performing Value Checks for Web Dynpro ABAP Applications
Use
In this step you can test the status of the application following a round trip, and check that the application produces the expected results.
Class CL_WD_WEB_DYNPRO_TESTER provides you with the following methods to perform these tests:
|
Method |
Description |
|---|---|
|
GET_CONTEXT_MENU |
Getter method for the displayed context menu (entries that were defined by the application) |
|
GET_CONTEXT_ROOT_NODE |
Getter method for the root element of the context |
|
GET_MESSAGES |
Getter method for Web Dynpro messages |
|
GET_UI_ELEMENT |
Getter method for Web Dynpro UI element (CL_WD_...) |
|
GET_UI_ELEMENT_PROPERTY |
Getter method for the values of UI element properties visibility, enabled, readOnly, and required. Also checks whether values have been changed with personalization. |
Example
You want to perform a unit test of Web Dynpro application CONFIGURE_COMPONENT (editor for Web Dynpro ABAP component configuration).
In the first step you already defined which steps are to be followed when the application is run in the background: The user starts the application, selects a Checkbox, enters an invalid value in an InputField, and then closes the application. For more information, see Running Web Dynpro ABAP Applications Without a Browser.
In the following procedure you can now check whether the individual software units produce the expected results:
-
After the user has selected the CheckBoxAdvanced Settings, the InputFieldConfiguration Type should appear.
To check this, you can use the following source code:
lo_uielement = tester->get_ui_element( component_path = 'SELECTION_SCREEN' view_id = 'ENTRY_MAIN' uielement_id = 'EXTENDED_CONF_TYPE_DD'). tester->get_ui_element_property( EXPORTING ui_element = lo_uielement IMPORTING visible = lv_vis ). cl_abap_unit_assert=>assert_equals( exp = cl_wd_uielement=>e_visible-visible act = lv_vis ). -
After the user has entered an invalid value in the Configuration VariantInputField, an error message should appear.
To check this, you can use the following source code:
lt_messages = tester->get_messages( ). cl_abap_unit_assert=>assert_equals( exp = '1' act = lines( lt_messages ) ).
More Information
You can find additional example source code in method implementation RUN_CONFIGURATOR2 in class CL_WD_WEB_DYNPRO_TESTER.