| || |
Key word, data driven, hybid
I keep getting asked what type of test harnesses I wrote. Then they ask a follow up question about the difference between key word driven and data driven. Then they say what about hybrid.
Keyword to me sounds like it has something to do with extending the QTP keywords. I can make keywords that call a function with parameters. I can add the keywords to QTP so that they show up in keyword view.
Data driven means that the data sheet contains data that navigates the application and alters objects in the AUT.
Does hybrid do both?
I don't know if I am on track with the answer and why the question is so popular.
First off, I hate the term hybrid. Keyword and data-driven are 2 aspects of a framework that are independent of one another. Making something data-driven doesn't not make it less keyword friendly, and vice versa. You can have a framework that's both data-driven and keyword based. I don't see the reason it needs to be called a hybrid (even through that's what a lot of people call it). I think people who ask about hybrid frameworks probably did some online search and see all this marketing speak and don't know enough about the subject to really know the finer nuances and design theory behind frameworks.
Personally i don't like keyword programming, I prefer BDD or just writing code with descriptive method names, and careful doc comments. (I feel that keyword programming dumbs things down and it makes it harder to express more complex relationships.) But that said, having designed a number of keyword frameworks for various employers before... I think many people see keyword as a way of making function calls human readable, and don't see the bigger picture. It does certainly serve that point, but most people starting out will also miss the finer points and the real reason for using a keyword or BDD approach. The main key is separating high level business logic from low level actions.
For example, Say I have a following keyword tests.
Login | username=admin | password=invalid
Verify | message='Invalid Login'
Noticed that this test has only the business logic in here. No button clicks and implementation level details. Where many beginners who don't understand it, may write the same test like this..
Input Text | username | admin
Input Text | password | invalid
Click Button | Login Button
Verify Text | Invalid Login
This is certainly using the 'keyword' feature. But it completely misses the point of keyword testing. This besides being less maintainable, fails to describe what you are testing (although you can infer by reading the code). A true keyword test should describe how the software works, not what the user is doing.
Datadriven is just adding on top of that, separation of test data. This makes the data more maintainable and reusable between tests. This also allows you to describe things a slightly different level. For example say I have this keyword test, and this test data set.
Login | username=@username | password=invalid
Verify | message=@status_message
Login | username=@username | password=invalid
VerifyCanAccessSettings | @access_to_settings
As you can see, abstracting out test data from the test doesn't really impact the effectiveness of keyword testing any. So this idea of 'hybrid' I think is silly. One should say their framework has both keyword and data driven support.
I really appreciate this tremendously. I have been walking around with this question in my head for about 10 years. Now I understand that Keyword is using a verb at the start of the sentence. It also can include parameter data (subjects and adjectives). The parameter can reside in another container and the script can call use the data.
I have been doing this for more than 18 years on projects. Most of the time the harness/system/lattice that does this existed. Sometimes I had to write most of it from scratch. I just didn't know what I was doing had names.
I have a few questions.
I'm not familiar with BBD. What is the acronym?
Your examples use @ signs. I'm not sure when you are using it to replace the QTP tick mark to say it is a comment and when it is saying something is a temporary variable. It is stopping me from completely understanding the examples which I want to understand better.
I'm not sure what the @ sign in front of the keywords are for.
BDD is Behavioral Driven Design. Probably the most popular frameworks for those are Cucumber and Gherkin. The idea is to first describe your software's behavior at a very high level in a consistent format. Probably the most popular is the Given, When, Then.
Given I am at the login screen.
When I enter in incorrect credentials (username, password),
Then I should receive a login error.
The idea is you write entire sentences, then associate those with test fixtures, vs. single keywords. One of the problem of using single keywords is many inexperienced testers will end up using the keywords to describe mouse clicks and keystrokes, which defeats the purpose of keyword testing. Here by specifying complete behavior vs. keyword shorthand, most testers will gravitate towards describing high level behavior instead of low level logic.
Those @ signs was a relic of an old framework I designed. It was a decorator used to denote tokens which got substituted with variables or external data. That keyword framework I designed I had the ability to specify @variable to pull data from an external data provider, or $variable to pull data from a previous step. That was how I built a data driven testing functionality for QTP back before QTP had datatables, so I built tokens into the framework.
BDD looks like a good idea. Maybe someday I can get to work with it.
I have also used @ signs for parameter data passing. I got it from IBM mainframe code.