Testable Classes
The testing of discrete classes is one of the basic requirements of testing in general. As a principle, each class should be tested separately in a way that all tests are reproducible. This leads to the fact that as of changing the class only this class has to pass the previously defined tests. The rest of the service implementation is not affected as of changing the encapsulated implementation of a class.
Scheer PAS offers the necessary tools and concepts to fulfill these requirements:
The possibility to tag classes as to be testable.
The Scheer PAS Analyzer containing the Trace Analyzer and the Regression Test Tool.
Making a Class Testable
To make a class testable, apply stereotype Testable from the list of available stereotypes. You do not need to configure anything more.
This results in a test SOAP service being generated upon compilation and deployment. You can then use the Scheer PAS Analyzer to test the class operations (see Testing a Class below).
The test service has the following specifics:
Configuration Item | Description | Example |
---|---|---|
Service Name | Name of the class. | SupportCase |
Test SOAP Port | A fix value of 11000. | 11000 |
SOAP Encoding | doc/literal |
Docker Deployment
If you are not deploying your service as a Docker container, all necessary API Management configurations are generated for you. You can directly start writing tests.
Integration Deployment
If you are not deploying your service as a Docker container but to the Integration Platform, you need to setup some configurations manually in order to be able to access the testing service.
You probably need to change the generated fix port 11000, to avoid port conflicts.
In this case, adjust the port in the service settings to a port number that is available. For more information refer tohttps://doc.scheer-pas.com/bridge/?contextKey=xuml-service-settings&version=latest.
You need to manually create the API Management endpoints for the testing service. The endpoint location is
<bridge node name>:<test port>
, for example pas-acme-bridge:11000.
How to create an API in API Management is explained in detail on https://doc.scheer-pas.com/api-management/?contextKey=creating-an-api&version=latest.
Testing a Class
You can use the Analyzer to test the class operations of a testable class. To do that, you need to import the service description of the service containing the classes to the Analyzer as described on Importing the Service Description.
The testable classes are displayed in the Analyzer below a node TestingService:
Now you can start writing tests as explained on https://doc.scheer-pas.com/analyzer/?contextKey=using-the-xuml-trace-analyzer&version=latest.
The test data is to be provided in document encoding.
For non-static classes, you can find the self context in an XML element having the same name as the class.
In the example below, the self context of the SupportCase is provided via an XML element SupportCase
.
Fill in the necessary test data to the Request tab and run the test case. You can also include these test cases to regression tests as described on Performing Regression Tests.