Using dynamic array structures (Performance Testing, NeoLoad)

Posted by Albert Gareev on Aug 15, 2012 | Categories: How toLoad/PerformanceNeoLoad

Parent page: Load/Performance Testing with NeoLoad

Load scripts are typically linear: they’re intended to generate a load, not to cover sophisticated logical scenarios checked by functional automation and explored by skilled testers. For this reason, load scripts rarely contain complex code branches and loops. Yet there are functional scenarios that are part of the load, for example, bulk operations. Implementing such scenarios still requires iterating and dynamically extracting and storing data in array-like structures. I’m going to use one of such scenarios to illustrate how to implement dynamic arrays with NeoLoad JavaScript.

Let’s again use hypothetical online payment system with a particular user workflow:

  • Post 10 transactions
  • Cancel them using “Cancel All” functionality

In NeoLoad’s treeview,  the sequence of requests will be presented in the following container:

Assuming that users may post transactions of different kinds, I created 10 different sub-containers – one per transaction type.

Each transaction request, accepted by the server side, receives a response with unique “Transaction ID”, which is generated dynamically and can’t be hard-coded. So we need to extract that value from the response and store it in a variable.

But storing Transaction ID in a single variable means that we’ll have only single value at the end. We need to store values from the whole sequence to access all of them. For that purpose, each Transaction container has “AddTransactionIDToArray” sub-container with a JavaScript node.

As a result, we’ll have a number of dynamically created variables “IDArrayItem_1″..”IDArrayItem_N”, where “N” – is the number of times  “AddTransactionIDToArray” JavaScript node was executed. And we’ll have that “N” stored in “IDArrayCounter”.
– And this is how many times we’re going to execute cancellation loop, which discards transactions one by one.

Preceeding the each “CancelTransaction” call, a JavaScript node is executed that prepares “TransactionID” variable and logs the values.

  • Leave a Reply

    * Required
    ** Your Email is never shared

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.