I have integrated selenium code with JMeter using JUnit request sampler. I want to navigate to a URL which I will get from an API response. For this, I can pass a runtime value (URL) to the JUnit jar file. To achieve this, I need to pass response of an API to the JUnit sampler. How can we do this?
2 Answers
1
votes
- You can extract the "interesting" value using any suitable JMeter PostProcessor and store it into JMeter Variable
The variable can be used in the JUnit Request sampler like:
String value = JMeterContextService.getContext().getVariables().get("your_variable_name_here");
You will need to link your project with Apache JMeter Core in order to have access to JMeterContext class
In the majority of cases it's easier to go for WebDriver Sampler in order to get Selenium integration