Package com.consol.citrus.report
Class MessageTracingTestListener
- java.lang.Object
-
- com.consol.citrus.report.AbstractTestListener
-
- com.consol.citrus.report.MessageTracingTestListener
-
- All Implemented Interfaces:
com.consol.citrus.report.MessageListener
,com.consol.citrus.report.TestListener
public class MessageTracingTestListener extends AbstractTestListener implements com.consol.citrus.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
- Author:
- Christoph Deppisch
-
-
Constructor Summary
Constructors Constructor Description MessageTracingTestListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected File
getTraceFile(String testName)
Returns the trace file for message tracing.void
onInboundMessage(com.consol.citrus.message.Message message, com.consol.citrus.context.TestContext context)
void
onOutboundMessage(com.consol.citrus.message.Message message, com.consol.citrus.context.TestContext context)
void
onTestFinish(com.consol.citrus.TestCase test)
void
onTestStart(com.consol.citrus.TestCase test)
void
setOutputDirectory(String outputDirectory)
Sets the outputDirectory.-
Methods inherited from class com.consol.citrus.report.AbstractTestListener
onTestFailure, onTestSkipped, onTestSuccess
-
-
-
-
Method Detail
-
onTestStart
public void onTestStart(com.consol.citrus.TestCase test)
- Specified by:
onTestStart
in interfacecom.consol.citrus.report.TestListener
- Overrides:
onTestStart
in classAbstractTestListener
-
onTestFinish
public void onTestFinish(com.consol.citrus.TestCase test)
- Specified by:
onTestFinish
in interfacecom.consol.citrus.report.TestListener
- Overrides:
onTestFinish
in classAbstractTestListener
-
onInboundMessage
public void onInboundMessage(com.consol.citrus.message.Message message, com.consol.citrus.context.TestContext context)
- Specified by:
onInboundMessage
in interfacecom.consol.citrus.report.MessageListener
-
onOutboundMessage
public void onOutboundMessage(com.consol.citrus.message.Message message, com.consol.citrus.context.TestContext context)
- Specified by:
onOutboundMessage
in interfacecom.consol.citrus.report.MessageListener
-
getTraceFile
protected File getTraceFile(String testName)
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
public void setOutputDirectory(String outputDirectory)
Sets the outputDirectory.- Parameters:
outputDirectory
- the outputDirectory to set
-
-