Specific Types of DPLs
The following are some more examples of specific DPL types.
Multiple Data Files, DPLs, and Users
Multiple DPLs may be used in one TestScenario, even at the same time. In this example, we have two sets of users that need to work with different files at the same time. We begin by defining the files:
<resources><data path="./data/group1Passwords.csv"/><data path="./data/group2Passwords.csv"/></resources>
Next, we create two DPL instances:
<DataSources><dpl name="group1" type="HashDPL"><argument name="file" dpl="rsc" value="getDataByIndex" index="0"/></dpl><dpl name="group2" type=" HashDPL "><argument name="file" dpl="rsc" value="getDataByIndex" index="1"/></dpl></DataSources>
Now, the group1 is a Hash DPL working with the group 1 password file and the group2 is another one working with the group 1 password file.
Now, we define 10 concurrent users for Appvance IQ:
<crlevels><crlevel value="10"/></crlevels>
Next, we use the sequence construct to define the 10 concurrent users into two groups of 5 users (50% each).
<sequence name="TestComplexAsync-SameConn" proportion="50"><run name="CVS" testclass="com.examples.login" method="login" langtype="java"><argument name="arg" dpl="group1" value="getNextData"/></run></sequence><sequence name="TestComplexAsync-SameConn" proportion="50"><run name="CVS" testclass="com.examples.login" method="login" langtype="java"><argument name="arg" dpl="group2" value="getNextData"/></run></sequence>
This construction tells Appvance IQ to run the test using 5 users (50% of 10) using the group1 DPL and the other 5 users using the group2 DPL.
Relational Database Management System (RDBMS) DPL
Relational Database Management Systems (RDBMS) store data in a relational model of tables, rows, and columns. The Structured Query Language (SQL) provides a syntax for defining views of the relational model. The Data Production Library (DPL) generates data from a relational database and passes the data to a test at runtime.
The RDBMS DPL has five configuration parameters:
Connector: The JDBC type to connect to the database.
Appvance IQ does not provide a JDBC driver since databases provide JDBC connectors by implementing the java.sql.Driver interface. In the example given, the driver class used is the com.mysql.jdbc.Driver from the MySQL database.
-
URL: The URL of the database.
-
Logging: The account username for database access.
-
Password: The account password for database access.
-
Query: The query for the database. The query is done one time with the result stored for further use.
-
Schema: Some JDBC drivers require to specify the Schema name.
Here is the configuration syntax to create one instance called RDBMS :
<DataSources><dpl name="rdbms" type="RDBMSDPL"><argument name="connector" value="com.mysql.jdbc.Driver" /><argument name="url" value="jdbc:mysql://localhost/tmstatus" /><argument name="login" value="superuser" /><argument name="password" value="12345" /><argument name="query" value="select * from person" /></dpl></DataSources>
Given a table called the person in a SQL database called tmstatus:
|
Pepe |
24 |
Black |
Red |
|
Heriberto |
56 |
Black |
Blue |
|
Austelina |
77 |
Black |
Yellow |
<run name="CSV example 1" testclass="simple.print" method="print" langtype="java">argument name="arrayString" dpl=" rdbms" value=" getDataByIndex" index="0"/></run> <run name="CSV example 1" testclass="simple.print" method="print" langtype="java">argument name="arrayString" dpl=" rdbms value=" getDataByIndex" index="2"/></run>
The first call will return the first row of the table (Pepe line) in a string array.
The second call will return index 2, which is the third row (Austelina).