Software QA FYI - SQAFYI

Mercury WinRunner FAQ

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33   34  35  36  37  38  39  40  41  42  43  44  45 

Q: Why Have TSL Test Code Conventions

TSL Test Code conventions are important to TSL programmers for a number of reasons:
. 80% of the lifetime cost of a piece of software goes to maintenance.
. Hardly any software is maintained for its whole life by the original author.
. TSL Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.
. If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.


Q: Test Script Naming

Test type + Project Name + Version Number + Module name + Test script Function .
For example:
Test type = UAT
Project Name = MHE
Version of the Project = 3.2
Module Name = Upload
Function Name = Excel_File
So the entire file name would be UAT_MHE_3.2_Upload_Excel_File
Note & Caution :
. Make sure the entire file name saved is below 255 characters.
. Use the underscore "_" character instead of hyphen "-" or " " character for separation.
. Highly recommended to store the test scripts remotely in a common folder or in the Test director repository , which are accessible and can be accessed by the test team at any time.
. Do not use any special characters on the test script name like "*&^ #@!" etc .,
. In this document - script or test script(TSL) means the same , pls don't get confused


Q: Test script Directory structure:

Winrunner recognizes the testscript as a file which is stored as a directory in the Operating system. The script 's TSL code , header information , checklist files , results , expected results etc are stored in these directories for each and every script.
. Do not modify or delete anything inside these directories manually without consulting an expert.
. Try to have scripts, which have lines less than or equal to 500
. While creating multiple scripts make sure they follow the directories and subdirectory structure (ie) Every script is stored in their respective modules under a folder and a main script which call all these scripts in a Parent folder above these scripts.In a nutshell "All the scripts must be organized and should follow an hierarchy ".
. If a module contains more than 2 scripts , a excel file is kept in the respective folder , which gives details of the testscripts and the functionality of these scripts in a short description E.g the excel sheet can contain fields like TestPlan No, Test script No, Description of the Testscript, Status of Last run, Negative or a non-negative test.
. Also make sure that evert script has a text file , which contains the test results of the last run.
. Maintenance of script folder that has unwanted files and results folder must be cleaned periodically.
. Backup of all the scripts (zipped) to be taken either in hard drive, CD-ROM, zip drives etc and kept safely.


Q: Comments

All the TSL script files should begin with a comment that lists the Script name, Description of the script, version information, date, and copyright notice:

#################################################################
# Script Name: #
# #
# Script Description: #
# #
# Version information: #
# #
# Date created and modified: #
# #
# Copyright notice #
# #
# Author: #
#################################################################
Comments generated by WinRunner.
WinRunner automatically generates some of the comments during recording..If it makes any sense leave them, else modify the comments accordingly
Single line comment at the end of line.
Accessfile = create_browse_file_dialog ("*.mdb"); # Opens an Open dialog for an Access table.
It is mandatory to add comment for your test call
Call crea_org0001 (); #Call test to create organization
It is mandatory to add comments when you are using a variable which is a public variable and is not defined in the present script.
Web_browser_invoke (NETSCAPE, strUrl); #strUrl is a variable defined in the init script
Note:The frequency of comments sometimes reflects poor quality of code. When you feel compelled to add a comment, consider rewriting the code to make it clearer. Comments should never include special characters such as form-feed.


Q: Creating C DLLs for use with WinRunner

These are the steps to create a DLL that can be loaded and called from WinRunner.
1. Create a new Win32 Dynamic Link Library project, name it, and click .
2. On Step 1 of 1, select "An empty DLL project," and click .
3. Click <OK> in the New Project Information dialog.
4. Select File New from the VC++ IDE.
5. Select "C++ Source File," name it, and click <OK>.
6. Close the newly created C++ source file window.
7. In Windows Explorer, navigate to the project directory and locate the .cpp file you created.
8. Rename the .cpp file to a .c file
9. Back in the VC++ IDE, select the FileView tab and expand the tree under the Projects Files node.
10. Select the Source Files folder in the tree and select the .cpp file you created.
11. Press the Delete key; this will remove that file from the project.
12. Select Project Add To Project Files from the VC++ IDE menu.
13. Navigate to the project directory if you are not already there, and select the .c file that you renamed above.
14. Select the .c file and click <OK>. The file will now appear under the Source Files folder.
15. Double-click on the .c file to open it.
16. Create your functions in the following format:

#include "include1.h"
#include "include2.h"
.
.
.
#include "includen.h"
#define EXPORTED __declspec(dllexport)
<return type> EXPORTED <function1 name>(<type arg1> <arg1>,
<type arg2> <arg2>,
…,
<type argn> <argn>)
{
<function body>
return <some value>;
}
.
.
.
<return type> EXPORTED <functionN name>(<type arg1> <arg1>,
<type arg2> <arg2>,
…,
<type argn> <argn>)
{
<function body>
return <some value>;
}
17. Choose Build <Project name>.DLL from the VC++ IDE menu.
18. Fix any errors and repeat step 17.
19. Once the DLL has compiled successfully, the DLL will be built in either a Debug directory or a Release directory under your project folder depending on your settings when you built the DLL.
20. To change this setting, select Build Set Active Configuration from the VC++ IDE menu, and select the Configuration you want from the dialog. Click <OK>, then rebuild the project (step 17).
21. All the DLLs types that you are going to create are loaded and called in the same way in WinRunner. This process will be covered once in a later section.

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33   34  35  36  37  38  39  40  41  42  43  44  45 

Mercury WinRunner FAQ