diff --git a/site/dat/wiki/HttpSimpleTableServer.md b/site/dat/wiki/HttpSimpleTableServer.md index 7567d0991..fe9265ccd 100644 --- a/site/dat/wiki/HttpSimpleTableServer.md +++ b/site/dat/wiki/HttpSimpleTableServer.md @@ -9,7 +9,8 @@ Unfortunately the dataset and csv files aren't transferred from the controller t The main idea is to use a tiny http server in JMeter Plugins to manage the dataset files with simple commands to get / find / add rows of data in files. -An article about this tool : https://dzone.com/articles/jmeter-plugin-http-simple-table-server
+A dzone.com article about this tool : [https://dzone.com/articles/jmeter-plugin-http-simple-table-server](https://dzone.com/articles/jmeter-plugin-http-simple-table-server)
+ "Take an in-depth look to discover some of the possibilities of using the HTTP Simple Table Server a JMeter Plugin in this short manual." ## Configuration @@ -27,9 +28,10 @@ jmeterPlugin.sts.charsetEncodingHttpResponse=UTF-8 jmeterPlugin.sts.charsetEncodingReadFile=UTF-8 jmeterPlugin.sts.charsetEncodingWriteFile=UTF-8 +# Load files at startup jmeterPlugin.sts.initFileAtStartup=article.csv,users.csv jmeterPlugin.sts.initFileAtStartupRegex=false - +# OR jmeterPlugin.sts.initFileAtStartup=file\d+\.csv jmeterPlugin.sts.initFileAtStartupRegex=true @@ -66,7 +68,9 @@ There are different ways to start the STS: ![](/img/wiki/http_simple_table_server.png) -2. With simple-table-server.cmd (.sh for UNIX) script located in your JMETER_HOME/bin directory. Parameters are read in the jmeter.properties or you could also set parameters like simple-table-server.cmd -DjmeterPlugin.sts.addTimestamp=true -DjmeterPlugin.sts.datasetDirectory=D:/jmeter/dataset, set jmeterPlugin.sts.daemon=true when you want launch the STS with the nohup linux command like process daemon, the STS will not waiting the key to stop. + +2. With simple-table-server.cmd (.sh for UNIX) script located in your JMETER_HOME/bin directory. Parameters are read in the jmeter.properties or you could also set parameters like simple-table-server.cmd -DjmeterPlugin.sts.addTimestamp=true -DjmeterPlugin.sts.datasetDirectory=D:/jmeter/dataset, set jmeterPlugin.sts.daemon=true when you want launch the STS with the nohup linux command like process daemon, the STS will not waiting the <ENTER> key to stop. + 3. On JMeter CLI startup (Windows : jmeter-n.cmd or Linux jmeter -n) following properties in jmeter.properties file or in user.properties : ```text @@ -89,7 +93,7 @@ http://hostname:port/sts/ ``` When the STS is running go to `http://:/sts/` to **see all available commands** and a short help. -Usually `http://localhost:9191/sts/` +Usually Help at [http://localhost:9191/sts/](http://localhost:9191/sts/) ## INITFILE @@ -161,7 +165,7 @@ read all csv files in the dataset directory the jmeterPlugin.sts.initFileAtStart **Get one line from list** -The charset use in the response is jmeterPlugin.sts.charsetEncodingHttpResponse=, default value = JMeter property : sampleresult.default.encoding +The charset use in the response is jmeterPlugin.sts.charsetEncodingHttpResponse=<charset>, default value = JMeter property : sampleresult.default.encoding ``` http://hostname:port/sts/READ?READ_MODE={FIRST, LAST, RANDOM}&KEEP={TRUE, FALSE}&FILENAME=logins.csv @@ -177,10 +181,10 @@ HTML format: Available options: - READ_MODE=FIRST => login1;password1 -- READ_MODE=LAST => login5;password5 -- READ_MODE=RANDOM => login?;password? -- KEEP=TRUE => the data is kept and put to the end of list -- KEEP=FALSE => the data is removed + - READ_MODE=LAST => login5;password5 + - READ_MODE=RANDOM => login?;password? + - KEEP=TRUE => the data is kept and put to the end of list + - KEEP=FALSE => the data is removed KEEP=TRUE, READ_MODE=FIRST => login1;password1 @@ -256,12 +260,12 @@ login5;password5 **Get multi lines from list in one request** Available options: -- NB_LINES=Number of lines to read : 1 \<= Nb lines (Integer) and Nb lines \<= list size -- READ_MODE=FIRST =>start to read at the first line -- READ_MODE=LAST => start to read at the last line (reverse) -- READ_MODE=RANDOM => read n lines randomly -- KEEP=TRUE => the data is kept and put to the end of list -- KEEP=FALSE => the data is removed + - NB_LINES=Number of lines to read : 1 \<= Nb lines (Integer) and Nb lines \<= list size + - READ_MODE=FIRST =>start to read at the first line + - READ_MODE=LAST => start to read at the last line (reverse) + - READ_MODE=RANDOM => read n lines randomly + - KEEP=TRUE => the data is kept and put to the end of list + - KEEP=FALSE => the data is removed GET Protocol @@ -332,11 +336,11 @@ HTML format: ``` Available options: -- ADD_MODE=FIRST => add to the top -- ADD_MODE=LAST => add to the end -- FILENAME=dossier.csv => if doesn't already exist it creates a LinkedList in memory -- LINE=1234;98763 => the line to add -- UNIQUE=TRUE => do not add line if the list already contains such line (if already exits then return title KO and don't add the same line) + - ADD_MODE=FIRST => add to the top + - ADD_MODE=LAST => add to the end + - FILENAME=dossier.csv => if doesn't already exist it creates a LinkedList in memory + - LINE=1234;98763 => the line to add + - UNIQUE=TRUE => do not add line if the list already contains such line (if already exits then return title KO and don't add the same line) POST Protocol with parameters ![](/img/wiki/http_sts_add_request.png) @@ -346,10 +350,10 @@ POST Protocol with parameters **Find a line in a file (GET OR POST HTTP protocol)** The LINE to find is for FIND_MODE : -- A string this SUBSTRING (Default, ALineInTheFile contains the stringToFind ) or EQUALS (stringToFind == ALineInTheFile) -- A regular expression with REGEX\_FIND (contains) and REGEX\_MATCH (entire region the pattern) -- KEEP=TRUE => the data is kept and put to the end of list -- KEEP=FALSE => the data is removed + - A string this SUBSTRING (Default, ALineInTheFile contains the stringToFind ) or EQUALS (stringToFind == ALineInTheFile) + - A regular expression with REGEX\_FIND (contains) and REGEX\_MATCH (entire region the pattern) + - KEEP=TRUE => the data is kept and put to the end of list + - KEEP=FALSE => the data is removed GET Protocol @@ -421,13 +425,13 @@ dossier.csv = 1
**Save the specified linked list in a file to the specified location** -The charset use to write the file is set with jmeterPlugin.sts.charsetEncodingWriteFile=\, default value = System property : file.encoding +The charset use to write the file is set with jmeterPlugin.sts.charsetEncodingWriteFile=<charset>, default value = System property : file.encoding ``` http://hostname:port/sts/SAVE?FILENAME=logins.csv ``` -If jmeterPlugin.sts.addTimestamp is set to true then a timestamp will be add to the filename,
+If jmeterPlugin.sts.addTimestamp is set to true then a timestamp will be added to the filename,
the file is stored in the custom directory specified by editing the jmeterPlugin.sts.datasetDirectory property or in JMETER_HOME/bin directory by default: ``` @@ -473,7 +477,7 @@ Always returns title OK even if the file did not exist http://hostname:port/sts/STOP ``` -When the jmeterPlugin.sts.daemon=true, you need to call `http://hostname:port/sts/STOP` or kill the process to stop the STS +When the jmeterPlugin.sts.daemon=true, you need to call `http://hostname:port/sts/STOP` or kill the process to stop the STS ## CONFIG @@ -524,12 +528,12 @@ else { ## Examples -- Put the logins.csv file in your JMETER_HOME/bin directory: + - Put the logins.csv file in your JMETER_HOME/bin directory: [Download logins.csv file](/img/examples/logins.csv) -- Run the Simple Table Server manually with the simple-table-server.cmd file or automatically with groovy configuration. -- Run one of the following scripts: + - Run the Simple Table Server manually with the simple-table-server.cmd file or automatically with groovy configuration. + - Run one of the following scripts: In a loop, read random values from a file containing a login and a password at each row: @@ -548,26 +552,25 @@ Add rows in a new linked list and save it in a file when the test is done: -Read in a random mode a dataset located on the controller machine with severals slaves. -The first injector loads the dataset in memory while the other injectors are waiting few seconds (you could also use jmeterPlugin.sts.initFileAtStartup=file1.csv,file2.csv and jmeterPlugin.sts.initFileAtStartupRegex=false to read files when STS startup) -The different injectors read randomly the data containing logins and passwords. -When the test is done the first injector save the values in a file with a timestamp as prefix: +Read in a random mode a dataset located on the controller machine with severals slaves.
+The first injector loads the dataset in memory while the other injectors are waiting few seconds (you could also use jmeterPlugin.sts.initFileAtStartup=file1.csv,file2.csv and jmeterPlugin.sts.initFileAtStartupRegex=false to read files when STS startup)
+The different injectors read randomly the data containing logins and passwords.
+When the test is done the first injector save the values in a file with a timestamp as prefix:
[Download Example Test Plan 4](/img/examples/demo_sts_read_random_for2slaves.jmx) Multi JMeter injectors and save list examples You can override STS settings using command-line options: -- -DjmeterPlugin.sts.port=\ -- -DjmeterPlugin.sts.loadAndRunOnStartup=\ -- -DjmeterPlugin.sts.datasetDirectory=\ -- -DjmeterPlugin.sts.addTimestamp=\ -- -DjmeterPlugin.sts.daemon=\ -- -DjmeterPlugin.sts.charsetEncodingHttpResponse=\ -- -DjmeterPlugin.sts.charsetEncodingReadFile=\ -- -DjmeterPlugin.sts.charsetEncodingWriteFile=\ -- -DjmeterPlugin.sts.initFileAtStartup=\ -- -DjmeterPlugin.sts.initFileAtStartupRegex=false=\ + - -DjmeterPlugin.sts.port=<port number> + - -DjmeterPlugin.sts.loadAndRunOnStartup=<true/false> + - -DjmeterPlugin.sts.datasetDirectory=<path/to/your/directory> + - -DjmeterPlugin.sts.addTimestamp=<true/false> + - -DjmeterPlugin.sts.daemon=<true/false> + - -DjmeterPlugin.sts.charsetEncodingHttpResponse=<charset like UTF-8> + - -DjmeterPlugin.sts.charsetEncodingReadFile=<charset like UTF-8> + - -DjmeterPlugin.sts.charsetEncodingWriteFile=<charset like UTF-8> + - -DjmeterPlugin.sts.initFileAtStartup=<files to read when STS startup, e.g : article.csv,users.csv> + - -DjmeterPlugin.sts.initFileAtStartupRegex=<true/false> false : no regular expression, files with comma separator, true : read files matching the regular expression. - ``` jmeter.bat -DjmeterPlugin.sts.loadAndRunOnStartup=true -DjmeterPlugin.sts.port=9191 -DjmeterPlugin.sts.datasetDirectory=d:/data -DjmeterPlugin.sts.charsetEncodingReadFile=UTF-8 -n –t testdemo.jmx ``` @@ -576,11 +579,11 @@ When it's done see results in the Listener Tree View. ## JMETER MAVEN PLUGIN If you want to use the Http Simple Server with the **JMeter Maven plugin**, you could : -- Put your csv files in /src/test/jmeter directory (e.g : logins.csv) -- Put the simple-table-server.groovy (groovy script) in /src/test/jmeter directory -- Put the your jmeter script in /src/test/jmeter directory (e.g : test_login.jmx) -- Declare in the maven build section, in the configuration > jmeterExtensions > declare the artifact kg.apc:jmeter-plugins-table-server: -- Declare user properties for STS configuration and automatic start + - Put your csv files in /src/test/jmeter directory (e.g : logins.csv) + - Put the simple-table-server.groovy (groovy script) in /src/test/jmeter directory + - Put the your jmeter script in /src/test/jmeter directory (e.g : test_login.jmx) + - Declare in the maven build section, in the configuration > jmeterExtensions > declare the artifact kg.apc:jmeter-plugins-table-server: + - Declare user properties for STS configuration and automatic start Extract pom.xml dedicated to Http Simple Table Server : @@ -610,11 +613,11 @@ Extract pom.xml dedicated to Http Simple Table Server : ``` -Link to JMeter Maven plugin : https://github.com/jmeter-maven-plugin/jmeter-maven-plugin +Link to JMeter Maven plugin : [https://github.com/jmeter-maven-plugin/jmeter-maven-plugin](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin) ## STS ALONE The Http Simple Table Server (STS) exist in external tool (.jar) without the need of JMeter.
-https://github.com/vdaburon/simple-table-server-alone
+[Link to https://github.com/vdaburon/simple-table-server-alone](https://github.com/vdaburon/simple-table-server-alone)
Alone because this tool don't need Apache JMeter, it works by itself or alone. ## VERSIONS