public abstract class AbstractReporter
extends java.lang.Object
implements gherkin.formatter.Formatter, gherkin.formatter.Reporter
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
COLON_INFIX |
protected java.lang.ThreadLocal<RunningContext.FeatureContext> |
currentFeatureContext |
protected java.lang.ThreadLocal<RunningContext.ScenarioContext> |
currentScenarioContext |
static com.epam.reportportal.service.tree.TestItemTree |
ITEM_TREE |
protected java.util.function.Supplier<com.epam.reportportal.service.Launch> |
launch |
protected static java.lang.String |
SKIPPED_ISSUE_KEY |
| Constructor and Description |
|---|
AbstractReporter() |
| Modifier and Type | Method and Description |
|---|---|
void |
after(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result) |
protected void |
afterFeature()
Finish current Cucumber feature
|
protected void |
afterHooks(java.lang.Boolean isBefore)
Called when before/after-hooks are finished
|
protected void |
afterLaunch()
Finish RP launch
|
protected void |
afterScenario()
Finish Cucumber scenario
|
protected void |
afterStep(gherkin.formatter.model.Result result)
Finish Cucumber step
|
void |
background(gherkin.formatter.model.Background background) |
void |
before(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result)
Cucumber interfaces implementations
|
protected void |
beforeFeature(gherkin.formatter.model.Feature feature)
Define Start Cucumber feature RQ
|
protected void |
beforeHooks(boolean isBefore)
Called when before/after-hooks are started
|
protected void |
beforeScenario(gherkin.formatter.model.Scenario scenario,
java.lang.String outlineIteration)
Start Cucumber Feature (if not started) and Scenario
|
protected void |
beforeStep(gherkin.formatter.model.Step step,
gherkin.formatter.model.Match match)
Start Cucumber step
|
protected com.epam.ta.reportportal.ws.model.FinishTestItemRQ |
buildFinishTestItemRequest(io.reactivex.Maybe<java.lang.String> itemId,
com.epam.reportportal.listeners.ItemStatus status)
Build finish test item request object
|
protected java.lang.String |
buildMultilineArgument(gherkin.formatter.model.Step step)
Generate multiline argument (DataTable or DocString) representation
|
protected com.epam.reportportal.service.ReportPortal |
buildReportPortal()
Extension point to customize ReportPortal instance
|
protected java.lang.String |
buildScenarioName(gherkin.formatter.model.Scenario scenario)
Returns a scenario name
|
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ |
buildStartFeatureRequest(gherkin.formatter.model.Feature feature,
java.lang.String uri)
Extension point to customize feature creation event/request
|
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ |
buildStartHookRequest(boolean isBefore)
Extension point to customize test creation event/request
|
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ |
buildStartScenarioRequest(gherkin.formatter.model.Scenario scenario,
java.lang.String uri)
Extension point to customize scenario creation event/request
|
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ |
buildStartStepRequest(gherkin.formatter.model.Step step,
java.lang.String stepPrefix,
gherkin.formatter.model.Match match)
Extension point to customize step creation event/request
|
void |
close() |
void |
done() |
void |
embedding(java.lang.String mimeType,
byte[] data)
Send a log with data attached.
|
void |
endOfScenarioLifeCycle(gherkin.formatter.model.Scenario scenario) |
void |
eof() |
void |
examples(gherkin.formatter.model.Examples examples) |
protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> |
extractAttributes(java.util.List<gherkin.formatter.model.Tag> tags)
Transform tags from Cucumber to RP format
|
void |
feature(gherkin.formatter.model.Feature feature) |
protected void |
finishTestItem(io.reactivex.Maybe<java.lang.String> itemId)
Finish a test item with no specific status
|
protected void |
finishTestItem(io.reactivex.Maybe<java.lang.String> itemId,
com.epam.reportportal.listeners.ItemStatus status)
Finish a test item with specified status
|
protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> |
getAttributes(gherkin.formatter.model.Match match)
Returns static attributes defined by
Attributes annotation in code. |
protected java.lang.String |
getCodeRef(gherkin.formatter.model.Match match)
Returns code reference for mapped code
|
protected java.lang.String |
getCodeRef(java.lang.String uri,
int line)
Returns code reference for feature files by URI and text line number
|
protected java.lang.String |
getDescription(gherkin.formatter.model.Feature feature,
java.lang.String uri)
Build an item description for a feature
|
protected java.lang.String |
getDescription(gherkin.formatter.model.Scenario scenario,
java.lang.String uri)
Build an item description for a scenario
|
protected abstract java.lang.String |
getFeatureTestItemType()
Return RP test item name mapped to Cucumber feature
|
protected java.util.List<com.epam.ta.reportportal.ws.model.ParameterResource> |
getParameters(gherkin.formatter.model.Step step,
java.lang.String codeRef,
gherkin.formatter.model.Match match)
Returns a list of parameters for a step
|
static com.epam.reportportal.service.ReportPortal |
getReportPortal() |
protected abstract java.util.Optional<io.reactivex.Maybe<java.lang.String>> |
getRootItemId()
Returns the ID of the root item of the launch
|
protected abstract java.lang.String |
getScenarioTestItemType()
Return RP test item name mapped to Cucumber scenario
|
protected com.epam.reportportal.service.item.TestCaseIdEntry |
getTestCaseId(gherkin.formatter.model.Match match,
java.lang.String codeRef)
Return a Test Case ID for mapped code
|
protected void |
hookFinished(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result,
java.lang.Boolean isBefore)
Called when a specific before/after-hook is finished
|
protected java.lang.String |
mapLevel(java.lang.String cukesStatus)
Map Cucumber statuses to RP log levels
|
protected com.epam.reportportal.listeners.ItemStatus |
mapStatus(java.lang.String cukesStatus)
Map Cucumber statuses to RP statuses
|
void |
match(gherkin.formatter.model.Match match) |
protected void |
reportResult(gherkin.formatter.model.Result result,
java.lang.String message)
Report test item result and error (if present)
|
void |
result(gherkin.formatter.model.Result result) |
void |
scenario(gherkin.formatter.model.Scenario scenario) |
void |
scenarioOutline(gherkin.formatter.model.ScenarioOutline scenarioOutline) |
protected void |
sendLog(java.lang.String message)
Send a text log entry to Report Portal with 'INFO' level, using current datetime as timestamp
|
protected void |
sendLog(java.lang.String message,
java.lang.String level)
Send a text log entry to Report Portal using current datetime as timestamp
|
protected static void |
setReportPortal(com.epam.reportportal.service.ReportPortal reportPortal) |
protected io.reactivex.Maybe<java.lang.String> |
startFeature(com.epam.ta.reportportal.ws.model.StartTestItemRQ startFeatureRq)
Start Cucumber Feature
|
protected 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 Portal
|
void |
startOfScenarioLifeCycle(gherkin.formatter.model.Scenario scenario) |
protected io.reactivex.Maybe<java.lang.String> |
startScenario(io.reactivex.Maybe<java.lang.String> featureId,
com.epam.ta.reportportal.ws.model.StartTestItemRQ startScenarioRq)
Start Cucumber Scenario
|
protected io.reactivex.Maybe<java.lang.String> |
startStep(io.reactivex.Maybe<java.lang.String> scenarioId,
com.epam.ta.reportportal.ws.model.StartTestItemRQ startStepRq)
Start Cucumber Step
|
void |
step(gherkin.formatter.model.Step step) |
void |
syntaxError(java.lang.String state,
java.lang.String event,
java.util.List<java.lang.String> legalEvents,
java.lang.String uri,
java.lang.Integer line) |
void |
uri(java.lang.String uri) |
void |
write(java.lang.String text)
Send a log entry to Report Portal with 'INFO' level.
|
public static final com.epam.reportportal.service.tree.TestItemTree ITEM_TREE
protected static final java.lang.String COLON_INFIX
protected static final java.lang.String SKIPPED_ISSUE_KEY
protected final java.lang.ThreadLocal<RunningContext.FeatureContext> currentFeatureContext
protected final java.lang.ThreadLocal<RunningContext.ScenarioContext> currentScenarioContext
protected final java.util.function.Supplier<com.epam.reportportal.service.Launch> launch
public static com.epam.reportportal.service.ReportPortal getReportPortal()
protected static void setReportPortal(com.epam.reportportal.service.ReportPortal reportPortal)
protected com.epam.reportportal.service.ReportPortal buildReportPortal()
protected void afterLaunch()
protected java.lang.String buildScenarioName(gherkin.formatter.model.Scenario scenario)
scenario - Cucumber's Scenario object@Nonnull
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartScenarioRequest(@Nonnull
gherkin.formatter.model.Scenario scenario,
@Nonnull
java.lang.String uri)
scenario - Cucumber's Scenario objecturi - a scenario relative path@Nonnull
protected io.reactivex.Maybe<java.lang.String> startFeature(@Nonnull
com.epam.ta.reportportal.ws.model.StartTestItemRQ startFeatureRq)
startFeatureRq - feature start request@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)
featureId - parent feature item idstartScenarioRq - scenario start requestprotected void beforeScenario(gherkin.formatter.model.Scenario scenario,
java.lang.String outlineIteration)
scenario - ScenariooutlineIteration - - suffix to append to scenario name, can be null@Nonnull
protected com.epam.ta.reportportal.ws.model.FinishTestItemRQ buildFinishTestItemRequest(@Nonnull
io.reactivex.Maybe<java.lang.String> itemId,
@Nullable
com.epam.reportportal.listeners.ItemStatus status)
itemId - item ID referencestatus - item result statusprotected void finishTestItem(@Nullable
io.reactivex.Maybe<java.lang.String> itemId,
@Nullable
com.epam.reportportal.listeners.ItemStatus status)
itemId - an ID of the itemstatus - the status of the itemprotected void afterScenario()
@Nonnull
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartFeatureRequest(@Nonnull
gherkin.formatter.model.Feature feature,
@Nonnull
java.lang.String uri)
feature - a Cucumber's Feature objecturi - a path to the featureprotected void beforeFeature(gherkin.formatter.model.Feature feature)
feature - Step featureprotected void afterFeature()
@Nonnull
protected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartStepRequest(@Nonnull
gherkin.formatter.model.Step step,
@Nullable
java.lang.String stepPrefix,
@Nonnull
gherkin.formatter.model.Match match)
step - a Cucumber's Step objectstepPrefix - a prefix of the step (e.g. 'Background')match - a Cucumber's Match object@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)
scenarioId - parent scenario item idstartStepRq - step start requestprotected void beforeStep(gherkin.formatter.model.Step step,
gherkin.formatter.model.Match match)
step - Step objectmatch - Match objectprotected void afterStep(@Nonnull
gherkin.formatter.model.Result result)
result - Step resultprotected com.epam.ta.reportportal.ws.model.StartTestItemRQ buildStartHookRequest(boolean isBefore)
isBefore - a cucumber hook type object@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)
parentId - parent item idrq - hook start requestprotected void beforeHooks(boolean isBefore)
isBefore - - if true, before-hook is finished, if false - after-hookprotected void afterHooks(java.lang.Boolean isBefore)
isBefore - - if true, before-hook is finished, if false - after-hookprotected void hookFinished(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result,
java.lang.Boolean isBefore)
match - Match objectresult - Hook resultisBefore - - if true, before-hook, if false - after-hookprotected void reportResult(@Nonnull
gherkin.formatter.model.Result result,
@Nullable
java.lang.String message)
result - - Cucumber result objectmessage - - optional message to be logged in addition@Nonnull protected abstract java.lang.String getFeatureTestItemType()
@Nonnull protected abstract java.lang.String getScenarioTestItemType()
public void before(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result)
before in interface gherkin.formatter.Reporterpublic void result(gherkin.formatter.model.Result result)
result in interface gherkin.formatter.Reporterpublic void after(gherkin.formatter.model.Match match,
gherkin.formatter.model.Result result)
after in interface gherkin.formatter.Reporterpublic void match(gherkin.formatter.model.Match match)
match in interface gherkin.formatter.Reporterpublic void embedding(java.lang.String mimeType,
byte[] data)
embedding in interface gherkin.formatter.ReportermimeType - an attachment typedata - data to attachpublic void syntaxError(java.lang.String state,
java.lang.String event,
java.util.List<java.lang.String> legalEvents,
java.lang.String uri,
java.lang.Integer line)
syntaxError in interface gherkin.formatter.Formatterpublic void uri(java.lang.String uri)
uri in interface gherkin.formatter.Formatterpublic void feature(gherkin.formatter.model.Feature feature)
feature in interface gherkin.formatter.Formatterpublic void scenarioOutline(gherkin.formatter.model.ScenarioOutline scenarioOutline)
scenarioOutline in interface gherkin.formatter.Formatterpublic void examples(gherkin.formatter.model.Examples examples)
examples in interface gherkin.formatter.Formatterpublic void startOfScenarioLifeCycle(gherkin.formatter.model.Scenario scenario)
startOfScenarioLifeCycle in interface gherkin.formatter.Formatterpublic void background(gherkin.formatter.model.Background background)
background in interface gherkin.formatter.Formatterpublic void scenario(gherkin.formatter.model.Scenario scenario)
scenario in interface gherkin.formatter.Formatterpublic void step(gherkin.formatter.model.Step step)
step in interface gherkin.formatter.Formatterpublic void endOfScenarioLifeCycle(gherkin.formatter.model.Scenario scenario)
endOfScenarioLifeCycle in interface gherkin.formatter.Formatterpublic void done()
done in interface gherkin.formatter.Formatterpublic void close()
close in interface gherkin.formatter.Formatterclose in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void eof()
eof in interface gherkin.formatter.Formatterprotected abstract java.util.Optional<io.reactivex.Maybe<java.lang.String>> getRootItemId()
@Nullable
protected com.epam.reportportal.service.item.TestCaseIdEntry getTestCaseId(@Nonnull
gherkin.formatter.model.Match match,
@Nullable
java.lang.String codeRef)
match - Cucumber's Match objectcodeRef - a code reference@Nonnull
protected java.lang.String getDescription(@Nonnull
gherkin.formatter.model.Scenario scenario,
@Nonnull
java.lang.String uri)
scenario - a Cucumber's Scenario objecturi - a feature URI@Nonnull
protected java.lang.String getDescription(@Nonnull
gherkin.formatter.model.Feature feature,
@Nonnull
java.lang.String uri)
feature - a Cucumber's Feature objecturi - a feature URIprotected void finishTestItem(io.reactivex.Maybe<java.lang.String> itemId)
itemId - an ID of the item@Nullable
protected java.lang.String getCodeRef(@Nonnull
gherkin.formatter.model.Match match)
match - Cucumber's Match object@Nonnull
protected java.lang.String getCodeRef(@Nonnull
java.lang.String uri,
int line)
uri - a feature URIline - a scenario line number@Nonnull
protected com.epam.reportportal.listeners.ItemStatus mapStatus(@Nullable
java.lang.String cukesStatus)
cukesStatus - - Cucumber status@Nonnull
protected java.lang.String mapLevel(@Nullable
java.lang.String cukesStatus)
cukesStatus - - Cucumber statuspublic void write(java.lang.String text)
write in interface gherkin.formatter.Reportertext - a log text to sendprotected void sendLog(java.lang.String message)
message - a text messageprotected void sendLog(java.lang.String message,
java.lang.String level)
message - a text messagelevel - a log level, see standard Log4j / logback logging levels@Nonnull
protected java.util.List<com.epam.ta.reportportal.ws.model.ParameterResource> getParameters(@Nonnull
gherkin.formatter.model.Step step,
@Nullable
java.lang.String codeRef,
@Nonnull
gherkin.formatter.model.Match match)
step - Cucumber's Step objectcodeRef - a method code reference to retrieve parameter typesmatch - Cucumber's Match object@Nonnull
protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> extractAttributes(@Nonnull
java.util.List<gherkin.formatter.model.Tag> tags)
tags - - Cucumber tags@Nullable protected java.util.Set<com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ> getAttributes(gherkin.formatter.model.Match match)
Attributes annotation in code.match - Cucumber's Match objectprotected java.lang.String buildMultilineArgument(gherkin.formatter.model.Step step)
step - - Cucumber step object