Test Fragment not executing Timers or Sample Timeout - timer

I add in JMeter Test Fragment with Sample Timeout and Timers but without any Samplers.
I add a Module controller using this Test Fragment in Thread Group with Samplers in same hierarchy (before and after, also HTTP samplers).
I expected that the Timers and Sample Timeout will work on every Sample in scope but no timeout/delay is been done,
Also I notice that Sampler can be a child of Module controller but it won't be executed (or Timers).
It seems like a bug, but maybe there are scoping rules I missed?
Other Pre Processor as User Parameters are working so I wonder why timeout is ignored.

Your issue is indeed due to scoping rules.
Your Test Fragment is like a Controller, all elements it contains are applied to its scope.
Since it doesn't contain any sampler here, neither the timer nor the other pre/post processor run.
Note that ability of adding such useless elements will be removed in upcoming 4.0 version:
https://bz.apache.org/bugzilla/show_bug.cgi?id=61965

Related

Jmeter Pacing between thread group Iterations

In Jmeter (5.4.1), I have the below thread group with 1 thread. I am controlling the frequency of the transaction using the constant timer. The constant timer_pacing in the image has the required pacing. I see that during execution, the constant timer is applied for each sample request in the particular thread group.
I am expecting all the samples before the contant timer_pacing to be executed one after the other immediately.What am I doing wrong here. Please advice.
alternatively similiar setup seems to works as expected for another thread group.
If you want to add a delay between each iteration of each thread add a Flow Control Action Sampler as the first sampler and set the delay in the controller
If you want to add a random delay consider using JMeter function Random ${__Random(1000,5000,)}
All JMeter timers obey JMeter Scoping Rules so if you have Timers at the same level as Samplers - all the timers will be applied to all the Samplers
As per Timers documentation:
Note that timers are processed before each sampler in the scope in which they are found
So if you want to add a delay between defaultPhotoUrl and Submit requests you need to add a Constant Timer as a child of the "Submit" request

CodeceptJS/Puppeteer only sees elements during paused sessions

I'm having a very frustrating problem with testing a React app using CodeceptJS and puppeteer - it only finds elements with a custom locator only when in paused mode.
My custom locator is data-test-id. I'm targeting elements using I.seeElement("$id-of-element-here") and I.seeNumberOfElements("$test-id", X).
This works perfectly when my tests are paused and I'm manually moving onto each step of the test, but does not work when the tests are executing from start to finish - targeted elements are simply not found.
Sometimes I can counter this with I.wait(X) or I.refreshPage() but I'm now running into a case where none of this helps.
I do see the data-test-id attributes in the HTML using both Chrome's and Chromium's dev tools. There are no typos either.
There's not much point in showing examples of targeted elements, as the problem seems to happen at random, I haven't been able to see any pattern of where/when this happens.
These are the settings of the custom locator plugin, in codecept.conf.js:
plugins{
...
customLocator: {
enabled: true,
attribute: 'data-test-id',
},
...
}
Any help will be appreciated! :)
May waitForNavigation is a way to go?
https://codecept.io/helpers/Puppeteer/#configuration
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfornavigationoptions
Solution:
I was running the assertions in question in a rather big within block (link), so I was ending up looking for something within an element that was no longer on the page.
It appears that during a pause(), you can find and operate on elements that are visible at the moment and the within blocks don't matter.
That's the only way I can explain why, in this situation, an element can be detected during a pause but not during the actual execution of the test from start to finish.
As soon as I moved the assertions out of the within block, everything was normal and behaved as expected.
Apologies for the confusion - learning every day... :)

Jmeter: Why doesn't my thread restart after a cycle is completed?

I have the following test plan i Jmeter:
Thread group
User params
Csv DataSource
While controller
Once only controler
http sampler
http sampler
RegEx extractor (Finds the variable that is the condition in the while loop)
If controller
Http sampler
Save response to file
BeanShell Post Processor (Cleans up used variables)
Now, my issue is, when the If controller's condition is met, after the thread is done, it loops as expected.
But, when the If controller's condition is not met, after the thread is done, the run stops, and no loop occurs.
In the thread group settings i have "Loop = 50" and "Action on Error: Start next thread loops"
In the system's log, there are no errors at all.
Any ideas?
If the condition is not met the If Controller's children will not be executed and you will not see them in the jtl results file.
If you add i.e. a Dummy Sampler after the If Controller you will see that the Dummy Sampler will be executed 50x times per each virtual user.
Some more recommendations:
Since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting
According to JMeter Scoping Rules your BeanShell Post Processor will be executed after each sampler, I don't know what exactly it is doing but currently it's being executed after each Sampler so might be the case it's cleaning the variable you're using in While or If Controller.

Libev: how to schedule a callback to be called as soon as possible

I'm learning libev and I've stumbled upon this question. Assume that I want to process something as soon as possible but not now (i.e. not in the current executing function). For example I want to divide some big synchronous job into multiple pieces that will be queued so that other callbacks can fire in between. In other words I want to schedule a callback with timeout 0.
So the first idea is to use ev_timer with timeout 0. The first question is: is that efficient? Is libev capable of transforming 0 timeout timer into an efficient "call as soon as possible" job? I assume it is not.
I've been digging through libev's docs and I found other options as well:
it can artificially delay invoking the callback by using a prepare or idle watcher
So the idle watcher is probably not going to be good here because
Idle watchers trigger events when no other events of the same or higher priority are pending
Which probably is not what I want. Prepare watchers might work here. But why not check watcher? Is there any crutial difference in the context I'm talking about?
The other option these docs suggest is:
or more sneakily, by reusing an existing (stopped) watcher and pushing it into the pending queue:
ev_set_cb (watcher, callback);
ev_feed_event (EV_A_ watcher, 0);
But that would require to always have a stopped watcher. Also since I don't know a priori how many calls I want to schedule at the same time then I would have to have multiple watchers and additionally keep track of them via some kind of list and increase it when needed.
So am I on the right track? Are these all possibilities or am I missing something simple?
You may want to check out the ev_prepare watcher. That one is scheduled for execution as the last handler in the given event loop iteration. It can be used for 'Execute this task ASAP' implementations. You can create dedicated watcher for each task you want to execute, or you can implement a queue with a one prepare watcher that is started once queue contains at least one task.
Alternatively, you can implement similar mechanism using ev_idle watcher, but this time, it will be executed only if the application doesn't process any 'higher priority' watcher handlers.

AngularJS 1.4 avoid multiple digest calls and maximum call stack

I'm working in an angular app where Projects have many Parts, and the data structure is being fetched from the server. In Angular, parts don't have a project attribute, just the project_id. Projects have a commission_rate, and I need access to that in order to calculate the actual commission, and total price for a given part.
My thought was to assign the project to each part when the project is fetched from the server. I tried doing the following:
angular.forEach(project.parts, function(part) {
part.project = project;
});
but I get a massive amount of Max call size stack exceeded, and 10 digest loops reached errors.
I've also tried using $.extend to shallow copy the project and assign that to part.project, but the end result is the same.
Any insight would be greatly appreciated.
Because you only provide this small code fragment all I can do is to tell you what I would look for:
In angular's $digest loop all watcher functions are called and the values are compared with their prior state. Angular than repeats the digest loop to make sure there are no changes introduced by the watcher functions themselves. This loop will be continued until no more changes are detected or the loop counter reaches 10. Than angular gives up. (This mechanism is called dirty-checking)
I would try to change your project object before any bindings apply, this could be inside the success function of your $http promise.

Resources