need to run while loop for multiple users in jmeter - while-loop

I am using jmeter to test the performance for the ride booking app.I need to run the while controller which runs the events fetching api continuously until the ride is completed or if driver is not available. This runs correctly for one user .But if i run the plan for multiple users then the while controller enters infinite loop.How can I fix this?

While Controller is being executed unless its condition (a Function or Variable) resolves to true
If it runs into an endless loop - most probably your server responds with something you don't expect, i.e. an error because it gets overloaded.
So I would suggest taking 2 actions:
Temporarily enable storing of responses into .jtl or a separate file and inspect what does the server return and amend your While Controller's condition accordingly
And/or limit maximum number of iterations of the While Controller to some reasonable number, i.e. 10 or 20 or whatever is acceptable value, example __jexl3() function
${__jexl3("${status}" != "running" && ${__jm__While Controller__idx} < 20,)}

Related

Blocking invoice creating in background (using programs YV60SBAT - SDBILLDL)

While creating an invoice through YV60SBAT-SDBILLDL via job - we have to do some checks.
If some of these custom checks don't pass, we should restrict the system not to create an invoice for that particular document and should continue for the rest of the documents. Also, that error message should be displayed in batch job log..
Here is an example:
Delivery documents: say 1,2,3
1-Invoice should generate
2-Invoice should not get generate because some check doesn't pass
3-Invoice should generate...
I've tried with Enhancement spot ES_SAPLV60A Point fakturaposi_auftragspositio_02 and set us_rc = 4 and RETURN (include LV60AA29), as found on some forum .. but the system doesn't access this code.

runtimeservice.getVariables does not work because it can't find process instance id

I'm new to flowable and I'm trying to start a process instance with variables. params here is the Map of <String,Object> that I'm using to start the process. It all goes well, but if I try to get my variables back it tells me
"execution 22f42f67-5f88-11e9-9df0-d46d6dbfea92 doesn't exist"
But if I search for it in my process instances list, is there. This is what I do:
pi = runtimeService.startProcessInstanceById(processDefinitionId, params);
runtimeService.getVariables(pi.getId());
I'm stuck with this problem and I do not understand why it keeps doing this. What am I missing?
Flowable has the concept of RuntimeService and HistoryService. The first one contains only the runtime data (what is currently active) and the second one has all the data. The runtime data is a subset of the history data.
The reason why you can’t find the variables via the RuntimeService is due to the fact that the process is completed.
If you use the HistoryService then it would work as expected.

Ecommerce plugin development - how to periodically check the platform DB and call external API

I'm developing a module for Prestashop and I'll make a premise valid for Prestashop development environment: a module/plugin can do it's work thanks to some hooks, like Header, or leftBar, or BackOffice header loading, so apparently there is no way to do what I want to do:
I want to periodically (let's say each day) check for abandoned cart in Prestashop database and send their information to external API.
I thought of a workaround which I don't like very much and it doesn't seem efficient to me: the plugin installs a custom database that will always contain one row: in that row there will be the current date.
Whenever a user visits the website the plugin checks for that value on the DB: if the date is older than today then it updates it to today's date. If the module has just updated the value then I'll do my check on the DB and the API call, else I will not do anything (for the rest of the day, because every other check on the date will fail because it's already updated).
Is there some better way to do it?
********** UPDATE **********
So exists a way: cron tasks. Now my doubt is: is it possible to integrate the cron schedule inside my plugin? I need that when someone installs my plugin then he has nothing more to do: I don't want to delegate the configuration to him through the cron tasks manager integrated on the backoffice of Prestahsop. The problem with Prestashop seems to be that unlike Wordpress where exists a unique solution to do this (https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/), there is no way to do that for a general website target, so if you want to do that inside your custom module you have to choose one cron (https://www.prestashop.com/forums/topic/564504-how-create-cron-job-from-custom-module-all-by-code/)
In my opinion the best way to do that is to use a cron or webcron.
You create a front controller on your module that do the work and you create a cron that execute the controller once a day.
How to create a front controller : http://doc.prestashop.com/display/PS16/Displaying+content+on+the+front+office#Displayingcontentonthefrontoffice-Embeddingatemplateinthetheme
if you call your controller cron, you can call it
by http for webcron: http://your.shop/module/[module-name]/cron
by shell for crontab :
php -f [shop-folder]index.php "fc=module&module=[module-name]&controller=cron"
You can also use a cron-like system based on user visits but I will not recommend this solution if :
your task could be long : it could slow down the shop for the visitor and you are dependent of the web server time limit
the timing is important : your task will run when and if you have a visit on your site
the uniqueness is important : your task can be called twice if you have two visits at the same time
There is no built-in solution, there are modules for that but it will not solve your issue, the customer will have to install them.
my solution is to hook on the footer
public function hookFooter()
{
// run cron every 12 hours
$limit = time() - 12 * 60 * 60;
$lastrun = Configuration::get('[module-name]-lastrun');
if ($lastrun < $limit) {
return '<script src="http://your.shop/module/[module-name]/cron" async></script>';
}
}
and in your cron controller
$limit = time() - 12 * 60 * 60;
$lastrun = Configuration::get('[module-name]-lastrun');
if ($lastrun < $limit) {
Configuration::updateValue('[module-name]-lastrun', time());
// do stuff
}

Selenium Timing issue: form fields are not filled correctly

I am using clj-webdriver to fill out a form in my test case.
(quick-fill-submit {"#firstname" "Firstnam"}
{"#lastname" "Lastnaem"}
{"#username" "Username"}
{"#password" "Password"}
{"#password2" "Password"}
{"#roles" "user"})
(click "button#add-user")
Every time I run this code in my test case the third value is filled in blank.
I moved the fields around and verified it. It is always the third field.
When execute my test case step by step in a repl it works fine but when
running it through lein test it fails.
This seems to be some kind of timing issue. When I for example stall the
execution by adding a
(wait-until #(= 1 2) 10000)
between the two functions the field gets filled. A simple
(Thread/sleep n)
does not work in this case. Why is Selenium not filling in the form correctly?
WebDriver and AJAX calls usually require tweaking the wait settings. You should try setting implicit-wait to something bigger than 0 (which is the default). Another option would be to use wait-until and a predicate that checks for the presence of the elements.

How to remember variables with Greasemonkey script when a page reloads

Ive got an problem currently on an mobile site that i'm running directly in my pc's firefox browser. Everytime a button is clicked, the page reloads, thus resetting my variables. I've got this script:
// ==UserScript==
// #name trada.net autoclick 55_1min_mobile
// #namespace airtimeauction auto click
// #include http://www.trada.net/Mobile/
// #version 0.1
// #description Automatically click // ==/UserScript==
var interval = 57000;
var bidClickTimer = setInterval (function() {BidClick (); }, interval);
var numBidClicks = 0;
function BidClick ()
{var bidBtn1=document.getElementById("ctl00_mainContentPlaceholder_AirtimeAuctionItem7_btn_bidNow");
numBidClicks++;
if (numBidClicks > 500)
{
clearInterval (bidClickTimer);
bidClickTimer = "";
}
else
{
bidBtn1.click (1);
}
};
BidClick();
It should click the button every 57 seconds, but the moment it clicks the button, the page reloads, thus resetting the variables. How can i get greasemonkey to "remember" or carry over the variables to the next page/script when it reloads? Will it have something to do with GM_setValue? It will only be this few variables, but the second problem or question wil be, will it subtract the few seconds it takes the page to reload from the "57" seconds? How do i compensate for that?
In addition to GM_setValue...
you also can use the new Javascript "localStorage" object, or a SQL Javascript API.
The advantage of the SQL approach is it is very meager in its resource consumption in a script (think about it; rather than concatenating a humongous string of results, you can tuck away each result and recall it if needed with a precise query. The downside is you have to set up a SQL server, but using something like SQLite that's not a big deal these days. Even postgres or mysql can be quickly spun on a laptop...
Yes, I think you have to use GM_setValue/GM_getValue.
And if you have to do something exactly every 57 seconds, then calculate the time when the next action should take place after the reload, and store it using GM_setValue.
When your script starts, read first if the next action is stored, if it is, use that time to schedule the next action, and calculate the time for the action after that, and so on...
GM.setValue will set a value indefinitely and is scoped to the script, but will work if your script runs across multiple domains.
window.localStorage will set a value indefinitely and is scoped to the domain of the page, so will not work across domains, but will work if you need several GreaseMonkey scripts to access the same value.
window.sessionStorage will set a value only while the window or tab is open and is scoped to only that window or tab for that domain.
document.cookie can set a value indefinitely or only while the browser is open, and can be scoped across subdomains, or a single domain, or a path, or a single page.
Those are the main client-side mechanisms for storing values across page loads that are intended for this purpose. However, there is another method which is sometimes possible (if the page itself is not using it), and can also be quite useful; window.name.
window.name is scoped to the window or tab, but will work across domains too. If you need to store several values, then they can be put into an object and you can store the object's JSON string. E.g. window.name = JSON.stringify(obj)