Skip to content

6. [skillcheck] Set "favoriteActor" as a collection variable using scripting | AssertionError: Fix: Save actorName value from response to variable named favoriteActor: expected 'async function fetchActors() { \r\n …' to match /pm\.collectionVariables\.set\(["']favou?riteActor["']/ #2896

Answered by aslams2020
utkarshcse2026 asked this question in Q&A
Discussion options

You must be logged in to vote

in the Skill Check request. Please include the script -

// Parse the JSON response
var responseJson = pm.response.json();

// Get the actorName from the response body
var actorName = responseJson.data.actorName;

// Set the actorName as a collection variable
pm.collectionVariables.set("favoriteActor", actorName);

// Log the actorName to the console for verification
console.log("favoriteActor set to: " + actorName);

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by MastanSayyad
Comment options

You must be logged in to vote
1 reply
@aslams2020
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants