简体   繁体   中英

Execute Nunit Test case with multiple TestCaseSource attribute

My scenario is: Test script is requiring data from multiple excel files, so i want to have multiple testcasesource on Test method. Is there a way of having multiple testcasesource.

For below Code my explanation:

Iteration 1: It should fetch "TC01" patientdetails and "TC01" loginDetails and run script.

Iteration 2: It should fetch "KT"patientdetails and "TC01" loginDetails and run script.

Main Hurdle is: how to create IEnumerable in such a way that it handles above two scenario.

My code:

        [Test]
        [TestCaseSource(typeof(TestDataLogin), "PatientDetails", new object[] { new string[] { "TC01","KT"} })]
        [TestCaseSource(typeof(TestDataLogin), "LoginDetails", new object[] { new string[] { "TC01" } })]
        public void PatientEnrollment(string userDetails, PatientAndDeviceDetails data,LoginDetails loginData)
        {
        }

I will be too grateful if someone can help me find solution for such case.

I'm not clear on what you're trying to achieve. Are you trying to mix the PatientDetails and LoginDetails into the one test? If so then perform the logic of combining them within the one TestCaseSource

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM