Forum Discussion

BillA603's avatar
BillA603
Contributor
7 years ago

Data Driven testing: How do I conditionally evaluate XLS value in script?

Hello,

 

I am working on a Data Driven test using an XLS file as my input data. One column in the file indivcates whether or not to use that row's data for testing. The file contains a number of users and their login credentials. Depending on what test scenario I am conducting, some users should be skipped.

 

I am trying to figure out how to evaluate the value found in column [Include_In_Test] in vbscript. If the value is Y, then proceed and use this row, otherwise, skip to the next data row.

 

I appreciate any examples, suggestions, etc.

 

Thanks,

Bill

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm not a VB guy.... but generally, the below JavaScript should be what you need to do...
    if (ExcelDriverObject.Value('RunThisTest') === 'Y'){
    DoSomething();
    }
    else {
    DoSomethingElse();
    }

    In code, that's what I would do. You can do something similar with the if...then operation in a keyword test.