VB code for global declarations
I am writing some VB code for a page. How can you globally declare variables in VB?
I have the scripts in the following order: 1 in Prolog, 2 in run, and 1 in Epilog.
This user defined profile will be run for n number of iterations. The scenario I want to construct is as follows:
Prolog: User logs in
Script 1: Looks for a particular link in this page (the link value, which is a string is read from a file).
Script 2: If a match is found, it proceeds to the next script. Performs tasks.
Epilog: Logs out.
I am initialising a counter (I = 0) in Script 1. I is increased by 1 if the link is found. I want this value of I to be remembered in the next iteration such that I does nto start from 0 in the next iteration. but this is not the case .. Everytime I run the iterations, I gets reset to 0. If I can globally set declare I and pass it to each page, then the problem will be solved i think ...
Is there a sample code I could use, or how would you suggest I overcome this problem.
Re: VB code for global declarations
If you declare a variable in the shared module as public it retains it life over iterations of the script. I am not sure if this works between scripts in a user-defined profile.
Another option I can think of is to write the value to a file, which can be problematic when running a load test because of concurrency of users writing and reading from a file, so maybe a database is better.