You can easily create automated OData integration tests with the help of the eCATT OData Assistant (transaction SECATT_ODATA).
SECATT_ODATA is available in software component SAP_BASIS release 7.40, 7.41 and 7.60.
It is recommended to use the highest possible support package, since the tool is in a process of continuous improvement and completion.
For information on the technical landsape of the automated OData Service testing, click here.
The eCATT OData Assistant leads you through three major steps:
The eCATT OData Assistant (transaction SECATT_ODATA) starts with following screen (click to enlarge the picture):
To load the service meta data, proceed as follows:
If you want to display the meta data, choose Display Service. The xml service meta data will be displayed.
Choose the Continue button or the Create Access Classes for Service step in the step path to proceed to the next step.
The screen of this step displays the name of the main class and the corresponding service entities (sub-classes) arranged in a tree structure.
For each entity set, you can see its properties and available CRUD-operations (create, retrieve, update, delete). For each property and its datatype in EDM model, the screen shows the associated ABAP data type.
On the level of entity container, you find functions and actions provided by the service.
To generate the desired access class(es), proceed as follows:
The log window in the lower part of the screen informs you about status and success of the generation process. It is a business application log, which is stored permanently in the system and can be accessed choosing Goto -> Application log -> Select and Display.
Each class name node in the tree provides a context menu option to navigate to the generated class in transaction SE80.
The class contains methods for calling CRUD operations on entities and class-based type definitions for EntityTypes, ComplexTypes and key structures.
These ABAP types allow access to the service data in ABAP variables, which are considered useful for building integration tests in ABAP coding or eCATT test scripts.
Choose the Continue button or the Create Tests step in the step path to proceed to the next step.
The Create Tests screen provides options to create test data containers and global ABAP classes containing ABAP unit test methods as test implementation.
Generated test classes will use the Service Access Classes to call the service.
You can choose names, package assignment and the transport request number. You may change test class names, test class description, test data container names (TDC) and TDC description by either clicking on it in the tree or choosing the correspondig option from context menu.
The use of test data in TDCs is optional. You can simply deselect TDCs if not required.
The creation of test classes is based on a template which includes test methods for:
The creation of test classes is flexible and creates only test methods for those CRUD operations, which have been selected during the creation of the service access class.
To enhance performance, you can also enter a value in the Entries field or via Test Scope -> Maximum Number of Data Sets. The value stands for the maximum number of data sets to be read. If you enter 0 or no value, all data is read.
Use Generate to create the test classes and TDCs. On the screen then displayed, again the application log is filled with the class generation status and related messages.
The generated unit tests can make use of the test data container. Test data will serve as reference data in retrieve scenarios and will be used as data templates for create scenarios.
The TDCs will contain a parameter for the assigned entity set. The parameter is typed to the ABAP structure which is related to the entity set. Remember that these ABAP structures are part of the generated Service Access Classes.
In the variants part of the TDC, all entities (records) of this entity set will be stored, which had been available in the service provider system at the time of generation.
In the generated classes screen, again the context menu of the class name node provides the option to navigate into the generated class in transaction SE80, where the test’s coding can be modified and the tests can be started.
The generated test classes should be considered as proposals for tests provided by the assistant. It is nearly impossible to provide templates for generated tests, which would fit to every test projects needs.
Responsible developers and testers are encouraged to further refine, extend and enrich these test methods and to add new tests to the test classes.
Be warned that repeated test class generation will overwrite classes and coding potentially modified by the test project.
In contrast to the service access classes, which may need re-generation once the service meta data changes, the test classes might be generated seldom or even never a second time.
The method SETUP is used to prepare each test run. Here, you can overwrite the settings for the HTTP connection adressing the service provider and the name of the TDC providing test data.
During class creation the connection data used in the assistant step 1 are written into Constructor parameters of the service access classes. Nevertheless, the test classes as callers of service access classes can overwrite and provide their connection options. Note that it is advisable to use HTTP destinations from transaction SM59 to store user credentials in a safe way and to profit from additional options and settings of these destination objects.
You can run the test via the ABAP Unit framework, transaction SUT, with the Integrated ABAP Unit runner with or without debug mode.
The scripting language of the test automation tool SAP eCATT (transaction SECATT) includes commands for calling ABAP methods.
Thus, it is easy to use the generated Service Access Classes also from eCATT Test Scripts. Such intergration options allow to combine the call of OData services with other test automation capabilities on SAP business systems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Subject | Kudos |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User | Count |
---|---|
20 | |
8 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |