Module 17Want to run both test cases in a batch the how will set sheetname for diff sheets in getData method | Selenium C# Forum
V
Vrushali Posted on 10/01/2019

1. If there two different test methods in the SAME class

[Test,TestCaseSource("getData")]
public void create_wo_test

[Test, TestCaseSource("getData")]
public void edit_wo_test(...)

2. In Datautil we have implemented only single getData() method


3. for first testcase method i want to use data from excel sheet "Create_WO_Test"


4. for second testcase method i want to use data from excel sheet "Edit_WO_Test"


public static object[] getData()
{
return DataUtil.getData(xls, ?);
}
}

 Question :

namespace PTCPMO.SeleniumTestCases.TestCases
{
    [TestFixture]
    public class Create_workorderTest : BaseTest
    {
 IJavaScriptExecutor js;
        [Test,TestCaseSource("getData")]
        public void create_wo_test(string Runmode,string Browser, string Purpose_for_WO,string LS ,string BMP,string EMP,string Stream, string Network_Area, string  Source, string  Priority ,string WO_Manager , string WO_Status)

        {
}


[Test, TestCaseSource("getData")]
        public void edit_wo_test(string Runmode, string Browser, string Purpose_for_WO, string LS, string BMP, string EMP, string Stream, string Network_Area, string Source, string Priority, string WO_Manager, string WO_Status)

        {
}


public static object[] getData()
        {
            return DataUtil.getData(xls, "Edit_WO_Test");
        }
    }


IF Want to run  both test cases in a batch , the how will set 'sheetname' [?] in getData method?

 


A
Ashish Thakur Replied on 13/01/2019

You can use 2 different test data sources

public static object[] getData_1()

public static object[] getData_2()


S
Support Desk Replied on 29/05/2019

Is the issue resolved?