Breadcrumbs

Using Testable Classes



icon_download_example.png

<your example path>\Testing Concepts\uml\priceCalculation.xml



The priceCalculation example - an example performing a very simple calculation of price, quantity and exchange rate - contains a class CurrencyCalculator having one attribute (exchangeRate) and two class operations (calculatePrice and createCurrencyCalculator). By applying the stereotype <<E2ETestable>> to the class this class is marked as testable.

ClassWithStereotype.png

https://scheer-pas-doc.atlassian.net/wiki/plugins/servlet/confluence/placeholder/unknown-macro?name=version&locale=en_US&version=2

If the flag generateTestService on the service composite is set to true, the compiler will generate test SOAP services for all testable classes of the model.

component_diagram_with_testable_class.png

By the following tagged values you can configure the test settings:

Tagged Value

Description

Allowed Values

generateTestService

Enables or disables testing.

If true, a test SOAP service will be generated for all <<E2ETestable>> classes.

true

test service generated

false

no test service generated

testEncoding

Defines the encoding of the test SOAP operations. rpc/soap is recommended, because this matches well with the semantics of UML operations.

If this value is set and other services of the composite have different encodings, the tag wsdlPerService must be set to true.

rpc/soap

use rpc/soap encoding (default)

doc/literal

use doc/literal encoding

testPort

Defines the number of the test service port.

any number (default: 55555)

testServiceName

Defines the name of the generated test service.

any string (default: E2ETestService)

testProxyHost


Specifies the deployment host.


any string (default: localhost)

testProxyProtocol


Specifies the used protocol.


HTTP or HTTPS.

testProxyPath


Specifies the part of the overall URL that is mapped to the actual host name and port.

If this tagged value is used, the modeler must ensure, that this value is unique within the proxy.


any string (default: <proxy URL>/<service host>/<configuration name>)

testProxyPort


Specifies the proxy port the test service is listening to.


any number (defaults: 80 (HTTP) and 443 (HTTPS))

externalTestProxyHost


Specifies the host name as seen by the client. If a server certificate is used, it must be issued for this name.If this value is not set, the name of the node hosting the proxy is being used.


any string

We recommend creating a separate service for all testable classes (e.g. TestingService) and to set the tagged value wsdlPerService to true on the <<E2EComposite>>. By that means, a mix-up between main and testing service is avoided. The testing features get a separate WSDL and a separate service entry on the Bridge and can be started and stopped within the Bridge by the Activation checkbox as needed.

Please note that the compiler will not generate test SOAP services for testable classes from imported modules.
Modules must be tested separately. Add a component diagram to the module in this case and test the classes from a deployed module service.

console_with_test_service.png

For more information on the Bridge and service preferences refer to the Integration (Bridge) User's Guide .

Once the class is part of the SOAP interface, it is possible to test all class operations with the xUML SOAP Test Tool (or any other SOAP test tool) and with the Analyzer. The testable class may even be part of regression tests defined with the Analyzer.
Within each test case, attributes of the testable class are addressed via the self context, so that all information relevant for the execution of the test case can be provided.

testable_class_in_soap__test_tool.png