I have got the roles of the classes/methods mixed up. Now it's a while since I used NUnit so bear with me.
What you need is a source of your data. You decided to use your own class to encapsulate the test data. Please note that you cannot pass any parameter to this method so you need to come up with some other way to get the XmlNode.
public static IEnumerable ReturnValuesToTest()
{
foreach (XmlNode node in node3)
foreach (string Browser in browsers)
yield return new BrowserTesting(username,password,browser);
}
Alternatively you could simply return a string array (one item per parameter):
public static IEnumerable ReturnValuesToTest()
{
foreach (XmlNode node in node3)
foreach (string Browser in browsers)
yield return new [] {username,password,browser};
}
Now using the BrowserTesting class your test method must have a matching parameter.
[Test]
[TestCaseSource("ReturnValuesToTest")]
public static void BrowserTest(BrowserTesting browserTesting)
{
}
If you choose to use the string[] as source of your data then, your test method signature stays as it was:
[Test]
[TestCaseSource("ReturnValuesToTest")]
public static void BrowserTest(string User, string Password, string Browser)
{
}
Both above examples assume that your data source method is in the same class as the test method. If it isn't then you need to specify it explicitly:
[Test]
[TestCaseSource(typeof(MyClassThatHasReturnValuesToTestMethod),"ReturnValuesToTest")]
public static void BrowserTest(string User, string Password, string Browser)
{
}
What you definitely don't want is to call TestBase.BrowserTest() from BrowserTesting constructor. The test method is called automatically for each instance of the test data by NUnit.
I recommend you to do some reading on
TestCaseSource Attribute[
^] and
TestCaseData[
^]. You can do some pretty things with the latter.