2

Data set and demo webUI - Sample data in excel sheet (first row being column header) -

enter image description here

Demo layout -

page_layout

Problem scenario - The data to be filled up is from an excel sheet, if the occupation is Entered (that is typed in), it will search in excel sheet's occupation column and populate the data in the name field, for example - After typing engineer, the names of engineers have been populated in the drop-down.

enter image description here

After the name is selected (manually), the Address will be automatically put in the address box from the excel sheets data. i.e. conditional checking from excel sheets data.

enter image description here

Now I can read from excel sheet using the jxl library, but I do not know how to implement the conditional checks from the excel data.

Any guideline / code snippet for implementing the conditional checks is highly appreciated.

2
  • I suppose this is more related to logic of code- which ideally should go to SO and not here. Commented Oct 10, 2016 at 8:07
  • yeah, I am actually struggling with putting the logic in place. Commented Oct 10, 2016 at 14:09

1 Answer 1

2

I'm not too sure what your issue is, really, but I'll give it a go.

From your explanation, the engineer names in your Excel are used to create option elements in the DOM?

Issue 1: this feels like something your application should fetch from its database.

Issue 2: you then mention that you manually select a value in the dropdown.

Thoughts: a data row (as input for your tests) should only contain input values (such as a user would type or select) and maybe expected values to check against (again, what a human user could do).

An end user will not create dropdown options in the DOM - why do so in your automated scenario?

Solution: can the dropdown data be provided from the application's database? The values in the Excel then only indicate what to select and validate, as befits a data-driven automated test (each row is passed into a test; spreading data for one test over 3 rows is asking for trouble).

If not, then add a column to your Excel containing "John;Emma;Norman" for each Engineer line. When passing the first row to your test, split this column in a list to create the dropdown, then use column first_name to select what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.