Bug 64988 - Debug PostProcessor and Debug Sampler sorts alphanumeric properties and variables in non natural/human readable order
Summary: Debug PostProcessor and Debug Sampler sorts alphanumeric properties and varia...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: Nightly (Please specify date)
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: JMETER 5.4.1
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2020-12-15 00:06 UTC by eR@SeR
Modified: 2021-08-23 09:50 UTC (History)
1 user (show)



Attachments
useHumanReadableOrder (13.90 KB, application/xml)
2020-12-15 00:06 UTC, eR@SeR
Details
Sort properties in a human expected order (8.44 KB, patch)
2020-12-15 16:34 UTC, Felix Schumacher
Details | Diff
Sort properties and variables in a human expected order (9.90 KB, patch)
2020-12-15 19:27 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eR@SeR 2020-12-15 00:06:51 UTC
Created attachment 37611 [details]
useHumanReadableOrder

Hello,

Both Debug PostProcessor and Debug Sampler sort alphanumeric properties and variables in non-natural/human-readable order. IMO, it is more appropriate to sort in natural order for easier debugging, rather than current behavior. Dropdown or check box option could be added to choose an algorithm of sorting inside both elements. Please run jmx file and check the results.

Actual:

var_1=google
var_10=google
var_10_g=1
var_10_g0=google
var_10_g1=google
var_11=google
var_11_g=1
var_11_g0=google
var_11_g1=google
var_12=google
var_12_g=1
var_12_g0=google
var_12_g1=google
var_13=google
var_13_g=1
var_13_g0=google
var_13_g1=google
var_14=google
var_14_g=1
var_14_g0=google
var_14_g1=google
var_15=google
var_15_g=1
var_15_g0=google
var_15_g1=google
var_16=google
var_16_g=1
var_16_g0=google
var_16_g1=google
var_17=google
var_17_g=1
var_17_g0=google
var_17_g1=google
var_18=google
var_18_g=1
var_18_g0=google
var_18_g1=google
var_19=google
var_19_g=1
var_19_g0=google
var_19_g1=google
var_1_g=1
var_1_g0=google
var_1_g1=google
var_2=google
var_20=google
var_20_g=1
var_20_g0=google
var_20_g1=google

etc.

Expected:

var_1_g=1
var_1=google
var_1_g0=google
var_1_g1=google
var_2_g=1
var_2=google
var_2_g0=google
var_2_g1=google
var_3_g=1
var_3=google
var_3_g0=google
var_3_g1=google
var_4_g=1
var_4=google
var_4_g0=google
var_4_g1=google
var_5_g=1
var_5=google
var_5_g0=google
var_5_g1=google
var_6_g=1
var_6=google
var_6_g0=google
var_6_g1=google
var_7_g=1
var_7=google
var_7_g0=google
var_7_g1=google
var_8_g=1
var_8=google
var_8_g0=google
var_8_g1=google
var_9_g=1
var_9=google
var_9_g0=google
var_9_g1=google
var_10_g=1
var_10=google
var_10_g0=google
var_10_g1=google
var_11_g=1
var_11=google
var_11_g0=google
var_11_g1=google
var_12_g=1
var_12=google
var_12_g0=google
var_12_g1=google
var_13_g=1
var_13=google
var_13_g0=google
var_13_g1=google
var_14_g=1
var_14=google
var_14_g0=google
var_14_g1=google
var_15_g=1
var_15=google
var_15_g0=google
var_15_g1=google
var_16_g=1
var_16=google
var_16_g0=google
var_16_g1=google
var_17_g=1
var_17=google
var_17_g0=google
var_17_g1=google
var_18_g=1
var_18=google
var_18_g0=google
var_18_g1=google
var_19_g=1
var_19=google
var_19_g0=google
var_19_g1=google
var_20_g=1
var_20=google
var_20_g0=google
var_20_g1=google
var_21_g=1
var_21=google
var_21_g0=google
var_21_g1=google

etc.

Jmeter 5.4.1 3e5421f
Microsoft Windows 10 Pro 64-bit
java version "1.8.0_251"
Comment 1 Felix Schumacher 2020-12-15 16:34:30 UTC
Created attachment 37616 [details]
Sort properties in a human expected order
Comment 2 Felix Schumacher 2020-12-15 16:36:01 UTC
I think, I will wait with applying this patch to not disturb the minor release, we are planning right now. If you can patch & compile the code yourself, feedback is very welcome.
Comment 3 Felix Schumacher 2020-12-15 19:27:35 UTC
Created attachment 37618 [details]
Sort properties and variables in a human expected order

This patch includes the ordering for the DebugSampler and DebugPostProcessor
Comment 4 eR@SeR 2020-12-16 01:44:34 UTC
Hi Felix,

Wow, that was really fast and well done! Thank you :)

On my end, it works perfectly on the provided and real test plan for both Debug elements. I checked:

HTTP Sampler (using RegEx and JSON extractors - match No. -1)
JDBC Request Sampler (Variable names text box)
User Parameters Pre Processor and I used variables like var_1, var_2 etc.

I won't mark the thread as fixed, just in case someone finds anything unusual.

Jmeter 5.4.1 58ad5bc
Microsoft Windows 10 Pro 64-bit
java version "1.8.0_251"
Comment 5 Felix Schumacher 2021-01-27 16:27:38 UTC
@Nikola, can you test the next build from trunk or nightly again?

commit 2d217c9e0332073f412330641dc8ee89db341699
AuthorDate: Tue Dec 15 17:30:08 2020 +0100

    Sort properties and variables in a human expected order for DebugPostProcessor and DebugSampler
    
    That means the following order would hold:
     1,2,10,11,20,abc_1,abc_2,abc_10
    
    Bugzilla Id: 64988
---
 .../jmeter/extractor/DebugPostProcessor.java       |  8 +-
 .../org/apache/jmeter/sampler/DebugSampler.java    |  7 +-
 .../jorphan/util/AlphaNumericKeyComparator.java    | 87 ++++++++++++++++++++++
 .../util/TestAlphaNumericKeyComparator.java        | 64 ++++++++++++++++
 xdocs/changes.xml                                  |  1 +
 5 files changed, 156 insertions(+), 11 deletions(-)
Comment 6 eR@SeR 2021-01-27 23:19:31 UTC
(In reply to eR@SeR from comment #4)
> Hi Felix,
> 
> Wow, that was really fast and well done! Thank you :)
> 
> On my end, it works perfectly on the provided and real test plan for both
> Debug elements. I checked:
> 
> HTTP Sampler (using RegEx and JSON extractors - match No. -1)
> JDBC Request Sampler (Variable names text box)
> User Parameters Pre Processor and I used variables like var_1, var_2 etc.
> 
> I won't mark the thread as fixed, just in case someone finds anything
> unusual.
> 
> Jmeter 5.4.1 58ad5bc
> Microsoft Windows 10 Pro 64-bit
> java version "1.8.0_251"
Hi Felix,

I checked the same real test plan for both Debug elements and it works fine. Thank you.

I won't mark the thread as fixed, just in case someone finds anything unusual.

Jmeter 5.5 ff9866a
Microsoft Windows 10 Pro 64-bit
java version "15.0.1" 2020-10-20
Comment 7 Felix Schumacher 2021-08-23 09:50:38 UTC
Bugs can be re-opened, if there are not fixed correctly :)
Comment 8 The ASF infrastructure team 2022-09-24 20:38:21 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5452