Use variable in many chain builders

Hi,

(Java) I created a couple of chainBuilders and I would like to:

  1. get variable from first chain builder
  2. use the variable gathered in first chain build in another chainBuilder

The error I receive is: Failed to build request: No attribute named ‘MY_VARIABLE’ is defined

How to do that?

Hi,

A ChainBuilder doesn’t do anything by itself. It needs to be attached to a ScenarioBuilder.

Please provide a reproducer as requested here.

Sorry, for being not precise. Here you have example of code.

ChainBuilder request1 =
            feed(feeder)
                    .exec(
                            http("Search: products")
                                    .get("requestUrl1")
                                    .check(regex("\"id\":(\"\\d+\")").findAll().saveAs("searchResults"))
                                    .check(status().is(200))
                    ).pause(1);

    ChainBuilder request2 =
            feed(feeder)
                    .exec(
                    http("API oferta")
                            .post("requestUrl2")
                            .header("Content-Type", "application/json")
                            .body(StringBody("#{searchResults}"))
                            .check(status().is(200)));

ChainBuilders don’t do anything standalone. The need to be attached to a ScenarioBuilder.
What are you doing exactly?