Package com.epam.reportportal.cucumber
Class AbstractReporter
- java.lang.Object
-
- com.epam.reportportal.cucumber.AbstractReporter
-
- All Implemented Interfaces:
io.cucumber.plugin.ConcurrentEventListener,io.cucumber.plugin.Plugin
- Direct Known Subclasses:
ScenarioReporter,StepReporter
public abstract class AbstractReporter extends java.lang.Object implements io.cucumber.plugin.ConcurrentEventListenerAbstract Cucumber 5.x formatter for Report Portal
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBACKGROUND_PREFIXprotected static java.lang.StringDOCSTRING_DECORATORprotected static java.lang.StringHOOK_protected static java.lang.StringMETHOD_OPENING_BRACKETprotected static java.net.URIWORKING_DIRECTORY
-
Constructor Summary
Constructors Constructor Description AbstractReporter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidafterHooks(io.cucumber.plugin.event.TestCase testCase, io.cucumber.plugin.event.HookTestStep step, io.cucumber.plugin.event.Result result)Called when before/after-hooks are finishedprotected voidafterLaunch()Finish RP launchprotected voidafterScenario(io.cucumber.plugin.event.TestCaseFinished event)Finish Cucumber scenario Put scenario end time in a map to check last scenario end time per featureprotected voidafterStep(io.cucumber.plugin.event.TestCase testCase, io.cucumber.plugin.event.TestStep testStep, io.cucumber.plugin.event.Result result)Finish Cucumber stepprotected voidbeforeHooks(io.cucumber.plugin.event.TestCase testCase, io.cucumber.plugin.event.HookTestStep testStep)Called when before/after-hooks are startedprotected voidbeforeLaunch()Manipulations before the launch startsprotected voidbeforeScenario(io.cucumber.core.gherkin.Feature feature, io.cucumber.plugin.event.TestCase scenario)Start Cucumber scenarioprotected voidbeforeStep(io.cucumber.plugin.event.TestCase testCase, io.cucumber.plugin.event.TestStep testStep)Start Cucumber stepprotected com.epam.ta.reportportal.ws.model.FinishTestItemRQbuildFinishTestItemRequest(io.reactivex.Maybe<java.lang.String> itemId, java.util.Date finishTime, com.epam.reportportal.listeners.ItemStatus status)Build finish test item request objectprotected java.lang.StringbuildMultilineArgument(io.cucumber.plugin.event.TestStep step)Generate multiline argument (DataTable or DocString) representationprotected com.epam.reportportal.service.ReportPortalbuildReportPortal()Extension point to customize ReportPortal instanceprotected com.epam.ta.reportportal.ws.model.StartTestItemRQbuildStartFeatureRequest(io.cucumber.core.gherkin.Feature feature, java.net.URI uri)Extension point to customize feature creation event/requestprotected com.epam.ta.reportportal.ws.model.StartTestItemRQbuildStartHookRequest(io.cucumber.plugin.event.TestCase testCase, io.cucumber.plugin.event.HookTestStep testStep)Extension point to customize test creation event/requestprotected com.epam.ta.reportportal.ws.model.launch.StartLaunchRQbuildStartLaunchRq(java.util.Date startTime, com.epam.reportportal.listeners.ListenerParameters parameters)A method for creation a Start Launch request which will be sent to Report Portal.protected com.epam.ta.reportportal.ws.model.StartTestItemRQbuildStartRuleRequest(io.cucumber.plugin.event.Node.Rule rule, java.lang.String codeRef)Extension point to customize scenario creation event/requestprotected com.epam.ta.reportportal.ws.model.StartTestItemRQbuildStartScenarioRequest(io.cucumber.plugin.event.TestCase testCase, java.lang.String name, java.net.URI uri, int line)Extension point to customize scenario creation event/requestprotected com.epam.ta.reportportal.ws.model.StartTestItemRQbuildStartStepRequest(io.cucumber.plugin.event.TestStep testStep, java.lang.String stepPrefix, java.lang.String keyword)Extension point to customize test creation event/requestprotected voidembedding(java.lang.String name, java.lang.String mimeType, byte[] data)Send a log with data attached.protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ>extractAttributes(java.util.Collection<?> tags)Transform tags from Cucumber to RP formatprotected voidfinishTestItem(io.reactivex.Maybe<java.lang.String> itemId)Finish a test item with no specific statusprotected java.util.DatefinishTestItem(io.reactivex.Maybe<java.lang.String> itemId, com.epam.reportportal.listeners.ItemStatus status)Finish a test item with specified statusprotected java.util.DatefinishTestItem(io.reactivex.Maybe<java.lang.String> itemId, com.epam.reportportal.listeners.ItemStatus status, java.util.Date dateTime)Finish a test item with specified statusprotected java.lang.StringformatDataTable(java.util.List<java.util.List<java.lang.String>> table)Converts a table represented as List of Lists to a formatted table stringprotected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ>getAttributes(java.lang.String codeRef)Returns static attributes defined byAttributesannotation in code.protected java.lang.StringgetCodeRef(io.cucumber.plugin.event.TestStep testStep)Returns code reference for mapped codeprotected java.lang.StringgetCodeRef(java.net.URI uri, int line)Returns code reference for feature files by URI and text line numberstatic AbstractReportergetCurrent()Returns a reporter instance for the current thread.protected java.lang.StringgetDescription(io.cucumber.core.gherkin.Feature feature, java.net.URI uri)Build an item description for a featureprotected java.lang.StringgetDescription(io.cucumber.plugin.event.TestCase testCase, java.net.URI uri)Build an item description for a scenarioprotected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.EmbedEvent>getEmbedEventHandler()protected abstract java.lang.StringgetFeatureTestItemType()Return RP launch test item name mapped to Cucumber featureprotected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String>getHookTypeAndName(io.cucumber.plugin.event.HookType hookType)Returns hook type and name as aPaircom.epam.reportportal.service.tree.TestItemTreegetItemTree()com.epam.reportportal.service.LaunchgetLaunch()protected java.util.List<com.epam.ta.reportportal.ws.model.ParameterResource>getParameters(java.lang.String codeRef, io.cucumber.plugin.event.TestStep testStep)Returns a list of parameters for a stepcom.epam.reportportal.service.ReportPortalgetReportPortal()protected abstract java.util.Optional<io.reactivex.Maybe<java.lang.String>>getRootItemId()protected abstract java.lang.StringgetScenarioTestItemType()Return RP launch test item name mapped to Cucumber scenarioprotected java.lang.StringgetStepName(io.cucumber.plugin.event.TestStep testStep)Generate a step name based on its type (Before Hook / Regular / etc.)protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestCaseFinished>getTestCaseFinishedHandler()protected com.epam.reportportal.service.item.TestCaseIdEntrygetTestCaseId(io.cucumber.plugin.event.TestStep testStep, java.lang.String codeRef)Return a Test Case ID for mapped codeprotected com.epam.reportportal.service.item.TestCaseIdEntrygetTestCaseId(java.lang.String codeRef, java.util.List<io.cucumber.plugin.event.Argument> arguments)Return a Test Case ID for a feature fileprotected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestCaseStarted>getTestCaseStartedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestRunFinished>getTestRunFinishedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestRunStarted>getTestRunStartedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestSourceParsed>getTestSourceParsedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestStepFinished>getTestStepFinishedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestStepStarted>getTestStepStartedHandler()protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.WriteEvent>getWriteEventHandler()protected voidhandleEndOfFeature()protected voidhandleSourceEvents(io.cucumber.plugin.event.TestSourceParsed parseEvent)protected voidhandleStartOfTestCase(io.cucumber.plugin.event.TestCaseStarted event)Starts a Cucumber Test Case start, also starts corresponding Feature if is not started already.protected voidhandleTestStepFinished(io.cucumber.plugin.event.TestStepFinished event)protected voidhandleTestStepStarted(io.cucumber.plugin.event.TestStepStarted event)protected com.epam.reportportal.listeners.ItemStatusmapItemStatus(io.cucumber.plugin.event.Status status)Map Cucumber statuses to RP item statusesprotected java.lang.StringmapLevel(io.cucumber.plugin.event.Status cukesStatus)Map Cucumber statuses to RP log levelsprotected voidreportResult(io.cucumber.plugin.event.Result result, java.lang.String message)Report test item result and error (if present)protected voidsendLog(java.lang.String message)Send a text log entry to Report Portal with 'INFO' level, using current datetime as timestampprotected voidsendLog(java.lang.String message, java.lang.String level)Send a text log entry to Report Portal using current datetime as timestampvoidsetEventPublisher(io.cucumber.plugin.event.EventPublisher publisher)Registers an event handler for a specific event.protected io.reactivex.Maybe<java.lang.String>startFeature(com.epam.ta.reportportal.ws.model.StartTestItemRQ startFeatureRq)Start Cucumber Featureprotected io.reactivex.Maybe<java.lang.String>startHook(io.reactivex.Maybe<java.lang.String> parentId, com.epam.ta.reportportal.ws.model.StartTestItemRQ rq)Start before/after-hook item on Report Portalprotected io.reactivex.Maybe<java.lang.String>startRule(io.reactivex.Maybe<java.lang.String> featureId, com.epam.ta.reportportal.ws.model.StartTestItemRQ ruleRq)Start Rule item on Report Portalprotected io.reactivex.Maybe<java.lang.String>startScenario(io.reactivex.Maybe<java.lang.String> featureId, com.epam.ta.reportportal.ws.model.StartTestItemRQ startScenarioRq)Start Cucumber Scenarioprotected io.reactivex.Maybe<java.lang.String>startStep(io.reactivex.Maybe<java.lang.String> scenarioId, com.epam.ta.reportportal.ws.model.StartTestItemRQ startStepRq)Start Step item on Report Portal
-
-
-
Field Detail
-
BACKGROUND_PREFIX
public static final java.lang.String BACKGROUND_PREFIX
- See Also:
- Constant Field Values
-
WORKING_DIRECTORY
protected static final java.net.URI WORKING_DIRECTORY
-
METHOD_OPENING_BRACKET
protected static final java.lang.String METHOD_OPENING_BRACKET
- See Also:
- Constant Field Values
-
HOOK_
protected static final java.lang.String HOOK_
- See Also:
- Constant Field Values
-
DOCSTRING_DECORATOR
protected static final java.lang.String DOCSTRING_DECORATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildStartLaunchRq
protected com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ buildStartLaunchRq(java.util.Date startTime, com.epam.reportportal.listeners.ListenerParameters parameters)A method for creation a Start Launch request which will be sent to Report Portal. You can customize it by overriding the method.- Parameters:
startTime- launch start time, which will be set into the result requestparameters- Report Portal client parameters- Returns:
- a Start Launch request instance
-
getItemTree
@Nonnull public com.epam.reportportal.service.tree.TestItemTree getItemTree()
- Returns:
- a full Test Item Tree with attributes
-
getCurrent
@Nonnull public static AbstractReporter getCurrent()
Returns a reporter instance for the current thread.- Returns:
- reporter instance for the current thread
-
getReportPortal
@Nonnull public com.epam.reportportal.service.ReportPortal getReportPortal()
- Returns:
- a
ReportPortalclass instance which is used to communicate with the portal
-
getLaunch
@Nonnull public com.epam.reportportal.service.Launch getLaunch()
- Returns:
- a Report Portal
Launchclass instance which is used in test item reporting
-
beforeLaunch
protected void beforeLaunch()
Manipulations before the launch starts
-
buildReportPortal
protected com.epam.reportportal.service.ReportPortal buildReportPortal()
Extension point to customize ReportPortal instance- Returns:
- ReportPortal
-
afterLaunch
protected void afterLaunch()
Finish RP launch
-
extractAttributes
@Nonnull protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> extractAttributes(@Nonnull java.util.Collection<?> tags)Transform tags from Cucumber to RP format- Parameters:
tags- - Cucumber tags- Returns:
- set of tags
-
getTestCaseId
@Nullable protected com.epam.reportportal.service.item.TestCaseIdEntry getTestCaseId(@Nullable java.lang.String codeRef, @Nullable java.util.List<io.cucumber.plugin.event.Argument> arguments)Return a Test Case ID for a feature file- Parameters:
codeRef- a code referencearguments- a scenario arguments- Returns:
- Test Case ID entity or null if it's not possible to calculate
-
buildStartScenarioRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartScenarioRequest(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull java.lang.String name, @Nonnull java.net.URI uri, int line)Extension point to customize scenario creation event/request- Parameters:
testCase- Cucumber's TestCase objectname- the scenario nameuri- the scenario feature file relative pathline- the scenario text line number- Returns:
- start test item request ready to send on RP
-
startScenario
@Nonnull protected io.reactivex.Maybe<java.lang.String> startScenario(@Nonnull io.reactivex.Maybe<java.lang.String> featureId, @Nonnull com.epam.ta.reportportal.ws.model.StartTestItemRQ startScenarioRq)Start Cucumber Scenario- Parameters:
featureId- parent feature item idstartScenarioRq- scenario start request- Returns:
- scenario item id
-
afterScenario
protected void afterScenario(io.cucumber.plugin.event.TestCaseFinished event)
Finish Cucumber scenario Put scenario end time in a map to check last scenario end time per feature- Parameters:
event- Cucumber's TestCaseFinished object
-
getStepName
@Nullable protected java.lang.String getStepName(@Nonnull io.cucumber.plugin.event.TestStep testStep)Generate a step name based on its type (Before Hook / Regular / etc.)- Parameters:
testStep- Cucumber's TestStep object- Returns:
- a step name
-
getTestCaseId
@Nullable protected com.epam.reportportal.service.item.TestCaseIdEntry getTestCaseId(@Nonnull io.cucumber.plugin.event.TestStep testStep, @Nullable java.lang.String codeRef)Return a Test Case ID for mapped code- Parameters:
testStep- Cucumber's TestStep objectcodeRef- a code reference- Returns:
- Test Case ID entity or null if it's not possible to calculate
-
buildStartStepRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartStepRequest(@Nonnull io.cucumber.plugin.event.TestStep testStep, @Nullable java.lang.String stepPrefix, @Nullable java.lang.String keyword)Extension point to customize test creation event/request- Parameters:
testStep- a cucumber step objectstepPrefix- a prefix of the step (e.g. 'Background')keyword- a step keyword (e.g. 'Given')- Returns:
- a Request to ReportPortal
-
startStep
@Nonnull protected io.reactivex.Maybe<java.lang.String> startStep(@Nonnull io.reactivex.Maybe<java.lang.String> scenarioId, @Nonnull com.epam.ta.reportportal.ws.model.StartTestItemRQ startStepRq)Start Step item on Report Portal- Parameters:
scenarioId- parent scenario item idstartStepRq- step start request- Returns:
- step item id
-
beforeStep
protected void beforeStep(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull io.cucumber.plugin.event.TestStep testStep)Start Cucumber step- Parameters:
testCase- Cucumber's TestCase objecttestStep- a cucumber step object
-
afterStep
protected void afterStep(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull io.cucumber.plugin.event.TestStep testStep, @Nonnull io.cucumber.plugin.event.Result result)Finish Cucumber step- Parameters:
testCase- Cucumber's TestCase objecttestStep- a cucumber step objectresult- Step result
-
getHookTypeAndName
@Nonnull protected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String> getHookTypeAndName(@Nonnull io.cucumber.plugin.event.HookType hookType)Returns hook type and name as aPair- Parameters:
hookType- Cucumber's hoo type- Returns:
- a pair of type and name
-
buildStartHookRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartHookRequest(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull io.cucumber.plugin.event.HookTestStep testStep)Extension point to customize test creation event/request- Parameters:
testCase- Cucumber's TestCase objecttestStep- a cucumber step object- Returns:
- Request to ReportPortal
-
startHook
@Nonnull protected io.reactivex.Maybe<java.lang.String> startHook(@Nonnull io.reactivex.Maybe<java.lang.String> parentId, @Nonnull com.epam.ta.reportportal.ws.model.StartTestItemRQ rq)Start before/after-hook item on Report Portal- Parameters:
parentId- parent item idrq- hook start request- Returns:
- hook item id
-
beforeHooks
protected void beforeHooks(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull io.cucumber.plugin.event.HookTestStep testStep)Called when before/after-hooks are started- Parameters:
testCase- a Cucumber's TestCase objecttestStep- Cucumber's TestStep object
-
afterHooks
protected void afterHooks(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull io.cucumber.plugin.event.HookTestStep step, io.cucumber.plugin.event.Result result)Called when before/after-hooks are finished- Parameters:
testCase- a Cucumber's TestCase objectstep- a cucumber step objectresult- a cucumber result object
-
getFeatureTestItemType
@Nonnull protected abstract java.lang.String getFeatureTestItemType()
Return RP launch test item name mapped to Cucumber feature- Returns:
- test item name
-
getScenarioTestItemType
@Nonnull protected abstract java.lang.String getScenarioTestItemType()
Return RP launch test item name mapped to Cucumber scenario- Returns:
- test item name
-
reportResult
protected void reportResult(@Nonnull io.cucumber.plugin.event.Result result, @Nullable java.lang.String message)Report test item result and error (if present)- Parameters:
result- - Cucumber result objectmessage- - optional message to be logged in addition
-
embedding
protected void embedding(@Nullable java.lang.String name, @Nullable java.lang.String mimeType, @Nonnull byte[] data)Send a log with data attached.- Parameters:
name- attachment namemimeType- attachment typedata- data to attach
-
sendLog
protected void sendLog(@Nullable java.lang.String message)Send a text log entry to Report Portal with 'INFO' level, using current datetime as timestamp- Parameters:
message- a text message
-
sendLog
protected void sendLog(@Nullable java.lang.String message, @Nullable java.lang.String level)Send a text log entry to Report Portal using current datetime as timestamp- Parameters:
message- a text messagelevel- a log level, see standard Log4j / logback logging levels
-
getRootItemId
@Nonnull protected abstract java.util.Optional<io.reactivex.Maybe<java.lang.String>> getRootItemId()
-
buildStartRuleRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartRuleRequest(@Nonnull io.cucumber.plugin.event.Node.Rule rule, @Nullable java.lang.String codeRef)Extension point to customize scenario creation event/request- Parameters:
rule- the rule nodecodeRef- the rule code reference- Returns:
- start test item request ready to send on RP
-
startRule
@Nonnull protected io.reactivex.Maybe<java.lang.String> startRule(@Nonnull io.reactivex.Maybe<java.lang.String> featureId, @Nonnull com.epam.ta.reportportal.ws.model.StartTestItemRQ ruleRq)Start Rule item on Report Portal- Parameters:
featureId- parent item idruleRq- Rule start request- Returns:
- hook item id
-
beforeScenario
protected void beforeScenario(@Nonnull io.cucumber.core.gherkin.Feature feature, @Nonnull io.cucumber.plugin.event.TestCase scenario)Start Cucumber scenario- Parameters:
feature- current feature objectscenario- current scenario object
-
buildStartFeatureRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartFeatureRequest(@Nonnull io.cucumber.core.gherkin.Feature feature, @Nonnull java.net.URI uri)Extension point to customize feature creation event/request- Parameters:
feature- a Cucumber's Feature objecturi- a path to the feature- Returns:
- Request to ReportPortal
-
startFeature
@Nonnull protected io.reactivex.Maybe<java.lang.String> startFeature(@Nonnull com.epam.ta.reportportal.ws.model.StartTestItemRQ startFeatureRq)Start Cucumber Feature- Parameters:
startFeatureRq- feature start request- Returns:
- feature item id
-
handleStartOfTestCase
protected void handleStartOfTestCase(@Nonnull io.cucumber.plugin.event.TestCaseStarted event)Starts a Cucumber Test Case start, also starts corresponding Feature if is not started already.- Parameters:
event- Cucumber's Test Case started event object
-
handleSourceEvents
protected void handleSourceEvents(io.cucumber.plugin.event.TestSourceParsed parseEvent)
-
getTestRunStartedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestRunStarted> getTestRunStartedHandler()
-
getTestSourceParsedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestSourceParsed> getTestSourceParsedHandler()
-
getTestCaseStartedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestCaseStarted> getTestCaseStartedHandler()
-
getTestStepStartedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestStepStarted> getTestStepStartedHandler()
-
getTestStepFinishedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestStepFinished> getTestStepFinishedHandler()
-
getTestCaseFinishedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestCaseFinished> getTestCaseFinishedHandler()
-
getTestRunFinishedHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.TestRunFinished> getTestRunFinishedHandler()
-
getEmbedEventHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.EmbedEvent> getEmbedEventHandler()
-
getWriteEventHandler
protected io.cucumber.plugin.event.EventHandler<io.cucumber.plugin.event.WriteEvent> getWriteEventHandler()
-
setEventPublisher
public void setEventPublisher(io.cucumber.plugin.event.EventPublisher publisher)
Registers an event handler for a specific event.The available events types are:
TestRunStarted- the first event sent.TestSourceRead- sent for each feature file read, contains the feature file source.TestCaseStarted- sent before starting the execution of a Test Case(/Pickle/Scenario), contains the Test CaseTestStepStarted- sent before starting the execution of a Test Step, contains the Test StepTestStepFinished- sent after the execution of a Test Step, contains the Test Step and its Result.TestCaseFinished- sent after the execution of a Test Case(/Pickle/Scenario), contains the Test Case and its Result.TestRunFinished- the last event sent.EmbedEvent- calling scenario.embed in a hook triggers this event.WriteEvent- calling scenario.write in a hook triggers this event.
- Specified by:
setEventPublisherin interfaceio.cucumber.plugin.ConcurrentEventListener
-
handleEndOfFeature
protected void handleEndOfFeature()
-
handleTestStepStarted
protected void handleTestStepStarted(@Nonnull io.cucumber.plugin.event.TestStepStarted event)
-
handleTestStepFinished
protected void handleTestStepFinished(@Nonnull io.cucumber.plugin.event.TestStepFinished event)
-
buildFinishTestItemRequest
@Nonnull protected com.epam.ta.reportportal.ws.model.FinishTestItemRQ buildFinishTestItemRequest(@Nonnull io.reactivex.Maybe<java.lang.String> itemId, @Nullable java.util.Date finishTime, @Nullable com.epam.reportportal.listeners.ItemStatus status)Build finish test item request object- Parameters:
itemId- item ID referencefinishTime- a datetime object to use as item end timestatus- item result status- Returns:
- finish request
-
finishTestItem
protected java.util.Date finishTestItem(@Nullable io.reactivex.Maybe<java.lang.String> itemId, @Nullable com.epam.reportportal.listeners.ItemStatus status, @Nullable java.util.Date dateTime)Finish a test item with specified status- Parameters:
itemId- an ID of the itemstatus- the status of the itemdateTime- a date and time object to use as feature end time- Returns:
- a date and time object of the finish event
-
mapItemStatus
@Nullable protected com.epam.reportportal.listeners.ItemStatus mapItemStatus(@Nullable io.cucumber.plugin.event.Status status)Map Cucumber statuses to RP item statuses- Parameters:
status- - Cucumber status- Returns:
- RP test item status and null if status is null
-
finishTestItem
@Nullable protected java.util.Date finishTestItem(@Nullable io.reactivex.Maybe<java.lang.String> itemId, @Nullable com.epam.reportportal.listeners.ItemStatus status)Finish a test item with specified status- Parameters:
itemId- an ID of the itemstatus- the status of the item- Returns:
- a date and time object of the finish event
-
finishTestItem
protected void finishTestItem(@Nullable io.reactivex.Maybe<java.lang.String> itemId)Finish a test item with no specific status- Parameters:
itemId- an ID of the item
-
mapLevel
@Nonnull protected java.lang.String mapLevel(@Nullable io.cucumber.plugin.event.Status cukesStatus)Map Cucumber statuses to RP log levels- Parameters:
cukesStatus- - Cucumber status- Returns:
- regular log level
-
formatDataTable
@Nonnull protected java.lang.String formatDataTable(@Nonnull java.util.List<java.util.List<java.lang.String>> table)Converts a table represented as List of Lists to a formatted table string- Parameters:
table- a table object- Returns:
- string representation of the table
-
buildMultilineArgument
@Nonnull protected java.lang.String buildMultilineArgument(@Nonnull io.cucumber.plugin.event.TestStep step)Generate multiline argument (DataTable or DocString) representation- Parameters:
step- - Cucumber step object- Returns:
- - transformed multiline argument (or empty string if there is none)
-
getCodeRef
@Nullable protected java.lang.String getCodeRef(@Nonnull io.cucumber.plugin.event.TestStep testStep)Returns code reference for mapped code- Parameters:
testStep- Cucumber's TestStep object- Returns:
- a code reference, or null if not possible to determine (ambiguous, undefined, etc.)
-
getCodeRef
@Nonnull protected java.lang.String getCodeRef(@Nonnull java.net.URI uri, int line)Returns code reference for feature files by URI and text line number- Parameters:
uri- a feature URIline- a scenario line number- Returns:
- a code reference
-
getAttributes
@Nullable protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> getAttributes(@Nonnull java.lang.String codeRef)Returns static attributes defined byAttributesannotation in code.- Parameters:
codeRef- - a method reference to read parameters- Returns:
- a set of attributes or null if no such method provided by the match object
-
getParameters
@Nonnull protected java.util.List<com.epam.ta.reportportal.ws.model.ParameterResource> getParameters(@Nullable java.lang.String codeRef, @Nonnull io.cucumber.plugin.event.TestStep testStep)Returns a list of parameters for a step- Parameters:
codeRef- a method code reference to retrieve parameter typestestStep- Cucumber's Step object- Returns:
- a list of parameters or empty list if none
-
getDescription
@Nonnull protected java.lang.String getDescription(io.cucumber.core.gherkin.Feature feature, @Nonnull java.net.URI uri)Build an item description for a feature- Parameters:
feature- a Cucumber's Feature objecturi- a feature URI- Returns:
- item description
-
getDescription
@Nonnull protected java.lang.String getDescription(@Nonnull io.cucumber.plugin.event.TestCase testCase, @Nonnull java.net.URI uri)Build an item description for a scenario- Parameters:
testCase- a Cucumber's TestCase objecturi- a feature URI- Returns:
- item description
-
-