I developed a series of unit tests in Visual Studio 2019, C# Selenium. How can run back to back with one browser instance? For example, the first test is going through a series of steps and creates a unique string e.g. id = "Id1Aug2020" I want the browser stays open for the second test, run the second test using the id created in the first test. the tests I have now, Test1 creates the id close browser and Test2 open a new browser do something else using a random id (not good), instead of the Id was created in Test1 and close the browser, and so forth.... how can I achieve this, any suggestions?
While I don't recommend this approach as it does not conform to F.I.R.S.T. (Fast, Isolated/Independent, Repeatable, Self-validating, Thorough) you can accomplish a reusable session by not tearing down after each test. It differs slightly depending on the Test Runner you are using MSTest/VSTest, NUnit, XUnit but are largely the same.
For NUnit you would use
[OneTimeSetup] to start the browser rather than