public class ServiceResult extends Object
RunOptions.outputServiceResultDB
is present in reports/db/ after a successful run ( ConfigFile.getReportsDir()
/RestReplay.REL_PATH_TO_DB
).Modifier and Type | Class and Description |
---|---|
static class |
ServiceResult.Column |
static class |
ServiceResult.DUMP_OPTIONS |
static class |
ServiceResult.Payload |
static class |
ServiceResult.PAYLOAD_STRICTNESS |
static class |
ServiceResult.PRETTY_FORMAT |
Constructor and Description |
---|
ServiceResult(RunOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
addAlert(String message,
String context,
Alert.LEVEL level) |
void |
addAlertError(String message) |
void |
addAlertError(String message,
String context) |
void |
addAlertOK(String message) |
void |
addAlertOK(String message,
String context) |
void |
addAlertWarning(String message) |
void |
addAlertWarning(String message,
String context) |
void |
addChild(ServiceResult child) |
void |
addError(String msg) |
void |
addError(String msg,
Throwable t) |
void |
addExport(String key,
Object value) |
void |
addExports(Map<String,Object> newexports) |
void |
addPartSummary(String label,
TreeWalkResults list) |
void |
addRequestHeader(String name,
String value) |
void |
addVars(Map<String,Object> newVars) |
void |
addWarning(String msg) |
int |
alertsCount(Alert.LEVEL level) |
void |
beginTrappingExports() |
static boolean |
codeInSuccessRange(int code) |
ServiceResult.PRETTY_FORMAT |
contentTypeFromResponse() |
static Map<TreeWalkResults.TreeWalkEntry.STATUS,Range> |
createRangesForLevel(ServiceResult.PAYLOAD_STRICTNESS strictness) |
String |
detail(boolean includePayloads) |
String |
dump(ServiceResult.DUMP_OPTIONS opt,
boolean hasError) |
String |
dumpPayloads() |
List<String> |
endTrappingExports() |
String |
expectedTreewalkRangeMapToString() |
Object |
get(String what) |
List<ServiceResult> |
getChildResults() |
String |
getCurrentValidatorContextName() |
String |
getError() |
String |
getErrorDetail() |
Map<String,Object> |
getExports() |
int |
getLoopIndex() |
String |
getLoopQualifier(Eval evalStruct) |
String |
getMimeType() |
IMutator |
getMutator() |
ServiceResult |
getParent() |
String |
getResult() |
RunOptions |
getRunOptions() |
String |
getSequence()
The sequence number is generated for each run, so that each ServiceResult is sequentially numbered
from zero; this number appears on the right side of the detail report on the first line of each test,
and in square brackets in the imports dump at the top of the testGroup report.
|
Map<String,Object> |
getVars() |
String |
getXmlResult() |
Object |
got(String pathExpression)
This method may be called from a test case, using a syntax
with XPath like this:
${testID3.got("//refName")}
or with JSON, like this:
${testID3.got("$..refName")} |
boolean |
gotExpectedResult() |
Object |
gotJson(String jsonPath) |
Object |
gotXPath(String pathExpression) |
void |
initExpectedCodeRanges(org.dom4j.Node testNode)
if xml sets no expected/code nodes, then DEFAULT_SUCCESS_RANGE is used.
|
boolean |
isDomWalkOK() |
boolean |
isDomWalkOKByRanges(Map<TreeWalkResults.TreeWalkEntry.STATUS,Range> expectedRangeMap) |
boolean |
isSUCCESS() |
String |
minimal() |
String |
minimal(boolean verbosePartsSummary) |
void |
overrideGotExpectedResult()
Call this method to create a ServiceResult mock object, for when you are doing autoDelete, and you come
across a GET : GETs don't have a DELETE url, so they don't need to be autoDeleted, so an empty ServiceResult object
signifies this.
|
String |
partsSummary(boolean detailed) |
String |
partsSummaryHTML(boolean detailed) |
static String |
payloadJSONtoXML(String payload) |
static String |
payloadXMLtoJSON(String payload) |
void |
populateSerializedFields() |
static String |
prettyPrintJSON(String payload) |
Object |
sent(String path) |
Object |
sentJson(String jsonPath) |
Object |
sentJson(String jsonPath,
String source) |
Object |
sentXPath(String path) |
Object |
sentXPath(String xpath,
String source) |
void |
setCurrentValidatorContextName(String name) |
void |
setMimeType(String mimeHeader) |
protected void |
setParent(ServiceResult sr) |
void |
setResponseHeaders(org.apache.commons.httpclient.Header[] headers) |
void |
setResultWMime(String result,
String mimeType) |
String |
tiny() |
String |
toString() |
public final String sequence
public RestReplayReport.ReportMasterLocations reportMaster
public RestReplayReport.ReportDetailLocations reportDetail
public String controlFileName
public String testID
public String testGroupID
public String testIDLabel
public String idFromMutator
public boolean isMutation
public String mutatorType
public transient IMutator mutator
public String mutationDetailBlockID
public boolean mutatorSkipped
public boolean mutatorSkippedByOpts
public String comment
public boolean isAutodelete
public boolean parentSkipped
public int loopIndex
public String fullURL
public String deleteURL
public String protoHostPort
public String location
public String CSID
public String subresourceCSID
public String requestPayloadFilename
public String requestPayload
public String requestPayloadsRaw
public String prettyJSON
public long time
public int responseCode
public String responseMessage
public String method
public int socketTimeout
public int connectionTimeout
public String fromTestID
public String auth
public String boundary
public String payloadStrictness
public long contentLength
public String failureReason
public boolean expectedFailure
public boolean expectedContentExpandedWasJson
public String expectedContentExpanded
public String expectedContentExpandedAsXml
public String expectedContentRaw
public String expectedResponseFilenameUsed
public String domcheck
public transient List<ServiceResult.Column> expectedTreewalkRangeColumns
public transient Map<TreeWalkResults.TreeWalkEntry.STATUS,Range> expectedTreewalkRangeMap
public org.apache.commons.httpclient.Header[] responseHeaders
public String responseHeadersDump
public static final Range DEFAULT_SUCCESS_RANGE
public boolean overrideExpectedResult
public String gotExpectedResultBecause
public Map<String,ServiceResult.Payload> payloads
public boolean calcGotExpectedResult
public String calcSuccessLabel
public String calcExpectedTreewalkRangeColumns
public ServiceResult(RunOptions options)
public String getSequence()
public RunOptions getRunOptions()
public void addChild(ServiceResult child)
public List<ServiceResult> getChildResults()
public ServiceResult getParent()
protected void setParent(ServiceResult sr)
public IMutator getMutator()
public int getLoopIndex()
public String getXmlResult()
public String getResult()
public String getError()
public String getErrorDetail()
public void addError(String msg)
public void addWarning(String msg)
public String getMimeType()
public void setMimeType(String mimeHeader)
public String expectedTreewalkRangeMapToString()
public void setResponseHeaders(org.apache.commons.httpclient.Header[] headers)
public void initExpectedCodeRanges(org.dom4j.Node testNode)
public String getCurrentValidatorContextName()
public void setCurrentValidatorContextName(String name)
public void beginTrappingExports()
public int alertsCount(Alert.LEVEL level)
public void addPartSummary(String label, TreeWalkResults list)
public String partsSummary(boolean detailed)
public String partsSummaryHTML(boolean detailed)
public static boolean codeInSuccessRange(int code)
public boolean isSUCCESS()
public static Map<TreeWalkResults.TreeWalkEntry.STATUS,Range> createRangesForLevel(ServiceResult.PAYLOAD_STRICTNESS strictness)
public boolean isDomWalkOK()
public boolean isDomWalkOKByRanges(Map<TreeWalkResults.TreeWalkEntry.STATUS,Range> expectedRangeMap)
public void overrideGotExpectedResult()
public boolean gotExpectedResult()
public String dumpPayloads()
public String detail(boolean includePayloads)
public String minimal()
public String minimal(boolean verbosePartsSummary)
public String tiny()
public String dump(ServiceResult.DUMP_OPTIONS opt, boolean hasError)
public Object got(String pathExpression) throws Exception
This method may be called from a test case, using a syntax
with XPath like this:
${testID3.got("//refName")}
or with JSON, like this:
${testID3.got("$..refName")}
JsonPath docs say ALL expressions start with $.
An XPath could only start with a $ if you named an element like so: $myvariable
. So don't do that.
If you know which syntax you want to use, see these variants: gotXPath(String)
gotJson(String)
pathExpression
- If this.result is JSON, as determined by contentTypeFromResponse(), then JsonPath is assumed,
otherwise XPath is assumed.Exception
public Object sent(String path) throws Exception
${testID3.sent("//refName")}
or with JSON, like this:
${testID3.sent("$..refName")}
JsonPath docs say ALL expressions start with $.
An XPath could only start with a $ if you named an element like so: $myvariable
. So don't do that.
If you know which syntax you want to use, see these variants: sentXPath(String)
sentJson(String)
path
- If this.result is JSON, as determined by contentTypeFromResponse(), then JsonPath is assumed,
otherwise XPath is assumed.Exception
public ServiceResult.PRETTY_FORMAT contentTypeFromResponse()
public void addAlert(String message, String context, Alert.LEVEL level)
public void addAlertError(String message)
public void addAlertWarning(String message)
public void addAlertOK(String message)
public void populateSerializedFields()
Copyright © 2016. All rights reserved.