Forum Discussion

progz's avatar
progz
Occasional Contributor
8 years ago
Solved

How do I send MySQL queries to a database within a test?

Hello everyone,   I am currently testing a POS software that works on the side with a MySQL 5.5 MyISAM engine type database. Within my project I have several tests that I can do. The program is wor...
  • tristaanogre's avatar
    8 years ago

    I'm assuming, to date, you've been using mainly Keyword Tests to create your project. 

    It is not impossible to do SQL queries and stuff in KeywordTests... but I find it cumbersome.  It feels much easier and intuitive to me to use, as you mention, "a programming language". 

    When you created your project, you selected a programming language.  Even though you aren't using it to write your tests, you've already taken that step.  

     

    There are some examples showing, briefly, how to do this... check out https://support.smartbear.com/viewarticle/18441/

     

    I also created a Script Extension some time back that does what you want...I don't have any documentation written up for it (yet) but, if you want to try it, you can download it at https://bitbucket.org/tristaanogre/tabledrivenframework/downloads/SQLUtilities.tcx and then just send me a private message for how to use it.

    But yes... to do a TRUNCATE TABLE you're going to want do something a bit more than just a keyword test.