jmeter-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62887] SampleLabel displays incorrectly in Jmeter 5.0
Date Tue, 06 Nov 2018 19:13:27 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62887

--- Comment #5 from Alan Silva <alansq16@hotmail.com> ---
Hi,
So while running the unit tests, I noticed that the HTTPSamplerBase (and other
samplers perhaps), use a pattern of:


public SampleResult sample() {
    SampleResult res = null;
    try {
        res = sample(getUrl(), getMethod(), false, 0);
        if (res != null) {
            res.setSampleLabel(getName());
        }
        return res;
    } catch (Exception e) {
        return errorResult(e, new HTTPSampleResult());
    }
}

Meaning, the sampler's name gets inserted to the SampleResult before returning.
So I can't really check for subResult.getSampleLabel().isEmpty() since it will
most likely won't be.

Also, I noticed that the subResult currently just uses it's parent Result's
label.

So I tried applying the attached patch which just checks if the subResult has
the same label as its parent result object.
If it does, I let the rename happen. 
Otherwise, I assume that the subResult's label was modified for a reason and
shouldn't be touched.


Unfortunately, it seems to be breaking some of the unit tests but at this
point, I honestly don't know if it be worthwhile to fix all of them for a
cosmetic change.
I already changed our internal code to not automatically assume the subResult
will have the same label as the parent with the existing
addSubResult(subResult, false) method and will probably leave it at that.

Feel free to close this ticket if you wish.

@Philippe Mouawad
Simply make two SampleResult objects X and Y and try to add Y as a subResult of
X with X.addResult(Y)
You'll see that Y will always have the same name as X even if you call
Y.setSampleLabel("foo") or something.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message