When LR was recording a website registration script, it suddenly encountered a problem: during registration, the registered user needs to verify the uniqueness, so when LR played back the script, you can use the run-time Viewer tool to play back and find that (several breakpoints are set in the script first) the registered script user that actually runs is not successfully registered,
How can this problem be solved?
Of course, I first thought of the script parameterization settings, so I wrote a piece of code, run the script to let it randomly generate a user name (User Name specified format), and then write a dat file, import the DAT file in the parameter settings. The Code is as follows:
/* Author: luihengk */INT I, j, k; char C [250]; char * filename = "C: \ scripts \ test. dat "; long file; If (file = fopen (filename," A + ") = NULL) {lr_output_message (" uncreate a file % s ", filename ); return-1;} web_set_max_html_param_len ("1024000"); for (I = 0; I <= 10; I ++) {k = rand () * 10; sprintf (C, "% d", k); // int to Char strcat (C, "[email protected]"); // append [email protected] to C fprintf (file, "% s \ n", c);} fclose (File );
Import parameter list:
Note: Select next row is set to unique, and update value on is set to each iteration. Here, some data must be kept in the parameterized list. I have set 100 records here.
Set parameterization in the script:
After the preceding settings are complete, you can play back the script again to avoid registration failure. Although no error is reported in the replay log, run-time viewer is used to confirm the error.