extracting values from custom feeder

Hey,

How could I extract values from a custom feeder of the type Map[String, List[List[String]]]. eg the feeder is

Map(“us” → List(List(“California”, “Alabama”, …), List(“CA”, “AL”),
“europe” → List(List(“Greece”, “Italy”, “France”, …) , List(“gr”, “uk”, …)).

How can I get the country names out of this, and from that, how can I extract the first list or the second list?

Thanks

Nick

Also, how could I get the feeder length?

Hi,

I’m not sure about what you’re trying to achieve, so I might be wrong, but my first impression is that you’re over-complicating things.

It looks like you’re trying to build a drop down menu, while you should focus on what your virtual users will be sending on the wire.
Are you sure you don’t actually need something much more simple, like List(“CA”, “AL”… “gr”, “uk”…)?

My 2 cents,

Stéphane

Hey,

Essentially I’m trying to check that JSON blobs at different endpoints X/us and X/europe, return the correct value. The JSON bits have the following structure:

{
“State”: “California”,
“Abbreviation”: “CA”
}

and I wanted to create a custom feeder that holds a list of all the states/countries and so i would be able to say jsonPath(CONTINENT.state).in(FIRST_LIST) and jsonPath(CONTINENT.state).in(SECOND_LIST). But I don’t know how to get the “us”/ “europe” and each individual list out of the custom feeder.

Does that make more sense?

Thanks for your help,
Nick

Got it.

You won’t be able to use Gatling EL this way, it can only reach top level elements.

I see 2 solutions:

Got it.

You won’t be able to use Gatling EL this way, it can only reach top level elements.

I see 2 solutions:

  • change your custom feeder to Map(“usStates” → List(), “usAbrevations” → List, …) so you only have to level elements and can use Gatling EL
  • don’t use Gatling EL and pass a lambda instead, such as jsonPath(CONTINENT.state).in(session => session.getTypedAttribute[(List[String], List[String]]._1)
    Cheers,

Stéphane

Hey,

Ok, thanks for your suggestions. I’ll try playing around with the second one and seeing how far I can go!