This article takes the login user name and password as an example
1 Create a csv file
- Create a .csv file, separating the username and password with a comma
Figure 1 Create a csv file
2 Add and configure CSV Data Set Config in the thread group
- Add CSV Data Set Config
Figure 2 Add CSV Data Set Config
- Configure CSV Data Set Config
Figure 3 Configure CSV Data Set Config
- Filename: refers to the file directory where the information is saved, which can be a relative or absolute path. Otherwise, it will prompt in the jmeter log file (jmeter.log directory location D: \ Program Files \ apache-jmeter-2.13 \ bin): The system cannot find the specified file. After running the script, the login fails.
- File encoding: Keep the default. The default is ANSI
- Variable Names: Give a name to each column in the csv file (if there are multiple columns, separate the column names with commas) for easy reference later
- Delimiter: consistent with the delimiter of .csv file. If the file is separated by commas, fill in commas; if you use TAB, fill in \ t;
- Allow quoted data?: Whether to allow quoted data, --- this is not yet understood, set to True or False can normally quote data.
- Recycle on EOF ?: Whether to cycle at the end of the file, True—continue reading from the first line of the file, False—do not recycle
- Stop thread on EOF ?: Whether to stop the thread at the end of the file, True—stop, False—do not stop. Note: When Recycle on EOF is set to True, this setting is invalid.
- Sharing mode: Sharing mode, All threads-all threads, Current thread group-current thread group, Current thread-current thread.
² All threads: All threads in the plan, if there are threads 1 to n (n> 1), after thread 1 takes a value, when thread 2 takes a value, the next line in the csv file is taken, that is, and Thread 1 does not take the same line.
² Current thread group: The current thread group, assuming there are thread group A and thread group B, there are threads A1 to thread An in group A, and threads B1 to Bn in thread group B. The situation is: thread A1 gets the first line, thread A2 gets the second line, now B1 gets the first line, and thread B2 gets the second line.
² Current thread: Current thread. Assuming that there are threads 1 to n (n> 1) in the test plan, thread 1 takes line 1 and thread 2 also takes line 1.
3 Reference the data in the csv file
Figure 4 Referencing the data in the csv file
- Find the HTTP request that needs to pass parameters
- Change the specific value to variable reference, reference variable: $ {variable name}
Figure 5 Change specific value to variable reference
- In the view result tree, view the specific value of the variable reference
Figure 6 Check the specific value of the variable reference
Reference blog post: https://www.cnblogs.com/pandaly/p/8468884.html