As part of the LoadRunner 8.1 Hands-On Lab training, there is an exercise to enhance a VuGen script that books a flight using the Mercury Tours application.
Company “A” wants the script to generate 10 digit credit card numbers instead of supplying them from an external source on every iteration and for an unlimited number of iterations.
How do you make the script generate credit card numbers for every iteration?
As the Mercury Tours application does not check if the credit card numbers conform to a valid format, the answer to this question is just to replace the file-based credit card parameter with a random parameter using a number format of %010lu.
The purpose of Mercury’s training is to cover as much of the basic concepts as possible in a short space of time, so they can’t make the exercises too hard; but I don’t like to leave people with the incorrect idea that just because they’ve finished some training they are totally prepared for the level of difficulty they will encounter in the real world.
I have created an exercise where you will need to submit different credit card numbers, but I have made it more difficult as they must be valid credit card numbers.
Start the Credit Card Validation Exercise here.
Some quick notes:
- The exercise is quite simple. If you work intelligently (and do some research), it should not take long.
- Make sure that you really do generate the cards at runtime. Finding 60 different card numbers on the web, trying card numbers at random until you find ones that work, and generating card numbers outside of LoadRunner all miss the point of the scripting exercise.
- Do not run load against my server. Don’t run more than 1 virtual user at a time and be kind with your thinktime and pacing settings.
- Please report functional defects to me via email: stuart at myloadtest dot com
- Once some people have emailed me their solution scripts, I will post some comments about my preferred solution.
Here are some credit card numbers to get you started:
- 30100000000002 (Diners)
- 30100000000010 (Diners)
- 4000000000000002 (VISA)
- 4000000000000010 (VISA)
- 5400000000000005 (MasterCard)
- 5400000000000013 (MasterCard)
- 340000000000009 (American Express)
- 340000000000017 (American Express)
On with the challenge! Press the “next” button to continue…