How to enter user input in jmeter console (without doing parameterization)

36 views Asked by At

I have to give the user input in the Jmeter console.

For example

Using scanner or other libraries i need to enter input values in the Jmeter console.

Jmeter log

Enter input : (Here i need to give input) testinputuser2

I have tried some code in jsr223 using groovy i got java i/o execption: The handle is invalid

Could you please give the best solution for this it would be good

1

There are 1 answers

1
Ivan G On

We cannot help you without seeing your "some code".

You should be able to use System.in class which provides you access to STDIN without any issues. Something like:

def userInput = System.in.withReader { reader ->
    OUT.println 'Please enter test parameter'
    reader.readLine()
}

OUT.println('You have entered: ' + userInput)

vars.put('userInput', userInput)

enter image description here

Be informed that due to multithreaded nature you wil need to provide the input for each thread (virtual user) so the suitable location for the JSR223 Sampler would be setUp Thread Group with 1 user and iteration.