How to assign value to azure devops variable using C#

Viewed 543

I have selenium C# test script which can fetch the token from the browser.

I have two azure devops task one to execute the selenium test and another to execute API test. I want to pass the selenium test fetched token to API test execution task and for that I am trying to use azure user defined variable.

I tried doing Environment.SetEnvironmentVariable("Token", token); in my selenium test and then tried to access to token in other API task using $(Token). But it is not working.

Can anyone please help with this. Is there a way to pass the token from selenium test to other azure-devops task?

Note :- Both tasks are in same job, one after the other.

1 Answers
Related