Search code examples
pythonsqlautomationrobotframework

Print Query Result in Console - Robot Framework


I'm using Robot Framework in automations. Now I'm adding SQL Server scripts.

In order to facilitate, I would like to make a print of my query (select) to display in the console.

How do I do?

I tried with the following way, but without success:

Log    SELECT *FROM TABLEX;

and

Log To Console    SELECT *FROM TABLEX;

The latter prints to the console, but the query sent, in this case, select *from TABLEX.

Also, can I print in the same code using python? Or should the file be .py instead of .robot?

And finaly, can I not keep generating logs after running the tests?

Awaiting.

Thank you!


Solution

  • You have to run a keyword that performs the query. You can capture that result and then log it.

    *** Test Cases ***
    Example
        ${result}=  Query  SELECT * FROM TABLEX;
        log  ${result}