Use of RF in regression testing

Hi,

I am creating regression test suite for db testing across various sql components and wanted to know if there are any best practices that can be used to make the test suite robust? I am also planning to use RF for testing python, batch scripts alongside SQL to have a single testing framework for the entire application. Has anyone followed similar pattern before?

Thanks.

How to make a suite more robust depends on what’s not robust in you current setup. What kind of (random) failures do you get?

What exactly do you mean with “RF for testing python”? Are you using RF (and I assume a custom library written in Python) to test a Python application? Also, why use batch scripts? Anything you can do in a batch file, can be done in Python. Doing SQL calls in Python is also possible (might be a bit harder if the SQL is really complex). So it should be possible to have the test cases in RF and do logic / interfacing from a custom Python library.

For SQL since most of them are Stored procedures and they are indeed complex, the test cases would involve calling SP with a set of inputs extract the output and validate a set of fields against a specific criteria and accordingly mark the test cases as pass/fail. I wanted to know if there is a better approach than this.

I agree, anything that can be done in batch can be done in python, but it was more of a trade-off. For simpler requirements batch script can be done in few lines of code whereas for the same in python it will actually take lot more to write taking into account logging, error handling etc.

I had asked another question on RPA in separate thread Automating Desktop application using python Robotframework - #2 by Wolfe1. Would you know anything about it?

Thanks for your input so far.

Hi Murali,

Have you looked into using the Robotframework-Database-Library? I’ve not personally used it but i’ve seen a few posts in this forum on it. I would think it might be easier for you to execute the stored procedures in RF rather than running a batch or python script to execute the SQL, also having the results returned directly would hopefully make any validation easier.

Hope that’s helpful,

Dave.

Hi Dave,

Yes, i am using pyodbc to connect to db to execute a SP from robot script, extract the contents to a file and then do validation on the file contents. I wanted to check if this approach is acceptable or if there is a better solution.

Hi Murali,

my understanding is that library I mentioned uses pyodbc to connect, the difference using a library is that all your data remains in your robot file and you have access to all the other robot libraries for validation like the builtin Should Be Equal As Strings. it also means going forward should you (or someone else) need to update the test cases that there is only one place to look (the robot file) rather than having to dig down into batch files and python files to find where things are configured.
Additionally using robot frameworks keywords makes your test cases much easier to read for people who don’t read code to understand exactly what your test case is doing.

As for what is “better” that depends on your organisation, and who is consuming your test results. If all the people looking at your test results are developers that are comfortable writing python code, then what you have now might be fine. If some of the people looking at your test results are business people or DBA’s with no coding abilities outside SQL (I’ve meet DBA’s like this so they exist) then moving your test cases to easy to read keywords might make reading the test results much easier.

As I say it depends on your organisation, best practice for one organisation could be worst practice for another organisation.

Dave.

Hi Dave,

Thanks for your detailed input. Yes, my approach is very similar to what you have listed, i.e. all the data is in the robot file and I’m using robot libraries where possible for validation. There are few data elements in other scripts but i can refactor and move them over to the robot file to keep everything in one place. This will also enable me to have a test suite for SQL.

Sorry I might be digressing again. I am also working on RPA for UI automation and i had provided a link few posts above on this thread about the issue i’m facing in that area. Would you happen to know anything about it?

Thanks again for your inputs :+1:, it was quite insightful.

Hi Murali,

Seems your approach is, call the existing scripts as they are, add validation, anything new use RF keywords and then gradually migrate the existing scripts to RF keywords, If thats the case, this is the best approach, it gives you good readability for new and migrated test cases while not neglecting the legacy test cases.

As for (non web browser) UI Automation, I have limited experience with that using robot framework, mostly only with SikuliLibrary as I don’t use windows much at home, so other than reading the documentation I can’t help much, I saw that thread, but didn’t reply as there are others who had and have more knowledge than me in that area.

Dave.