I am using NUnit for Selenium C# project. In which i have many test methods. For getting data (from excel) i am using public static method that return IEnumerable which i am calling at test method level as TestCaseSource. I am facing challenge now, as i start executing on test method it is invoking all the static methods which are there in the project. Can someone help me how can i restrict my data call method to respective test method. Code looks like this
public static IEnumerable BasicSearch() { BaseEntity.TestDataPath = PMTestConstants.PMTestDataFolder + ConfigurationManager.AppSettings.Get("Environment").ToString() + PMTestConstants.PMTestDataBook; return ExcelTestDataHelper.ReadFromExcel(BaseEntity.TestDataPath, ExcelQueryCreator.GetCommand(PMTestConstants.QueryCommand, PMTestConstants.PMPolicySheet, "999580")); }
[Test, TestCaseSource("BasicSearch"), Category("Smoke")]
public void SampleCase(Dictionary<string, string> data)
{
dosomething;
}