Forum Discussion

jon_yates's avatar
jon_yates
Occasional Contributor
11 years ago
Solved

Why will the unit test not insert into DB


Hello all.


 


I'm very new to TestComplete so apologies if a very simple solution.


 


I have a script (attached) that simply logs into a web app, clicks a few links, enters some data into a form and clicks save.


 


The flow works and the form data gets entered without error, but the values do not get inserted into SQL database.


 


Anyone have any idea why this is so?


 


I've tested with a non-existant user, and I get the appropriate error, so I know connectivity is there.


 


All help appreciated!

  • Hi Jon,



    Considering, that all actions are executed by TestComplete successfully and the tested application does what it was expected to do (login succeeds), I would say that the fact that nothing is logged into the database by the application indicates a problem in the application itself (i.e. you have found an issue).

    The only thing you may try before reporting a problem to your development is to replace all calls to .SetText method with the calls to .Keys one and check if the data are logged into the database.

    The case is that SetText() just sets the value of the control via API calls while Keys() emulates keyboard typing (http://support.smartbear.com/viewarticle/55580/). While the former is much faster, quite often it does not work for the applications that intercept key presses for some additional processing. Personally I am not sure that this is the correct approach, but if it is implemented in the given application, then I am sure :) that nobody will change it and you will have to live with using more slower Keys() method in your tests.

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1
    Hi Jon,



    Considering, that all actions are executed by TestComplete successfully and the tested application does what it was expected to do (login succeeds), I would say that the fact that nothing is logged into the database by the application indicates a problem in the application itself (i.e. you have found an issue).

    The only thing you may try before reporting a problem to your development is to replace all calls to .SetText method with the calls to .Keys one and check if the data are logged into the database.

    The case is that SetText() just sets the value of the control via API calls while Keys() emulates keyboard typing (http://support.smartbear.com/viewarticle/55580/). While the former is much faster, quite often it does not work for the applications that intercept key presses for some additional processing. Personally I am not sure that this is the correct approach, but if it is implemented in the given application, then I am sure :) that nobody will change it and you will have to live with using more slower Keys() method in your tests.
  • jon_yates's avatar
    jon_yates
    Occasional Contributor
    Hi Alexei.



    Changing SetText to Keys has worked!



    The new value is now inserted.



    Thanks for your help.



    Jon