Hi This is Amit Working as a Testing Engineer
Is there any feature of Datapool in OpenSta Performane Testing tool
You can create the data files (.fvr) and can use them in your scripts.
Please follow following steps:
(1) First make the files
You need to make one file for the logins (users.FVR) and one for the passwords (passwords.FVR). They are plain ascii files with one entry per line. The users.FVR file might look like
And the passwords.FVR might look like
Don't put in any spaces and do not have a newline after the last entry in the file
(2) Next you must place the files
They should be in the directory called "Data" in you repository location (default is thus: "C:\Program Files\OpenSTA\Repository\Data" )
(3) Then you must define the files as variables
In the Definitions section of your SCL file write the following
CHARACTER*512 fileuser, FILE = "users", SCRIPT
CHARACTER*512 filepassword, FILE = "passwords", SCRIPT
CHARACTER*100 currentUsername, LOCAL
CHARACTER*100 currentPassword, LOCAL
(4) Synchronize users/passwords with a mutex
In the code section, just before you need to use the new login/password, add these lines:
ACQUIRE MUTEX "Login"
SET currentusername = fileuser
SET currentpassword = filepassword
! LOG "User: ", fileuser, " - Password: ", filepassword
LOG "User: ", currentUsername, " - Password: ", currentPassword
RELEASE MUTEX "Login"
The mutex will synchronize the logins with the passwords
(5) Replace normal code with your new variables
In the code section, replace the normal login and password text with your two variables: currentUsername and currentPassword
I got above information at following link,
Read on for more information.
I would also add, not to forget, that if your current implementation in SCL tends to cost too much, then it's a time to consider writing helping web-services to make business logic clearer.
Applying to your case: It means that, if you are not allowed to connect to database directly using SCL, and you ought to duplicate your data with creating plain files, storing this data... and so on. Than you don't really have to implement it such way.
Better follow your previously invented business logic, and catch the data from database virtually(using additional web-service, which can talk to database). And your implementation wouldn't suffer from a lack of capabilities of poor SCL. That is, mostly there're no such complex problems, you cannot solve with OSTA.
As a small remark to my previous post. The suggested way does work good, but keep in mind, that you send a HTTP request each time, when you want to make SQL query. Hence, sometimes that can be much slower, than direct file access as QA_Engg described. And that is, you would likely not be glad to have some "fake" reports after OSTA testrun completed (mostly, high performance tests).
And here is the most delicate part of all the stuff. The desicion is to fill up some static arrays by "starter script" and proceed with test execution. This is the first script to be executed before other scripts.
Some implementation hints:
1. Generate database responses in XML, to use
LOAD RESPONSE_INFO BODY ON port &
INTO element &
,WITH "<ROOT(0)>/<ELEMENT(" + i + ")>"
2. Use "ON ERROR GOTO label" after LOAD statement to proceed with new requests to database (because some "i" would exceed number of records [here ELEMENT tags], generated by your web-tool and error will be risen)
3. Keep counters of elements read from response. They will mean right boundary of an array in future (number of elements).
Note: you can not declare dynamic arrays in OSTA, so you will have to use some constant value for right boundary in their definition.
4. Use THREAD scope to call many scripts from a script. This is as good as using script parameters. That is - you will have some shared data across a caller and a callee scripts.
remark to clause "2" of hints:
ON ERROR doesn't work properly sometimes (in loops), as I found it recently =/
Better get status of LOAD operation:
LOAD RESPONSE_INFO BODY ON port &
INTO myResponseBody &
,WITH myDOMaddress &
,RETURNING STATUS state
and compare state with -1:
If (state < 0) Then