Introduction to DataPool in Rational - Continued (4)

zhaozj2021-02-16  57

Actual application:

To illustrate the problem. I use VB, Delphi, and DOTNET to implement a simple add user, with the Access database in the background, and use the ADO to connect through the ODBC.

1. The structure implemented by the analysis is a simple C / S structure that is connected with an ODBC. And the client, the server side is configured in a computer. (Please note this is the condition, the basis of our second step)

2. Set Session Record Options

Recording method Select API Record recording, protocols use ODBC. (If I replace SQLServer or Oracle, other implementations should not change, what protocol should be selected, what protocol is added)

3. VB, Delphi encoding function script recording success (create the same name DataPool). The DOTNET script is recorded successfully, but it can't generate the same name DataPool. The unsuccessful script is as follows:

/ *

-> -> session file information <- <- <-

Created: Sun apr 25 23:24:36 2004

Name: g: /program/robot/lead/testdatathore/defaulttestscriptdataStore/TMS_SESSION/Demo.Wch

TYPE: Rational Robot - API

(with odbc)

* /

#include

{

Push timeout_scale = 200; / * SET TIMEOUTS TO 200% of Maximum Response Time * /

Push think_def = "lr";

Min_tmout = 120000; / * set minimum timeout_val to 2 minutes * /

Push Timeout_val = min_tmout;

/ * No DataPool items remain * /

/ * After all data analysis. * /

VbnetDemo = SqlConnect ("VbnetDemo", ", Lookup_PWD,

"Vbnetdemo", "ODBC",

"Driver_info = 'dsn =? ;; uid = default; pwd = default;'");

/ *

{INFO Server "Unknown" = "0.0.0.0";} * /

/ *

Unable to determine server name / address * /

SET Server_Connection = VBNETDEMO;

Push think_avg = 0;

STMT_2_1_ID = SQLOPEN_CURSOR ["pre001"] "", "select * from login";

SET think_avg = 313;

Push CS_BLOCKSIZE = 1;

SQLFETCH_CURSOR ["pre002"] STMT_2_1_ID, ALL_ROWS;

SET Think_AVG = 0;

SQLClose_cursor ["pre003"] STMT_2_1_ID;

SET Think_AVG = 4078; STMT_2_2_ID = SQLOPEN_CURSOR ["PRE004"] "," Insert Into `Login` (` Name`, `password`) VALUES (?,?)",

"'f / 002' ",

"'f / 002' ";

SET Think_AVG = 0;

SQLFree_cursor (STMT_2_2_ID);

SET think_avg = 2781;

SQLFree_Cursor (STMT_2_1_ID);

Sqldisconnect (VBnetDemo);

POP [think_def, think_avg, timeout_val, timeout_scale];

POP CS_BLOCKSIZE;

}

Point Edit-> DataPool Information error does not have DataPool config, then modify the script

4. After modifying the script as follows

/ * -> -> session file information <- <-

Created: Sun apr 25 23:24:36 2004

Name: g: /program/robot/lead/testdatathore/defaulttestscriptdataStore/TMS_SESSION/Demo.Wch

TYPE: Rational Robot - API

(with odbc)

* /

#include

{

Push timeout_scale = 200; / * SET TIMEOUTS TO 200% of Maximum Response Time * /

Push think_def = "lr";

Min_tmout = 120000; / * set minimum timeout_val to 2 minutes * /

Push Timeout_val = min_tmout;

/ * No DataPool items remain * / red font is unable to generate DataPool explanation

/ * After all data analysis. * /

DP1 = datapool_open ("lead"); // Add script

DataPool_Fetch (DP1); // Add script

VbnetDemo = SqlConnect ("VbnetDemo", ", Lookup_PWD,

"Vbnetdemo", "ODBC",

"Driver_info = 'dsn =? ;; uid = default; pwd = default;'");

/ *

{INFO Server "Unknown" = "0.0.0.0";} * /

/ *

Unable to determine server name / address * /

SET Server_Connection = VBNETDEMO;

Push think_avg = 0;

STMT_2_1_ID = SQLOPEN_CURSOR ["pre001"] "", "select * from login";

SET think_avg = 313;

Push cs_blocksize = 1; SQLFETCH_CURSOR ["pre002"] STMT_2_1_ID, All_ROWS;

SET Think_AVG = 0;

SQLClose_cursor ["pre003"] STMT_2_1_ID;

SET think_avg = 4078;

STMT_2_2_ID = SQLOPEN_CURSOR ["pre004"] "," Insert Into `Login` (` Name`, `password`) Values ​​(?,?)",

"'f / 002' ",

"'f / 002' ";

SET Think_AVG = 0;

SQLFree_cursor (STMT_2_2_ID);

SET think_avg = 2781;

SQLFree_Cursor (STMT_2_1_ID);

Sqldisconnect (VBnetDemo);

POP [think_def, think_avg, timeout_val, timeout_scale];

POP CS_BLOCKSIZE;

}

// Next is the added script

DataPool_Config "Lead" override dp_nowrap dp_sequential dp_shared

{

Exclude, "rpcarg", "string", "f";

Exclude, "rpcarg", "string", "f";

}

After the script modification is complete, the error is resolved and can open the DataPool Information.

4. Establish DataPool.

The EXCLUDE meaning is to create DataPool but read data from the actual recorded script when the script is not established in DataPool.

INCLUDE creates a field of the same name in DataPool, read data from DataPool when running scripts. Override establishes the same name field in DataPool, read data from the actual script when running scripts.

Modify DataPool's Usage Properties for include, create a DataPool field, generate data, modify data (add data in test cases)

5. (Determine the normal operation of the script) ROBOT run the script, start TestManager, point Run Suit. Or start Suit directly in TestManager, modify CHANGAGE, select script

6. Multi-user access. Run 20 users simultaneously access the server (Modify Number of Users in Suit), run, modify the number 20, and run

7. We need to access multiple users at the same time, but the data is different.

Modify Usage Properties Exclude for include.

Modifying the Access in Playback Behavior in DataPool Information is RADOM

Use script data is Obey Usage. Run the SuitManage in TestManage.

The second actual application example is relatively simple, but the situation that may be applied is simple, the center is introduced to the use of DataPool, basically introduced the place that DataPool affects it to everyone. I hope everyone is applying from actual work. Make our test work more on the stairs. Note: The above example is running on the Rational 2003 version.

reference:

Ratonal Robot User's Guide

Rational TestManager User's Guide

转载请注明原文地址:https://www.9cbs.com/read-23768.html

New Post(0)