ham1 commented on code in PR #6884:
URL: https://github.com/apache/jmeter/pull/6884#discussion_r4739333937
##########
src/components/src/test/java/org/apache/jmeter/control/TestTransactionController.java:
##########
@@ -81,4 +90,82 @@ public void testIssue57958() throws Exception {
assertEquals("Number of samples in transaction : 1, number of failing
samples : 1",
listener.getEvents().get(0).getResult().getResponseMessage());
}
+
+ /** Stops the thread before the sampler: overruns the schedule, or throws
as Precise Throughput Timer does. */
+ private static class StoppingTimer extends AbstractTestElement implements
Timer {
+ private static final long serialVersionUID = 1L;
+ private final boolean throwing;
+
+ StoppingTimer(boolean throwing) {
+ this.throwing = throwing;
+ }
+
+ @Override
+ public long delay() {
+ if (throwing) {
+ throw new JMeterStopThreadException();
+ }
+ return 60_000;
+ }
+ }
+
+ @ParameterizedTest
+ @CsvSource({"true,true", "true,false", "false,true", "false,false"})
+ void transactionWithoutExecutedSamplersIsNotReported(boolean parent,
boolean throwing) {
+ assertEquals(List.of(), run(parent, tx -> addSkippedSampler(tx,
throwing)));
+ assertEquals(List.of(),
+ run(parent, tx -> addSkippedSampler(addTransaction(tx,
"inner", parent), throwing)));
+ }
+
+ @ParameterizedTest
+ @CsvSource({"true,true", "true,false", "false,true", "false,false"})
+ void transactionWithSomeExecutedSamplersIsReported(boolean parent, boolean
throwing) {
+ List<String> labels = run(parent, tx -> {
+ tx.add(sampler("executed"));
+ addSkippedSampler(tx, throwing);
+ });
Review Comment:
Confirmed. I ran this scenario on master and on this PR's head, with both a
throwing timer and one that overruns the schedule. In non-parent mode both
report only `executed` when another child follows the skipped sampler, and
report `executed` and `transaction` when the skipped sampler is last. So this
PR doesn't change that behaviour. I'd rather fix it separately (#6892) and keep
this PR to empty transactions; I've noted the limitation in the description.
Does that work for you?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]