Data Driven Testing with OpKey
Upcoming SlideShare
Loading in...5
×
 

Data Driven Testing with OpKey

on

  • 643 views

Using variables and input data that are stored in external sources like Excel,database to test an AUT (Application under Test) is a common practice that let the tester to see how the application ...

Using variables and input data that are stored in external sources like Excel,database to test an AUT (Application under Test) is a common practice that let the tester to see how the application respond with various inputs. It increases test coverage and also helps to reduce the necessitates of creating more test cases with different variables.We generally term it as Parametrization.

Statistics

Views

Total Views
643
Views on SlideShare
637
Embed Views
6

Actions

Likes
0
Downloads
16
Comments
0

1 Embed 6

https://twitter.com 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Data Driven Testing with OpKey Data Driven Testing with OpKey Document Transcript

  • Data driven testing using Data-Repositories PART-1 Test Parameterization What is Data Driven Testing ? Using variables and input data that are stored in external sources like Excel,database to test an AUT (Application under Test) is a common practice that let the tester to see how the application respond with various inputs. It increases test coverage and also helps to reduce the necessitaties of creating more test cases with different variables.We generally term it as Parameterization. Why do we need to test same Test Case using different Datasets? Parameterization allows user to check same operation with multiple set of data.In some scenario user has to provide multiple set of data for a single test case for example if you want to check the Login credential so user has to provide multiple values for the Login. To perform this operation user has 2 options, one is user can provide these value one by one manually after completing the each flow or second one is user can use multiple set of data value in the test case so they can easily execute the flow without changing value manually. This is also called the Parameterization when you can test AUT (Application under test) with multiple set of data values. Advantages of data driven testing (Parameterization):- 1. You can test your application with multiple set of data values during Regression testing. 2. You can test your application with positive and negative scenarios. Different ways to parameterize your test case in OpKey:- You can do the parameterization in OpKey with the help of Data Repository. We can parameterize test data by two ways:- 1. Entering Data directly into the Data Repository. 2. Importing Test Data from External files. Entering Data Directly into Data Repository:- Add Data Repository -> Add columns and rows according to your need -> save this Data Repository Importing Test Data from External files:- Add Data Repository -> Import any Excel and CSV file -> save this Data Repository (You can see in detail how to import test data from External files http://opkey.crestechglobal.com/help/pages.php?subid=57&accordid=3#Data-Repository-File- Features)
  • Consider the simple test case of application login. You want to test the application response to right and wrong pairs of username-password. You might also be interested in block-after-three-attempts scenario. We start with a simple test script as OpenBrowser("internet Explorer", "http://www.yoursite.com/loginpage.php") TypeTextOnEditBox("txt-box-1", "your-username") TypeTextOnEditBox("txt-box-2", "password") ClickButtonAndWait("bttn1") VerifyObjectExists("logout-link") Test Case in OpKey (Test Script) The idea is, if the logout-link exists then we say that the page accepted the given username and password. Depending on the validity of username/password pair we provided, the test either passes or fails. A problem with this approach is that if we need to test with a different username/password pair, we need to alter the script and then rerun it. That will not be feasible if there are say, tens or hundreds of data pairs. We need to parameterize the username and password fields (variables) and feed the data from a table. This is where data repositories come in handy. A data repository is a simple table which holds the data for one test. There could be many-to-many relationships between test cases and data repositories but for now let there be one data repository per test case. A data repository is a table in row/column fashion. Each column represents a variable/parameterized-data from the test case. In our case we would have two columns USERNAME and PASSWORD. Each row represents one iteration of test case with values taken from the cells in that row. Let us create a data repository as such. Data Repository Go to test case module. Add step and provide keyword in this step. Select the provide data field under Provide Data value for Data Input Argument panel. Instead of providing static value, go to Data- Repository section. Expand the newly created item. Select the username column. Do same with text keyword. Select the password field of second TypeTextOnEditBox step. Change the static value to Data- Repository. Expand the data-repository from the drop down. Select the password column. Test case looks like below image.
  • Test case with Data Repository values Now execute the test and watch. The whole test will run three times, one with each pair of username password. We say that the test has iterated three times, which was the maximum depth of any column in all the repository columns used in current test case. You can increase iterations by increasing the number of rows. For much complex tests which are heavily parameterized, the number of columns will increase. So we have seen how we can easily parameterize OpKey test scripts and iterate a test over a large set of test data. In next post we will discuss scenarios when data in one column repeats for data in other columns.
  • Data driven testing using Data-Repositories PART-2 Advanced Test Parameterization --------------------------------------------------- In part 1 of this article we discussed on how we can parameterize OpKey test scripts and how we can iterate the test over a large set of data. Now we will be discussing some advanced aspects of it. In our previous discussion we tested the login and credential validation process of an application. Now we want to test the product-search feature of the same application. We have a text box where we enter search keywords. We hit enter and we are presented with a page full of relevant products. But before we do it we need to login first. So we create a test script as: //this part does the login OpenBrowser("internet Explorer", "http://www.yoursite.com/loginpage.php") TypeTextOnEditBox("txt-box-1", "your-username") TypeTextOnEditBox("txt-box-2", "password") ClickAndWait("bttn1") //here we search TypeTextOnEditBox ("txt-box-3", "search-keyword") VerifyObjectExists("item-count-link") Test Case in OpKey (Test Script) When executed, this test script opens internet explorer, logs in with provided credentials and searches for a product. We now want to parameterize this. There are a total of three variables - username, password and keyword. We could go with a data repository of three columns but then we will have a slight problem: we have just one (or limited) set of login credentials but fairly large set of keywords. A basic data repository will look like: Data Repository
  • Try to bind the columns to their respective parameters in the test case. See part 1 of this post if you need help. Run the test. You will see the test case iterates 6 times. Every time it logs in with a user credential and performs a search. One thing that you will find intriguing is the multiple repetition of {james, bob, alice} set. Had the keyword set been much larger, as in real practice it would be, the reparation of the username would not look good. Here is the solution - whenever you find yourself in a position when a fixed set of data (here username and password) repeating over other set (keyword), do not actually repeat or copy paste the values. Just leave the cells empty like this: Data Repository To try this feature, go to the data repository and delete the redundant cells. You may select the cells and clear them. If you execute the test right now you will see that in fourth iteration OpKey tries to login with blank username and password. This is the default behavior. In the fourth row the username and passwords and empty hence the TypeTextOnEditBox is provided empty. This behavior can be overridden.
  • Go back to the test case. Locate the username parameter it would be bound to data repository and the icon next to it will tell you so. We need to redo the binding process. Expand the data repository but do not select the column now, not yet. Rather look to the top of the popup. There you will find two radio buttons CYCLIC and CONTINOUS with continuous being selected by default. Select the cyclic button and then select the USERNAME column. What we did is that we bound the username column in cyclic fashion. So once the data in the column finishes (after three) iterations, OpKey will automatically cycle to the first element in the set. Do same with password field. Save and run. To learn more about the iteration mechanism of data repositories see the online documentation on the same. (http://opkey.crestechglobal.com/help/pages.php?subid=57&accordid=3)