Forum Discussion

ganapati_bhat's avatar
ganapati_bhat
Occasional Contributor
10 years ago

Not able to read the data from excel multiple times

Hi,

I am using testComplete for my mobile app automation. For the login credentials, I am using excel sheet to read the data [using data driven loop-excel]. I have to run multiple test cases which involves login. Like, Login-Dashboard-navigate to logout, Login-Dashboard-payment-logout and so on..

When I do suite run, my 1st test case ran properly. but for the second test case, it failed to fetch the login credentials from the excel and throws Exception.

Is there any solution for the above issue, where I can fetch the same username and password filed mentioned in the excel for multiple test cases.



Please help on this.



Regards,

Ganapati

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ganapati,



    I am not sure if I got your question right...

    DDT driver in TestComplete (including Excel one) provides forward-only read functionality. This means that once opened, it can only be moved foward using the .Next() method but cannot be positioned to some arbitrary record.

    It is possible to rewind it to the first record via the call to the .First() method and do another iteration through its records. (See DDTDriver help topic for more details.)
  • Hey Ganapati,



    Why don't you simply put the username and password into your sheet (for all the rows you want to itterate over)? I assume (from what you describe) that this is the case since it's read for the first record.



    If that does not solve your problem, (and there are probably more elegant ways to do this), but you can merely assign your username and password (or whichever values you wish to remain static) to a variable outside the datadriven loop. The values that are set will then remain the same (until of course you change them).



    Regards,

    Altus
  • ganapati_bhat's avatar
    ganapati_bhat
    Occasional Contributor
    Hi All,



    Thanks for the reply. I got the solution finally for my problem. I have written the jScript to open and read data from excel and used script routine in my test cases.



    Regards,

    Ganapati