apache / apache/jmeter

Copy request, response and assertion to transaction sampler upon failure

Open
#4,021 1 comment 0 reactions 0 assignees View on GitHub
enhancement need info os: All P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**Wanjun Wang** ([Bug 59831](https://bz.apache.org/bugzilla//show_bug.cgi?id=59831&redirect=false)):
To make BackendListenerClient's handle failures more easily, TransactionSampler should include the response and assertion from latest failed sub-sampler. This can be done by adding the following code to the end of addSubSamplerResult(SampleResult res) in org.apache.jmeter.control.TransactionSampler:

if (res.getErrorCount()>0) {
// Copy response and assertion for failure
transactionSampleResult.setRequestHeaders(res.getRequestHeaders());
transactionSampleResult.setResponseCode(res.getResponseCode());
transactionSampleResult.setResponseHeaders(res.getResponseHeaders());
transactionSampleResult.setResponseData(res.getResponseData());
for (AssertionResult a : res.getAssertionResults()) {
transactionSampleResult.addAssertionResult(a);
}
}

Currently, TransactionSampler's SampleResult doesn't use those fields right now, so there's minimum impact.

OS: All

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.