I have a variable contains the value like string or integer and I want to compare with the Excel data. Multiple variables using for loop and return test case passed if both values are same
Instead of storing the multiple values in multiple variables, store all the values in a variable.
→ Store all the values in a List of String datatype variable called List_Items.
- Assign -> List_Items = New List(Of String) from {"Apple","Banana","Cat","Dog"}
→ In the Excel create one more Column called Testcase.
→ Use the Excel Process scope activity inside of it use the Use excel file activity and give the path of the excel file.
→ Inside Use excel file activity insert the For each excel row activity. Output is CurrentRow.
→ Inside for each insert the If activity to check the condition write the below condition,
- Condition -> List_Items.any(Function(X) X.toString.equals(CurrentRow("Column name").toString))
→ Inside then block insert write cell activity and give Passed in what to write field, In where to write field give CurrentRow.ByField(“Testcase”)
→ Inside else block insert another write cell activity and give Failed in What to write field, In where to write field give CurrentRow.ByField(“Testcase”)
If any one of the value in the list is matches with a specific column in excel then it will update Passed in Test case column else it update Failed.
Hope it helps!!
In string what is stored can elaborate the third step verify expression.
Verify expression activity will compare strVariable variable and current iterating row of datatable column value. If matched it will Pass the test or Fail is not.
Thanks,
Ashok ![]()
