See: Description
Interface | Description |
---|---|
IActionRequestCycle |
Interface for action request cycle.
|
IMockServiceInterfaceActionRequest |
Interface for a
IServiceInterfaceActionRequest mock object. |
IMockServiceInterfaceActionResponse |
Interface for a
IServiceInterfaceActionResponse mock object. |
IMockServiceInterfaceRenderRequest |
Interface for a
IServiceInterfaceRenderRequest mock object. |
IMockServiceInterfaceRenderResponse |
Interface for a
IServiceInterfaceRenderResponse mock object. |
IMockServiceInterfaceRequest |
Interface for a
IServiceInterfaceRequest mock object. |
IMockServiceInterfaceResponse |
Interface for a
IServiceInterfaceResponse mock object. |
IRenderRequestCycle |
Interface for the render request cycle.
|
IRequestCycle |
A request cycle represents the processing of a request during which the
response may have some data set.
|
Class | Description |
---|---|
ActionRequestCycle |
Represents the action request cycle - containing mocks for request and
response and process actions.
|
MockServiceInterfaceActionRequest |
Implementation for IMockServiceInterfaceActionRequest interface.
|
MockServiceInterfaceActionResponse |
Implementation for IMockServiceInterfaceActionResponse interface.
|
MockServiceInterfaceRenderRequest |
Implementation for IMockServiceInterfaceRenderRequest interface.
|
MockServiceInterfaceRenderResponse |
Implementation for IMockServiceInterfaceRenderResponse interface.
|
RenderRequestCycle |
Represents the render request cycle - containing mocks for request and
response and performing render operations.
|
RequestCycle |
Represents the request cycle.
|
RequestCycleFactory |
Creates and initializes RequestCycle instances.
|
ServiceInterfaceTestCase |
Generic test case for Service Interfaces.
|
Exception | Description |
---|---|
ServiceInterfaceTestException |
Base exception for LPTF service interface package.
|
The client system has two options to use LumisXP Test Framework in order to perform Service Interface tests:
ServiceInterfaceTestCase
StructureHelper
(to create the
necessary portal structure, and in it the service interface instance to be called) and
RequestCycleFactory
(to instantiate
the needed RequestCycle implementation, used for calling the interface's render,
processAction methods; or for providing request and response objects)ServiceInterfaceTestCase
In the first case, the client must have a subclass of
ServiceInterfaceTestCase
and implement
the methods getServiceId
and getServiceInterfaceId
in order to provide the identifiers for the service and the service interface
respectively.
In the test methods, the test class will have access to IRenderRequestCycle and IActionRequestCycle. Using these objects, it can get the mocks for request and response. IRequestCycle specific classes also provide the common actions needed to perform service interface tests like render and processAction methods.
ServiceInterfaceTestCase
starts a
transaction and a session in setUp
method. Also, it disposes
the transaction and ends the session in tearDown
.
During the execution of the test methods the subclass must handle the other
operations needed. It is common, for example, that before calling render or
processAction methods in order to test them, it will be needed to commit the
current transaction and starts another. The transaction instance is
available to the subclass in order to allow these operations.
The tearDown
method also calls the cleanup
method
from the StructureHelper instance. So, all the structure created for the
tests (like channels, pages and service interface instances) will be
discarded.
Example:
public class TestMyInterface extends ServiceInterfaceTestCase
{
public String getServiceId()
{
// return the service id
}
public String getServiceInterfaceId()
{
// return the service interface id
}
public void testRender() throws Exception
{
// performs specific actions for this test
// like creating data used by the interface implementation
...
// commit the current transaction if it was used above
this.transaction.commit();
this.transaction.close();
// calls the render method:
this.renderRequestCycle.render();
// if necessary for the assertions, the transaction could also be re-created as example below:
this.transaction = PortalTransactionFactory.createTransaction();
this.transaction.begin();
// asserts the response using
// this.renderRequestCycle.getResponse() object
}
}
StructureHelper
and RequestCycleFactory
In the second solution, the client may use
StructureHelper
in create an
instance of the needed service interface.
It also may use
RequestCycleFactory
to create the IRenderRequestCycle
or IActionRequestCycle
objects
(and then use them, or get the request and response objects from them).
As in the first option, the test classes must handle the session and
transaction instances. The
StructureHelper
uses the current session
and current transaction for almost all its methods but cleanup
that uses its own transaction and session.
The common implementation for these test cases, will instantiate a helper
in the setUp
and call the cleanup
in
tearDown
.
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.