Hello I want to pass the number of retries dynamically from app.config value.
The app.config has the following line:
A bit of work around, but you can use TestCaseSource
attribute to create data driven test that will run numberOfRetries
times
[Test, TestCaseSource("GetNum")]
public void Test(int testNum)
{
}
private IEnumerable GetNum
{
get
{
int numberOfRetries = int.Parse(ConfigurationManager.AppSettings["retryTest"]);
for (int i = 1; i <= numberOfRetries; ++i)
{
yield return new TestCaseData(i);
}
}
}
In test explorer you will see Test(1)
, Test(2)
, Test(3)
.