Elevate Your QA Game with Data-Driven Testing
Kuman Kothiya
Automation Test Lead @Happiest Minds | Ex- Johnson Controls | Ex-Einfochips
Often and several times application/software testers have confusion/procrastination regarding the test coverage of the test cases. The coding journey of a test person might demand forehand of using several test frameworks and test approaches. I am going to talk about some of them which can be proven as best test approaches.
Application Under Test (AUT):
Assume a sample website login [username and password] needs to be tested. Application must have several restrictions over choosing both the parameter strings.
Casual/Obvious User Test Scenarios for AUT:
A very natural way to test this kind of flow is to give 2 types of tests [Positive and Negative].
Test of valid username and password strings should be accepted
Test of invalid username and password characters should be rejected
Thinking out a little loud on test data mechanics:
The obvious tests could be a small sanity tests, but if you are an impact-full test champion, you would bother developers of application\software by testing all valid and invalid combinations. That's where an approach of testing regressive test parameters takes birth and here are some of the methods you could follow to make your test coverage intact via data driven tests.
1. Raw python selenium code:
Write a code snippet to supply all valid and invalid string combinations and run the test
into a loop.
2. pytest markers:
Test-data is expected to be defined from user and pytest will take care of regression of
all the test execution based on parameters defined into "parametrize" API. Note that
extra for loop from previous approach is not required now.
4. python-config file-based:
This one uses pandas for parsing the data from a test file. Whole approach suggests a
method of separating test cases and test data into 2 different files. CSV file contains all
test data and python file contains the code to execute that data.
领英推荐
5. Robot data driver CSV based:
The approach eases user for defining the test data into the test folder and access
them into .robot files using "DataDriver" library. Also make sure that into robot
*** Test Cases *** section you add the arguments with exact same string which you
have defined into csv.
6. Robot file with test data into same file:
This approach is little more famous because of less maintenance of the test data. Test
data is right there into the robot file headers with section *** Test Cases ***.
"Test Template" allows all the test data to run against the given keyword
7. pytest-bdd feature file based:
Assuming that you knew "how to write python step definitions for the .feature files".
This is most human readable "Behaviour Driven" test approach. A non-tech person can
also read the feature and understand what is going on. "Scenario Outline" will execute
each set of given input against the python step definitions. The coolest entity into this
approach is that you do not have to define test_data anywhere else, it's right here into
the feature files. This gives a lot of options for testers for regression testing and choices
of the tests.
Conclusion:
Every test automation framework/tool you use for automation purpose have hidden/unexplored capabilities to enhance the tests. By adopting a "Data Driven" approach, testers can accelerate their testing activities, allowing more time for exploratory testing and other testing methods.
Automation Test Lead @Happiest Minds | Ex- Johnson Controls | Ex-Einfochips
3 个月To all visitors: Endless gratitude for journeying alongside me—your engagement fuels my creative spark ?? !
Technical Lead (C++/QT/QML)
4 个月Insightful!
Senior Test Lead at Happiest Minds Technologies, Ex-TechMahindra, Accenture, Wipro Technologies
4 个月Well written !