You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2015/12/13 18:02:21 UTC
svn commit: r1719806 -
/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
Author: pmouawad
Date: Sun Dec 13 17:02:21 2015
New Revision: 1719806
URL: http://svn.apache.org/viewvc?rev=1719806&view=rev
Log:
bug 52968 added a call to processSampler in order to mark the
transaction sampler in error and generate the associated sampler result.
Add an explanation for that and extract that code in a dedicated method
to make clear that the triggerEndOfLoopOnParentControllers will not
process any new sampler
#resolve #56
Modified:
jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1719806&r1=1719805&r2=1719806&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Sun Dec 13 17:02:21 2015
@@ -330,8 +330,9 @@ public class JMeterThread implements Run
pathToRootTraverser = new FindTestElementsUpToRootTraverser(sam);
}
testTree.traverse(pathToRootTraverser);
- List<Controller> controllersToReinit = pathToRootTraverser.getControllersToRoot();
+
// Trigger end of loop condition on all parent controllers of current sampler
+ List<Controller> controllersToReinit = pathToRootTraverser.getControllersToRoot();
for (Controller parentController : controllersToReinit) {
if(parentController instanceof AbstractThreadGroup) {
AbstractThreadGroup tg = (AbstractThreadGroup) parentController;
@@ -340,8 +341,14 @@ public class JMeterThread implements Run
parentController.triggerEndOfLoop();
}
}
+
+ // bug 52968
+ // When using Start Next Loop option combined to TransactionController.
+ // if an error occurs in a Sample (child of TransactionController)
+ // then we still need to report the Transaction in error (and create the sample result)
if(transactionSampler != null) {
- processSampler(transactionSampler, null, threadContext);
+ SamplePackage transactionPack = compiler.configureTransactionSampler(transactionSampler);
+ doEndTransactionSampler(transactionSampler, null, transactionPack, threadContext);
}
}
@@ -369,19 +376,10 @@ public class JMeterThread implements Run
// Check if the transaction is done
if(transactionSampler.isTransactionDone()) {
- // Get the transaction sample result
- transactionResult = transactionSampler.getTransactionResult();
- transactionResult.setThreadName(threadName);
- transactionResult.setGroupThreads(threadGroup.getNumberOfThreads());
- transactionResult.setAllThreads(JMeterContextService.getNumberOfThreads());
-
- // Check assertions for the transaction sample
- checkAssertions(transactionPack.getAssertions(), transactionResult, threadContext);
- // Notify listeners with the transaction sample result
- if (!(parent instanceof TransactionSampler)) {
- notifyListeners(transactionPack.getSampleListeners(), transactionResult);
- }
- compiler.done(transactionPack);
+ transactionResult = doEndTransactionSampler(transactionSampler,
+ parent,
+ transactionPack,
+ threadContext);
// Transaction is done, we do not have a sampler to sample
current = null;
}
@@ -393,7 +391,7 @@ public class JMeterThread implements Run
SampleResult res = processSampler(current, prev, threadContext);// recursive call
threadContext.setCurrentSampler(prev);
current = null;
- if (res != null){
+ if (res != null) {
transactionSampler.addSubSamplerResult(res);
}
}
@@ -485,6 +483,28 @@ public class JMeterThread implements Run
return transactionResult;
}
+ private SampleResult doEndTransactionSampler(
+ TransactionSampler transactionSampler,
+ Sampler parent,
+ SamplePackage transactionPack,
+ JMeterContext threadContext) {
+ SampleResult transactionResult;
+ // Get the transaction sample result
+ transactionResult = transactionSampler.getTransactionResult();
+ transactionResult.setThreadName(threadName);
+ transactionResult.setGroupThreads(threadGroup.getNumberOfThreads());
+ transactionResult.setAllThreads(JMeterContextService.getNumberOfThreads());
+
+ // Check assertions for the transaction sample
+ checkAssertions(transactionPack.getAssertions(), transactionResult, threadContext);
+ // Notify listeners with the transaction sample result
+ if (!(parent instanceof TransactionSampler)) {
+ notifyListeners(transactionPack.getSampleListeners(), transactionResult);
+ }
+ compiler.done(transactionPack);
+ return transactionResult;
+ }
+
/**
* Get the SampleListeners for the sampler. Listeners who receive transaction sample
* will not be in this list.