Valerie
Valerie

Reputation: 11

How to pass data from one test to another in Xunit?

I am using Playwright with C# and Xunit, but I think Selenium and Xunit users can help as well. I need to get the value of an element in one test and pass this value to another test. For example,

[Fact]
public async Task GetData()
{
   var data = await Page.GetAttribute(selector1, "value");
}
[Fact]
public async Task PassData()
{
   await Page.FillAsync(selector2, data); 
}

This is a simple example, the real-life test has a lot of steps, so I want to break one big into several small tests.

Upvotes: 1

Views: 1301

Answers (0)

Related Questions