Difference between revisions of "Using Datapools"
(→Commands associated with Data Pools) |
(→Using related data (SETID)) |
||
(One intermediate revision by one user not shown) | |||
Line 55: | Line 55: | ||
* Set 1: Country: Uruguay, Cities: Salto, Paisandú, Montevideo and Atlantida | * Set 1: Country: Uruguay, Cities: Salto, Paisandú, Montevideo and Atlantida | ||
* Set 2: Country: Argentina, Cities: Rosario, Bariloche, Buenos Aires and Victoria | * Set 2: Country: Argentina, Cities: Rosario, Bariloche, Buenos Aires and Victoria | ||
− | In this case | + | In this case you need to tell GXtest that you are using a different dataset with related datapools and not using only one datapool. |
This can be done using what is called SETID, set identifier. In [http://blog.abstracta.com.uy/2009/07/datapools.html this post] there is an example of how to use this kind of datapool. | This can be done using what is called SETID, set identifier. In [http://blog.abstracta.com.uy/2009/07/datapools.html this post] there is an example of how to use this kind of datapool. | ||
Line 99: | Line 99: | ||
|} | |} | ||
− | Then if you use the DPNext command on the | + | Then if you use the DPNext command on the Country datapool, it will filter the datapools by the set identifier (SETID) . |
Latest revision as of 17:23, 28 March 2014
Contents |
7. Data Pools
A Data Pool is a set of data that can be used in a Test Case. For example if we want to make a Test Case that enters into the system 100 new clients we can create a Data Pool called Clients that contains their name, ID number and telephone number. If you create a Test Case that uses the Data Pool to insert values into an application, every time that it is run the Test Case will use a different piece of data from the Data Pool. To see how to create a Data Pool and a Test Case that uses it see the page Creating a Test Case with Data Pools.
Data Pools are used in GXtest testing when working with data. They can be used not only to enter data into an application but also to validate the expected results of an application in order to choose which action to be performed.
Commands associated with Data Pools
The majority of the commands can have parameters from Data Pools but there are also certain commands specific for Data Pools which are the following:
- DPNext Move to the next row of a Data Pool. You should always use DPNext before you begin to use a Data Pool, indicating the name of Data Pool
- DPReset Returns to the beginning of a Data Pool.
- DPCompare: it is a validation type command that is used to compare a value from a Data Pool with another value
Scope of the data
An important concept within a Data Pool is the scope or the hierarchy of the data stored in a Data Pool. The scope can be of two types Global or by Test Case. For example you could have the following Data Pool:
Scope | Name | Password |
---|---|---|
Global | pepe | pepe |
Case A | juan | juan |
If you use a Data Pool in a Test Case that doesn’t have specific data assigned to it, you will use the global data (pepe in the example). Nevertheless if you assign specifc data to a Test Case then it will use that data.
Keeping in mind the previous Data Pool, imagine that in our Test Case we want to use different names and passwords to access a system. You can create a Data Pool called Users similar to the previous example. Assume now that the majority of the Test Cases use the username pepe and the password pepe and there is only one Test Case (Case A) that uses the username juan and the password juan. In order to resolve this issue you must enter the username pepe and the password pepe as global data and the username juan is entered as specifc to Case A.
If you use this Data Pool in Test Case Case B, it will return the value (pepe,pepe) which are the global values, but if you use it in Case A, it will return the value (juan,juan).
Important: if a Data Pool has N data for a Test Case and you perform N+1 iterations, then the Data Pool will begin again with the first piece of data. |
---|
Typically when you think of or design a Test Case, you do it conceptually and you do it in order to use data in the Test Case. Many times the different data sets are related, for example for a given country you want to enter it’s corresponding cities.
For example if you want to test the country, once you have the test case defined conceptually, you can decide to run the application with the following datasets:
- Set 1: Country: Uruguay, Cities: Salto, Paisandú, Montevideo and Atlantida
- Set 2: Country: Argentina, Cities: Rosario, Bariloche, Buenos Aires and Victoria
In this case you need to tell GXtest that you are using a different dataset with related datapools and not using only one datapool.
This can be done using what is called SETID, set identifier. In this post there is an example of how to use this kind of datapool.
To perform this simply create two datapools, one named Countries and another named Cities, with the previous data and add to them a column called SETID. Now when you add a related dataset you just add an identifier for the related dataset in each row of data in the Countries and Cities datapools in the SETID column. It should be according the following format:
Master Datapool: Country - SETIDs are identifiers. i.e.: 1, 2, 3.
Related Datapool: Cities - SETIDs must be a master indentifier, followed by "." (a dot) followed by another identifier. i.e.: 1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 2.3, 3.1
Doing so you will get the following datapools with the following data:
Country | Cities | ||
---|---|---|---|
SETID | Country Name | SETID | City Name |
1 | Uruguay | 1.1 | Montevideo |
2 | Argentina | 1.2 | Salto |
3 | Brasil | 1.3 | Paysandú |
1.4 | Canelones | ||
2.1 | Buenos Aires | ||
2.2 | Rosario | ||
2.3 | Bariloche | ||
3.1 | Sao Paulo |
Then if you use the DPNext command on the Country datapool, it will filter the datapools by the set identifier (SETID) .