jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From UBIK LOAD PACK Support <supp...@ubikloadpack.com>
Subject Re: Using localStorage in JMeter
Date Thu, 15 Dec 2016 15:51:06 GMT
Hello,
JMeter is not a browser, so it does not interpret Javascript.

It works on protocol level. You javascript here will end up sending a
request to the server, that's where the information will be available.
If you need to provide this to the request then you will use a CSV Data Set
(and a CSV file containing the names) and variables to send it:
- http://jmeter.apache.org/usermanual/functions.html#functions
-
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config

If you need to extract it from a response, you will use Extractors (CSS/
JQuery extractor, JSON-Path, XPath or regex):
-
http://jmeter.apache.org/usermanual/component_reference.html#postprocessors


Another option if you don't have much load to inject is to use WebDriver
and a plugin for it from jmeter-plugins.org

Regards
@ubikloadpack

On Thu, Dec 15, 2016 at 3:26 PM, Jean-Sebastien Vachon <vachonjs@gmail.com>
wrote:

> Hi All,
>
> I am trying to build a test suite to test the performance of one of our
> system and I need to provide some information to each thread so that the
> following code will work...
>
>   <script type="application/javascript">
>         var getName = function() {
>             var name;
>             try {
>                 name = window.localStorage.getItem("user-name");
>             } catch(error) {
>                 console.log(error);
>             }
>             if(!name) {
>                 name = window.prompt("What's your name, please ?", "Rachel
> Smith");
>             ...
>
>
> I tried setting a cookie using the CookieManager but I can not get it to
> pass a predefined value.
>
> Is there a way to put something in the localStorage so that the javascript
> code will see it and proceed?
>
> Thanks
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message