Rayrun
โ† Back to Discord Forum

Artillery passing variables

Using Artillery to execute a playwright test, how can I pass something like a vuser ID?

This thread is trying to answer question "How can I pass a unique identifier like a vuser ID to a playwright test using Artillery?"

4 replies

In my case I'm loading a credentials file with a different user for each instance of playwright running, I can't seem to find a way to pass a unique identifier I can key off to playwright. I thought maybe it'd be possible through an environment variable but it doesn't seem to populate any before it executes

hi @xillian81 ๐Ÿ‘‹ every Artillery VU has a unique ID associated with it. You can access that id inside a your Playwright test function through userContext.vars.$uuid, where userContext is the second argument for the Playwright test function. For example:

async function myTest(page, userContext) { console.log(userContext.vars.$uuid); await page.goto('https://www.artillery.io/'); }

leblancmeneses

Artillery looks pretty cool. I wish i would have known about you all 8 months ago when the company decided to use neoload.

thanks @leblancmeneses ๐Ÿ™‚

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.