Search code examples
stringfilejmetersolutionextractor

Jmeter Extractor to recover string into a file


I would like to know if someone knows the solution to recover a string into a file with Jmeter (the string could change each time into the file then is not static). I have a file like this:

device-data-pdaa: image: acrsit.pippo.io/common/pippo-data-pippo-go-arm64:11.0.0 container_name: go-data-sim hostname: new-data-sim networks:

I need to take the value after image: until the end of the line (dynamic string in bold) Important: Into the file there are more occurrence of the word image


Solution

  • If you want to read a file from local file system there are 2 options:

    1. Use __FileToString() function like:

      enter image description here

    2. Use HTTP Request Sampler with file as the protocol and then a suitable Post-Processor, i.e. Regular Expression Extractor for fetching the line you're looking for:

      enter image description here