Module 17Want to run both test cases in a batch the how will set sheetname for diff sheets in getData method | Selenium Webdriver Tutorial with c# |Selenium C# training
10% June Month Discount Avail now

Selenium C# Training Forum

Module 17Want to run both test cases in a batch the how will set sheetname for diff sheets in getData method

V
Vrushali Haldankar Post 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?

 

D
Demo Reply on 13/01/2019

You can use 2 different test data sources

public static object[] getData_1()

public static object[] getData_2()

S

Instructor

Support Reply on 29/05/2019

Is the issue resolved?