Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97762

How to restrict test data method call for respective Test method by using TestCaseSource attribute in NUnit

$
0
0

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;

    } 

Viewing all articles
Browse latest Browse all 97762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>