Git Product home page Git Product logo

Comments (9)

steveschnepp avatar steveschnepp commented on June 11, 2024 1

What would be nice would be to support also to loop on an array that is matched before.

from artillery-core.

hassy avatar hassy commented on June 11, 2024 1

@kapekost Artillery's templates don't really support arrays - so that would require some significant changes which aren't planned for a particular release right now.

It is possible to create a variable in a hook function and make it available to following requests/functions. Just assign a value to context.vars.variableName.

from artillery-core.

hassy avatar hassy commented on June 11, 2024

Hey @JohnieLee, no that's not supported by the templating engine at the moment.

from artillery-core.

hassy avatar hassy commented on June 11, 2024

@steveschnepp could you give an example? Do you mean being able to loop through an array that comes back in a JSON response?

from artillery-core.

steveschnepp avatar steveschnepp commented on June 11, 2024

Yes, exactly that.

UserStory : I want to add to cart all the products that are returned from a search.

from artillery-core.

hassy avatar hassy commented on June 11, 2024

@steveschnepp Great, just wanted to make sure I understood the use-case.

from artillery-core.

JohnieLee avatar JohnieLee commented on June 11, 2024

That was my use case also.

from artillery-core.

kapekost avatar kapekost commented on June 11, 2024

is there any update to this issue?

I was trying to use the afterResponse script to do the count and add it to a variable and pass it back to the yaml, but I don't think that's possible

from artillery-core.

kapekost avatar kapekost commented on June 11, 2024

Thank you! works like a charm!
context.vars..length --> {{ length }}

from artillery-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.