Sometimes when doing performance or scalability testing your application may need pre-enrolled users. Enrolling a specific amount of users can be a bit tricky with Segue SilkPerformer when you want to run multiple virtual users to get the job done quickly. Running one virtual user usually solves the typical problems but 1 virtual user when I needed 1 million enrollments was unacceptable time-wise. I recently worked through a problem where virtual users weren’t stopping when they reached the end of the file so they would cause errors to occur in the application because they were being re-enrolled. Here is the solution Mark and I came up with:
First off, I needed to list the 1 million signon IDs for Performer to enroll so that I could signon with the same IDs later. I list these in a data file. To ensure each is enrolled, Performer’s virtual users need to read the user names from the file sequentially to make sure they ALL get enrolled (IAUser1 – IAUser1,000,000). In order to tell the virtual users that they had reached the end of the file I placed an obvious string (“END”) at the end of the data file so that the first virtual user that came across it would halt. This looked like:
After I setup the data file, I then placed the following code in Init transaction (or the first transaction called by all virtual users):
//Load and pull user name from the data file
//Define a global variable that all virtual users have access to
What happens here is the first virtual user that encounters the “END” flag sets the global var nIsEnrolled1 to 1 and halts. When the next virtual users come in behind the “END” user they will have sUser set to an already enrolled user name from the beginning of the data file (for example: IAUser1). We can halt all the remaining virtual users by checking for the global var (nIsEnrolled) that the user who encountered the “END” set (since nIsEnrolled1 is set to 1 any virtual user that followed will then be halted via the if statement).
This method worked perfectly for me. The best solution? Maybe not. I’d like to hear some other solutions. Do you have one?