Package org.citrusframework.report
Class MessageTracingTestListener
java.lang.Object
org.citrusframework.report.AbstractTestListener
org.citrusframework.report.MessageTracingTestListener
- All Implemented Interfaces:
org.citrusframework.report.MessageListener,org.citrusframework.report.TestListener
public class MessageTracingTestListener
extends AbstractTestListener
implements org.citrusframework.report.MessageListener
Test listener collects all messages sent and received by Citrus during test execution. Listener
writes a trace file with all message content per test case to a output directory.
Note: This class is not thread safe! Parallel test execution leads to behaviour that messages get mixed. Proper correlation to test case is not possible here.
- Since:
- 1.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FilegetTraceFile(String testName) Returns the trace file for message tracing.voidonInboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context) voidonOutboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context) voidonTestExecutionEnd(org.citrusframework.TestCase test) voidonTestStart(org.citrusframework.TestCase test) voidsetOutputDirectory(String outputDirectory) Sets the outputDirectory.Methods inherited from class org.citrusframework.report.AbstractTestListener
onTestFailure, onTestSkipped, onTestSuccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.citrusframework.report.TestListener
onAfterTestEnd, onAfterTestStart, onBeforeTestEnd, onBeforeTestStart, onFinalActionsEnd, onFinalActionsStart, onTestEnd, onTestExecutionStart, onTestFinish
-
Constructor Details
-
MessageTracingTestListener
public MessageTracingTestListener()
-
-
Method Details
-
onTestStart
public void onTestStart(org.citrusframework.TestCase test) - Specified by:
onTestStartin interfaceorg.citrusframework.report.TestListener- Overrides:
onTestStartin classAbstractTestListener
-
onTestExecutionEnd
public void onTestExecutionEnd(org.citrusframework.TestCase test) - Specified by:
onTestExecutionEndin interfaceorg.citrusframework.report.TestListener- Overrides:
onTestExecutionEndin classAbstractTestListener
-
onInboundMessage
public void onInboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context) - Specified by:
onInboundMessagein interfaceorg.citrusframework.report.MessageListener
-
onOutboundMessage
public void onOutboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context) - Specified by:
onOutboundMessagein interfaceorg.citrusframework.report.MessageListener
-
getTraceFile
Returns the trace file for message tracing. The file name should be unique per test execution run; the test name and a execution id (the test execution start time) is embedded within the filename. Normally this should suffice to ensure that the trace filename is unique per test/test-execution.- Parameters:
testName- the name of the test to create the trace file for- Returns:
- the trace file to use for message tracing
-
setOutputDirectory
Sets the outputDirectory.- Parameters:
outputDirectory- the outputDirectory to set
-