Test Suite Manual

advertisement
Trantor Ltd
Copyright © 2006, 2011
Trantor Test Suite
Use of Visio diagrams to create test scripts and data
Overview
It is possible in most cases to design and display test cases in a hierarchical form,
using the Visio “Organization Chart” format.
This has been shown in practice to offer the following benefits
 Functional coverage is more complete, as omissions are easily identified
 Pictorial representation is an aid to understanding the test scripts
 Documentation errors are more likely to be identified
 Design defects are recognised early in the development
 Document updates are easier to apply to test scripts
 Test planning is facilitated
 Testing effort is estimated
 Test creation effort is reduced
 Expected results can be calculated directly from the actual test data
By suitable formatting of the Visio chart, test scripts, test data files and an automated
test script can be produced by VBA macros from the Visio text itself. This replaces
much of the effort needed to create manual and automated test scripts.
This document should be used in conjunction with the sample Visio diagrams
provided.
Neil Jennings
Page 1
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Contents
Overview .................................................................................................................... 1
Process Stages ............................................................................................................ 4
Stage 1 example: .................................................................................................... 5
Stage 2 example: .................................................................................................... 6
Stage 3 example: .................................................................................................... 7
Part 1: Test cases and simple test scripts ................................................................... 8
Definitions.............................................................................................................. 8
Test Case ................................................................................................................ 8
Preparing the Visio Diagram ................................................................................. 8
Conditions, User Actions and Expected results ................................................... 11
Business requirement mapping *R ...................................................................... 12
Test Planning and dependencies *T:.................................................................... 14
Labels :A .............................................................................................................. 16
Defects *D ........................................................................................................... 16
Test Effort *M...................................................................................................... 16
Test Elapsed time *E ........................................................................................... 16
Useful menu functions ......................................................................................... 18
Computer-assisted Script Creation ...................................................................... 20
Running the Renumber and Refresh commands .................................................. 20
Licence number .................................................................................................... 22
Reports generated by Renumber and Refresh functions ...................................... 23
Custom Menu ....................................................................................................... 26
Default Thread (menu item and command button) .............................................. 26
Select Subtree (menu item and command button) ............................................... 26
Running the Scripts processes to generate Test Scripts ....................................... 27
Script Control Commands within shapes:............................................................ 28
Repeat .................................................................................................................. 28
Repeat All ............................................................................................................ 28
Go To ................................................................................................................... 28
Part 2: Enhanced Test Scripts .................................................................................. 29
Version Control (optional) ................................................................................... 29
Creating the Excel Test Script (Manual script).................................................... 32
Amending a Visio diagram .................................................................................. 32
Test Results and Metrics (Optional) .................................................................... 32
Reports generated by Script functions ................................................................. 33
Part 3: Winrunner scripts and Test Data creation .................................................... 35
Defining the Test Data ......................................................................................... 35
Definitions............................................................................................................ 35
Automated Test Actions – Assistant shapes ........................................................ 35
Variables .............................................................................................................. 35
The EVAL (evaluate) function ............................................................................ 36
Data and External references ............................................................................... 37
INCLUDEPATH statement ................................................................................. 37
INCLUDE statement ............................................................................................ 37
DEFINE and POPULATE statements (in assistant shape) .................................. 37
Consultant shapes................................................................................................. 41
DefaultThread, Goto’s, CALL and REPEAT: Advanced features ...................... 43
Repeat All ............................................................................................................ 44
CALL ................................................................................................................... 45
Neil Jennings
Page 2
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Go To ................................................................................................................... 46
Data steps ............................................................................................................. 47
Use Case precursors ............................................................................................. 47
Test case preconditions and data.......................................................................... 47
Test Specifications ............................................................................................... 47
Checking the output from Automated tests ......................................................... 47
Adding the test data and automation scripting to the chart .................................. 48
Generating the Test Scripts .................................................................................. 49
Reports generated by Scripts functions................................................................ 49
Appendix 1: Test Case renumbering problems ........................................................ 50
Test cases not numbered left to right in the diagram ........................................... 50
Duplicated test case numbers ............................................................................... 50
Appendix 2: Structure of the Automated Test Script............................................... 50
Appendix 3: Automation syntax notes ..................................................................... 50
Appendix 4: Action Control characters in Visio charts ........................................... 51
Appendix 5: Quality Center restrictions .................................................................. 52
Test History.......................................................................................................... 52
Reserved characters: ............................................................................................ 52
Appendix 6: MS Visio software defects .................................................................. 53
Sheet Shape bug ................................................................................................... 53
Appendix 7: Diagram export/import ........................................................................ 55
Appendix 8: Chart Preparation – Importing the VBA files ..................................... 56
Appendix 9: Built-in variables ................................................................................. 58
Neil Jennings
Page 3
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Process Stages
Trantor Test provides a seamless progression from test design to test execution.
Three stages of increasing functionality have been defined:

Stage 1 is the minimum required for manual testing.
Charts in stage 1 format can be used directly by testers, who can run the tests
by referring to the Visio diagram. The act of creation of a stage 1 diagram is
also useful for verifying the design documentation.

Stage 2 is designed to produce manual test scripts suitable for import to a test
repository such as Quality Center.
Charts in stage 1 format can be progressed to stage 2 simply by adding script
generation and control information. The script design is not changed.

Stage 3 is designed to produce automated scripts for import to tools such as
Winrunner and Loadrunner. It is also used for creating test data.
Charts in stage 2 format can be upgraded to stage 3 by the addition of data
definition and generation items to the existing structure, as well as automation
commands.
Neil Jennings
Page 4
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Stage 1 example:
This shows a test design for a simple Login screen:
Advantages of using this method for test design include:
 Tests are created very quickly
 Test cases can be derived directly from design documents
 Coverage can easily be demonstrated
 Tests are easily modified when the design is changed
 Test status and defects can be recorded in the chart if required
 Tests blocked by known defects are easily identified
 Uses only existing software (Visio)
Neil Jennings
Page 5
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Stage 2 example:
When planning to create formal test scripts from the chart, the Visio charts should
be prepared as specified in stage 2. Codes have been added to the text to drive the
script generation, and also markers such as *R for business requirement, and *T
for test priority.
Extra advantages of stage 2 are:
 Effort to create and document manual test scripts is much reduced
 Scripts can be mapped to requirements, and a cross reference is produced
 Script narrative in text format can be created, containing estimated effort
 Scripts can be exported to Excel, for import to test repository such as Quality
Center
 Scripts in the repository are easily modified when the design is changed
 Scripts can be selected for execution by priority, aiding risk-based testing
Neil Jennings
Page 6
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Stage 3 example:
The charts can be further updated to stage 3, in which test data files and automation
scripts can be produced. The shapes in blue have been added to the previous diagram
to specify the test data and scripting for the tests, leaving the logic unchanged.
Further advantages of using stage 3 are:
 Effort to create test data and automated scripts is much reduced
 Data and Automated scripts are kept in step with test design and manual cases
 Scripts and data are easily modified when the design is changed
 Each test can be scripted once but repeated with several sets of data
 Expected results can be calculated programmatically using EVAL function
Neil Jennings
Page 7
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Part 1: Test cases and simple test scripts
Definitions
Test Step
A test step is a single line within a test script. It can be a user action, system response,
a pre-condition or a post-condition.
Test Case
A set of test steps for a single test. It is known as a “thread” in the diagram.
Test Set
A set of test cases which are represented as one or more tree structures in a single
diagram (even if spread over several pages). They are usually based on a single set of
design documents, for example a single Use Case.
Test Script
A manual or automated test script is one or more test sets prepared in Excel format,
suitable for input to a test tool or repository.
Preparing the Visio Diagram
To make use of the scripting features, the test case tree must follow a defined
structure:
One or more Executive shapes are used as the top level entry points.
Each executable test step, precondition or test result is held in a Manager
shape, which must be attached to its owner by using the automated method
(i.e. Drop the subordinate shape onto its owner – Visio will then connect it for
you. Manually adding connectors will NOT work!).
Unattached shapes will be ignored by the various functions.
The final mandatory box in each thread is a Position box which contains a
description of the test case and the test number.
When using the Visio chart for test recording, it is possible to add an assistant
shape to each position shape, containing text starting with the word “Pass”,
“Fail” or “Blocked”. Test metrics can be calculated by Trantor Test from these
assistant shapes.
Neil Jennings
Page 8
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
So a typical structure would look like this (before colouring).
Neil Jennings
Page 9
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Example of the use of the assistant shape for holding test status:
Neil Jennings
Page 10
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Test case numbers
All test case numbers are held in the terminal Position shapes, enclosed within
brackets ( ). Only the LAST pair of brackets in the shape will be used. If an item
longer than three characters is found within these brackets, or no number is found, an
error message is given and the test case is not renumbered.
Manager shapes - Test case step descriptions
The test steps should be described in sufficient detail that they are meaningful to a
tester. (Remember that within Quality Center, the tester cannot see other test cases
when executing a test, so a test should be self-contained.)
Conditions, User Actions and Expected results
You can identify each of these by preceding them, within the Manager shape, by a
marker string
<<
for pre-conditions
==
for user actions
>>
for expected results and/or system actions.
%% for post-conditions
Pre-conditions are the conditions necessary for the specific test case to be executed.
(They can also include instructions for suitable test data.). These have no effect other
Neil Jennings
Page 11
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
than to inform the tester. All preconditions of a test case are listed in the test case
description within the generated Excel script file.
The classification of an item as a precondition may depend on various factors. Thus
“System performs Use Case 01” may be treated as either a precondition or an
expected result, depending on whether the result is observable, and on whether this is
part of the specific test case. Basically, it means a step that is necessary, but that the
tester does not have to check the output specifically.
User actions are the test steps themselves. For a batch system, they may be the
actions which trigger this function, whether or not manually supplied.
Expected results are (observable) data and system actions expected as a result of the
user action(s). There is little point in including results which cannot be checked, for
example intermediate results which are not saved.
Post-conditions are any significant system states after the test has completed. They
may not necessarily be related to system actions, for example, if a requirement is that
a particular item is NOT changed by the test.
Examples:
==User clicks cancel
>> System displays confirm cancel message
Note: It is recommended for clarity that each action is coded in a separate
manager shape. However, there is a performance restriction in older versions
of Visio which makes it desirable to be able to include multiple actions in a
single shape.
As well as the description of the test step, manager (and assistant) shapes can contain
comments enclosed between ^ signs. Comments are intended for use within the chart,
and will not be exported to the test scripts.
Business requirement and test chunks can be included in the format noted below.
Business requirement mapping *R
One or more business requirements can be coded within each manager shape, in the
format *R xxxxxx. If present in this format, they will be included in the AEF report.
(see below) and in the text of the corresponding test steps. Requirements can also be
coded in any assistant shape which is attached directly to a manager.
The format *Rn xxxxxx can also be used, where n is a digit (1 to 4), to assign
business priorities to the requirements. A higher number indicates higher priority.
Neil Jennings
Page 12
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
The Renumber, Refresh and Test Script functions will produce a requirements list,
with each requirement shown only once, to help verify coverage, and will also
produce a cross reference of all requirements to test cases.
If no business requirement is present in a test case, the AEF number within square
brackets (such as [AEF0664] above) will be used as a default.
Neil Jennings
Page 13
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Test Planning and dependencies *T:
Test priorities can be represented by using *T n. This works in a slightly different way
to business requirements, in that only the LAST one found, working downwards, is
reported. Therefore you can put the whole of a test set in priority 1 (Low), and then
selected threads can be placed in chunks 2, 3 and so on. The priority n should be a
single digit. The program will calculate the overall priority of a test case by
multiplying the test priority by the business priority. The test priority can also be
coded in an assistant shape attached directly to a manager.
Neil Jennings
Page 14
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Test Case terminator (Position shape)
The purpose of this item is to mark the end of a test case and to supply its description
and reference number. It is NOT an executable test step.
The contents of the position box (Test case terminator) should be a flow reference and
test description, enclosed in braces (curly brackets { }).
The flow reference should ideally be in the format MEFxxx (Main Event Flow) or
AEFxxx (Alternate Event Flow) which are recognised by the software and included in
the AEF reference list.
The flow reference should refer to a specific flow within the design document (e.g.
UML Use Case description). If there is no suitable flow reference within the source
document, then a reference may be created or assigned directly by the test designer.
The test case description should, where possible, be copied directly from the
description in the design document, to avoid errors in interpretation. All text within
the braces will be exported to form the test description, but any text added after close
bracket will not be exported.
The final item within the position shape is the test case number, up to 3 digits in
ordinary brackets ().
Notes:
When initially creating a Visio chart, the test case numbers will automatically
be inserted between the brackets by the renumber function.
The text within the braces will be used as the test case description when the
Test Scripts are generated.
Neil Jennings
Page 15
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
If the test case was created as a result of a defect report (e.g. against the
documentation), then you could use the defect reference.
Important: The position box is not a test script step, and user or system actions
should not be coded within it, as they will be ignored.
Ensure that the MEF or AEF number is in the correct format (no embedded spaces).
Hint: Where the AEF or MEF number is less than 10, it could be specified as
AEF_n, to ensure that you can later sort the AEF report into the correct
sequence. For 10 or more, it should be AEF10 etc. This helps to provide a
coverage check that all AEF’s have been addressed in the diagram.
Labels :A
Each REPEAT or CALL (see below) must refer to a label. Labels can be up to 12
characters long. They must be prefixed by a colon and be the first entry in their box,
so that the software can recognise them. (But no colon is used in the repeat itself). For
correct import into Quality Center, especially in stage 2 (see below), it is necessary
that each label is placed in a box by itself, with no other content.
Example: If you have “Repeat A” in a consultant shape, then you must have a box
whose text is “:A”. All declared labels are shown on the AEF report, to make it easier
to find them on the Visio chart.
Defects *D
If a defect (Test Incident) has been raised, but not resolved, it can be coded in
manager shapes or attached assistant shapes as *D xxxx where xxxx is the defect
reference or number. It should be coded at a suitable point in the hierarchy so that all
affected subordinate test cases can be identified. Defects can be listed against cases in
the AEF and test statistics reports by picking the appropriate column on the AEF
picker form.
Test Effort *M
*M followed by an integer (representing a percentage) can be used (in assistant
shapes ONLY) to indicate the complexity of a script as a percentage. For example *M
150 would be used to indicate that this was 1.5 times as complex as a standard script,
thus requiring more time to run. Only one factor is taken into account for a particular
test, which is the one nearest the bottom of the diagram. This allows a generic factor
high in the tree to be overridden by more specific factors for individual tests. The
factor is multiplied by the number of steps to indicate total expected effort per test
script in the “Test Narrative” report.
Test Elapsed time *E
*E followed by an integer (representing a number of minutes) can be used in manager
and assistant shapes to indicate the expected timing of a script step or series of steps.
For example, *E 60 would be used to indicate that this step was expected to take one
hour. Useful for batch jobs which may take some hours to execute. The total elapsed
time for each complete script, calculating by summing all the individual steps, is
Neil Jennings
Page 16
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
shown in the Test Narrative report. Default time for each test step is assumed to be 1
minute in addition to any specified times.
Audit Trail information
The executive shape at the top of the Visio chart may contain the version number
and/or Use case version within curly brackets { }. If present, these will be copied into
the generated test script.
Shape Fill Colours
The fill colours of the shapes in the chart are set according to the type of shape and,
for manager shapes, the text within the shape. This may be done manually, using the
menu options, or automatically when the renumbering or test script functions are run.
You don’t get to choose the colours – they are preset. If there is sufficient demand, a
selection form could be implemented later.
Neil Jennings
Page 17
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Useful menu functions
A number of menu functions have been provided. They are not part of the test
scripting, and are just present to help in creating the Visio diagrams.
On the TRANTOR menu, there are:
For all shapes on current page:
Colour shapes by type
Fills all shapes on the page except Manager with different colours.
Only fills shapes if they are currently white or not filled – it does not
change colours already assigned.
Colour shapes by action
Fills all shapes on page as above, and also fills Manager shapes
depending on the type of action in the text (Precondition, user action
etc.) Only fills shapes if white or not filled, does not change colours
already assigned.
Resize shapes on page
Resizes all shapes on a page to be large enough to contain the shape
text.
Page:
Insert tree on page
Inserts on a page a tree with an owner and three subordinates, all
Manager shapes.
Insert new page
Inserts a new page with a complete Test structure.
Add Table of Contents to first page
Inserts a ToC with a list of pages and hyperlinks to them.
For selected shape
Select default thread
Selects all shapes, from the Executive down, in the default thread for
the tree in which the selected shape resides. Valid for Manager and
Consultant shapes only. To assist with copy and paste.
Select Subtree
Selects all shapes in all threads in which the selected shape resides.
Valid for Manager and Consultant shapes only.
Add Tooltip to shape
Allows the user to add a tool tip (mouse-over comment) to the
selected shape.
Resize shape
Resizes the selected shape as above
Neil Jennings
Page 18
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
On the Shape menu (Right mouse button) there are
For Consultant and Manager shapes:
Select default thread – as above
Select subtree – as above
For Consultant, Manager and Position shapes
Insert Manager above
Inserts a Manager shape immediately above the current shape.
Warning - if the owner of the selected shape has more than one
subordinate, no action will be taken, otherwise the tree would be
automatically realigned on the page, because the command operates
by disconnecting and reconnecting shapes.
Insert Consultant above
As above, but inserts a Consultant shape
Resize shape(s)
Resizes all selected shapes to be large enough to contain the shape
text.
Respace above
Adjusts the spacing between selected shapes and their owner(s).
Warning - if the owner of a selected shape has more than one
subordinate, no action will be taken, otherwise the tree would be
automatically realigned on the page, because the command operates
by disconnecting and reconnecting shapes.
Colour shape
Colours all selected shapes by action, as above
For Assistant shapes only:
Update Status – updates the text to a selected status value.
For Position shapes only:
Add Status – adds a subordinate Assistant containing a status value.
Neil Jennings
Page 19
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Computer-assisted Script Creation
Running the Renumber and Refresh commands
The Renumber command updates the test case numbers and generates some reports. It
is usually most used during the creation of the test design chart. The Refresh
command is exactly the same as Renumber, except that it does not change the test
numbers. Its purpose is just to refresh the various reports.
Open the Visio chart, if not already open
If the menu Trantor is present, click on that and select Main
Otherwise:
Click on Tools, then Macros on the menus
If the entry TranMac is present, click on that and select Main
If not present, see Appendix 8 to install the VBA code.
The main form, as shown below, will be displayed.
Initial setup:
Check the Paths tab, and ensure that the Output path and Include path shown
are correct – they will default to a suitable folder, and will offer to create it if
not present. You should also enter the correct pathname for Excel.
QC Import path is for use in the QC spreadsheet only, and is the path within
QC where the script will be stored when imported.
New feature: You can copy the default paths from a previous Visio – but use
only the first seven characters of the Visio filename.
Neil Jennings
Page 20
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Check the Picker tab to ensure that all required columns will be present in the
QC script.
Custom columns can be populated by using variables, as described later in the
document. These need to be declared in an assistant shape attached at the top
level in the first page, so that they are available globally. The value declared
will be passed through directly to the test script.
Example: ??_custom1=“Value”
(A Column picker is also available for the AEF report)
Neil Jennings
Page 21
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
On the Main form:
Enter the Test Designer name.
Click on the Renumber button
Licence number
You may be asked to provide a licence number. In the evaluation version of
the scripts, the licence number changes each month. A list will be supplied as
required.
This prompt will happen
a) When you first run a new chart
b) When a different user opens an existing chart
c) At the start of a new month
The licence number is then saved in the registry and will not be requested
again for this Visio chart (until next month, if using the evaluation version).
In fact, for convenience, all charts whose filenames start with the same seven
characters will share the same set of saved defaults, including the licence.
Neil Jennings
Page 22
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Click on OK
When running the command:
You will have to click on OK on the message box
A message Finished is displayed at the end (it may also report errors or
warnings)
When the renumbering is finished, the View AEF button will be enabled. You can use
this to view the AEF summary file which has been created.
If there were errors found in the chart structure, then the View Errors button will be
enabled, and you can view a text file to see the error descriptions.
Note for Quality Center users:
See the Quality Center restrictions listed in Appendix 5 before using renumber.
Due to (Quality Center) limitations, because metrics are gathered by test case number,
the chart should NOT be renumbered after the test script has been imported to Quality
Center. Any subsequent new test cases should be manually numbered, for example by
using alpha suffixes: 01a, 01b. The Refresh function can be used to refresh the
reports.
Reports generated by Renumber and Refresh functions
All these files will be placed in the outputs directory, as specified on the PATH form.
Renumber Error report TXT file
Filename will be in format xxxx_renumber_errors.txt. where xxxx is the Visio
file name.
This file will report any anomalies found in the structure, such as manager
boxes with no subordinates. The content of such boxes is shown on the error
report, and they are also identified on the Visio chart.
List of AEFs, Labels and Test groups within each test case, for checking
coverage. Filename will be in format xxxx_AEF.csv.
It can be used (more easily if you sort it into AEF sequence) to check that each
AEF in the use case has been coded within the Visio chart, and for stage 3
Neil Jennings
Page 23
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
diagrams, it will also provide a list of all Winrunner constants used in each test
case. It also lists the business requirements found in each test case, to provide
a cross reference.
Requirements list
A CSV (Comma Separated Variable) Excel file is created with a list of all the
business requirements which have been found in the diagram. Each will be
listed only once, regardless of how many instances exist in the diagram.
Filename will be in format xxxx _RequirementList.csv
Requirements cross reference
A CSV (Comma Separated Variable) Excel file is created with a list of all the
business requirements which have been found in the diagram. Each will be
listed against each test case in which it occurs.
Filename will be in format xxxx _crossref.csv
Summary of the test case, which can be compared with the Use Case.
Filename will be in format xxxx _TestCase.txt.
You need to clear any reported errors before proceeding. The renumber function will
change test case numbers so far as it is able, so the numbering may be inconsistent if
errors are found.
Files which are updated
These files are written to the directory specified in Priority File path. If not present,
they will be created. Each record contains a timestamp, so that the latest entry can be
determined.
Priority.csv
One line is appended which contains the numbers of test cases for each
priority.
Requirements.csv
One line is appended which lists all the requirements addressed in the script.
Metrics.csv
One line is appended which contains counts of tests passed, failed, blocked or
not run.
VISIO BUGS – see important notes in the appendices.
WARNING – do not use the Convert Shape action. This just changes the way
a box is displayed, but does NOT change its internal type, therefore it will not
be recognised correctly by the VBA scripts. Create a new shape of the correct
type, and paste the contents from the incorrect shape.
WARNING – never use the Re-Layout menu option. This sometimes
completely screws up the chart, and UNDO does not recover it properly.
Create a new shape of the correct type, and paste the contents from the
incorrect shape.
Neil Jennings
Page 24
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
You may find that the Renumber function does not number test cases in the expected
(left to right) sequence. If you need them to be in this order, you may need to move or
even recreate some boxes at branch points. See Appendix 1 ‘Test case renumbering
problems’ for details.
Neil Jennings
Page 25
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Custom Menu
When the Main process has been run for the first time, it creates a custom menu item
called Trantor. The menu is automatically saved with the Visio chart. The main test
scripting form can then be accessed from the menu item Main.
Default Thread (menu item and command button)
The sequence in which Visio walks the hierarchy is difficult to control, and not
obvious in the diagram (although it is the same sequence in which the shapes are
numbered). It uses the rule that it visits the various subordinates in the order in which
they were attached to the master
By convention, the ‘Happy Path’ or Main Event Flow, is the first executed. To assist
in identifying this test case, a procedure (Default Thread) has been provided which
will select the whole default path below one selected shape. You must select the first
manager shape and then run the function, which will select and highlight all the other
boxes below it in the test case (including vacancy shapes), as well as the owners back
to the executive, and the dynamic connectors.
Note that the selected manager shape MUST be connected to an executive shape via
the hierarchy, or nothing will be selected.
If the test case highlighted is NOT the leftmost test case at each branch point, and
your local standards require left-to-right numbering, then the numbering may need
changing. See appendix 1 ‘Test Case renumbering problems’.
In some cases, the default test case is not suitable, due to different data conditions
being required (see the note on precondition clashes).
Select Subtree (menu item and command button)
This option will select the entire subtree owned by the selected shape, as well as the
path back to the owning executive shape. (The connectors are also selected, to
facilitate copy and paste)
Neil Jennings
Page 26
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Running the Scripts processes to generate Test Scripts
This should only be done after the renumber script has been successfully run and all
errors cleared.
Open the Visio chart, if not already open
Select Main from the Trantor menu on the menu toolbar
(If not present, Click on Tools, then Macros on the menus
If the entry TranMac is present, click on that and select Main)
The main form will be displayed.
Ensure that the output path shown on the Paths tab is correct – it will default to
a suitable folder, and will offer to create it if not present.
Click on the either Manual Script or Both button.
If you use the Manual script button, then the Automated script is not
saved.
The Automated script (e.g. Winrunner) will only be created if suitable
commands have been coded within the Visio chart (see below)
The main output file required is the Manual Test Script, in an Excel spreadsheet with
filename of the form format xxxx_TestSteps.xls
It also produces the list of AEFs, and requirements for each test case, for checking
coverage. Filename will be in format xxxx_TestStats.txt.
Script Error report TXT file
Filename will be in format xxxx _script_errors.txt.
This will report any anomalies found in the structure, such as manager boxes with no
subordinates. The content of such boxes is shown on the error report.
Neil Jennings
Page 27
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Script Control Commands within shapes:
Repeat
The Repeat command, available only in consultant shapes, will generate a test script
for just the default test case subordinate to the target label.
The command format is “Repeat A”, where A is the target label.
Repeat is ignored by the renumber command.
Repeat All
This format of the Repeat command will generate test scripts for every test case
subordinate to the target label. If the target test case itself contains Repeat commands,
a very large number of tests could be generated. For this reason, it is recommended
that nested Repeats are not used.
The command format is “Repeat A all”, where A is the target label.
Repeat All is ignored by the renumber command.
Go To
This is an instruction used for manual testing only. It is similar to Repeat, but does not
generate any test script for the target branch. It is often used to indicate a return to a
previous state, such as redisplaying a screen.
Neil Jennings
Page 28
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Part 2: Enhanced Test Scripts
Version Control (optional)
In order for the Visio version control and Use case version to be reflected in Quality
Center, they can be coded within { } in the executive shape. For Visio diagrams with
two or more pages, this should be in the executive to which test case 00 is attached.
Example:
Neil Jennings
Page 29
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Test Control Facilities – Consultant shapes
Consultant shapes can be used to hold FOR or WHEN statements, described below.
These can be used to run a single test case (or a related group of cases) with several
different test values, or to run a case only for a specific value from a set.
They can also hold REPEAT commands, which will include test steps subordinate to
a specified label.
These are used in conjunction with variables.
Example of When command:
Neil Jennings
Page 30
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Example of the FOR command. This will repeat the subordinate thread for each value
in the list, generating four test cases. The “define” will load a different set of data for
each case, due to the use of textual replacement in the name.
Neil Jennings
Page 31
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Creating the Excel Test Script (Manual script)
The spreadsheet is created by clicking the Manual Script button on the main form. It
is suitable for use either directly for testing, or for import to Quality Center.
Checking the Test Script spreadsheet
It is helpful to create a draft of the test script spreadsheet when amending a Visio
chart, because errors can be recognised and corrected at an early stage.
Check that the test description column is correctly populated, and if possible, check
that the preconditions do not contain any contradictions.
Check that the test cases are in the correct sequence, and amend the diagram as
described in Appendix 1 if not.
Amending a Visio diagram
There are some items which are only applicable if you are intending to export the
scripts to Quality Center. When a new version of a Visio diagram is prepared for
creating scripts to be imported to QC, the following should be observed.
1. The version number and Use case reference in the first executive box should
be updated. These are automatically copied into the test description to provide
an audit trail.
2. Within the same project, if the test scripts have already been imported to
Quality Center, then the test cases should NEVER be renumbered.
Renumbering will remove the audit trail and history of specific test cases.
3. Tests which are deleted can be replaced by dummy tests with the description
‘@@@@@ Test Deleted @@@@@’ in both the final manager shape and in
the terminal position shape. If a test is actually removed, Quality Center will
carry forward the old, unwanted, tests into the current test set.
4. New test cases should be numbered manually with an alphabetic suffix, e.g.
29a would follow test 29.
5. If you wish to remove a test, but leave the steps visible in the Visio chart, then
you can append them to a Vacancy shape containing a suitable comment. The
processing ignores Vacancy shapes.
Test Results and Metrics (Optional)
If you incorporate test results into your diagram, you can also produce the test metrics
within both the Test Stats report and the test script spreadsheet. To do this, you can
add an assistant shape to the terminating position shapes in the test cases. On the
shape menu for position shapes, there is an item “Add Status” which will do this for
you.
The test in the assistant shape should start with one of the following:
Development phase:
NOT COMPLETE – meaning the script is not yet completely written
Neil Jennings
Page 32
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
COMPLETE – the script is finished and ready for use
Execution phase:
PASS
FAIL
BLOCKED
NOT RUN (This is the default if no assistant shape is found)
On the shape menu for assistant shapes, there is an item “Update Status” which will
allow you to choose from the valid options. It will also colour the shape appropriately,
i.e. Red for fail or Not Complete, green for Complete or Pass.
“Blocked” is used when the planned test cannot be run for some reason, e.g. the
system cannot yet navigate successfully to this test, or there are outstanding defects.
Descriptive text can be added by connecting a vacancy shape. Note that you can add a
further assistant shape, for results of a retest, by attaching it to the previous assistant.
These settings are counted and displayed at the end of the Script generation, as well as
being written to the Test statistics report. A separate set of metrics will be provided
for each executive shape in the chart. One Test metrics line will be appended to the
Test Metrics file each time the Scripts function is run.
Reports generated by Script functions
All these files will be placed in the outputs directory, as specified on the PATH form.
Test Script file
Worksheet “Script” contains the test script in spreadsheet format, ready for
import to QC using the Excel add-in. Filename will be in format
xxxx_TestSteps.xls (or .xlsx) where xxxx is the Visio file name.
The columns included in this report can be selected using the QC picker tab on
the main form.
Worksheet “Metrics” contains a summary of test metrics.
Script Error Report text file
Filename will be in format xxxx_script_errors.txt where xxxx is the Visio file
name.
This file will report any anomalies found in the structure, such as manager
boxes with no subordinates. The content of such boxes is shown on the error
report, and they are also identified on the Visio chart.
Test Statistics report
Filename will be in format xxxx_TestStats.csv.
This contains a list of all test cases generated, followed by a summary of the
number on each page, and the number run (if using this facility)
The columns included in this report can be selected using the AEF picker tab
on the main form.
Neil Jennings
Page 33
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Requirements list
A CSV (Comma Separated Variable) Excel file is created with a list of all the
business requirements which have been found in the diagram. Each will be
listed only once, regardless of how many instances exist in the diagram.
Filename will be in format xxxx _RequirementList.csv
Requirements cross reference
A csv (Comma Separated Variable) Excel file is created with a list of all the
business requirements which have been found in the diagram. Each will be
listed against each test case in which it occurs.
Filename will be in format xxxx _crossref.csv
Summary of the test case, which can be compared with the Use Case.
Filename will be in format xxxx _TestCase.txt. This is more detailed than the
version created in the Renumber pass, and will replace it
You need to clear any reported errors before proceeding. The renumber function will
change test case numbers so far as it is able, so the numbering may be inconsistent if
errors are found.
Neil Jennings
Page 34
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Part 3: Winrunner scripts and Test Data creation
Defining the Test Data
It is possible to develop Automation (e.g. Winrunner) “Actions”, or generic function
modules for business activities. Execution of these Actions requires the user to
specify values for the input parameters for the function.
These actions will usually be specific to a particular installation or environment, and
are therefore held in an appendix. Some tailoring of the Trantor Test Suite software
may therefore be necessary.
The available functions and their associated parameters are typically described in the
site “Function Dictionary”. Where a suitable function doesn’t yet exist, analysts will
need to liaise with the Automation team to have one created.
Definitions
The Automated Test Script is a spreadsheet created in the format needed by the
installation’s test tool to perform the actions for each test. As well as its use for
individual use cases, the scripts can be combined into regression test packs for the
whole suite.
The test data file is created from assistant shapes used to specify test data, usually in
the form of a delimited text file.
Automated Test Actions – Assistant shapes
The assistant boxes should be attached ONLY to manager shapes, where necessary to
invoke the creation of actions within automated scripts. They provide input parameter
values for each action to drive the automated execution down the required path. These
boxes do not replace any existing chart content.
Assistant boxes can also be added to the Visio chart to define automated actions
required to set up data preconditions (e.g. create users) and to assign values to
variables used in other actions.
Variables
The user can control the generation and content of the scripts by using variables
within assistant shapes. For technical reasons, the variable name must be prefixed by
two question marks when being assigned a value (e.g. on the left side of an
assignment statement), or by “?#” when being evaluated (i.e. on the right-hand side).
A variable name must be terminated by an = sign when a value is being assigned, or
by a full stop elsewhere. This terminator is needed so that the program can distinguish
between, for example ??company and ??comp
Note that all variable names are case-sensitive.
Neil Jennings
Page 35
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Scope of variables
Global variables have names starting with underscore, like “??_pipe”. Their values
are retained until explicitly changed.
Other variables are known as Local variables. All Local variables, being those whose
names do NOT start with an underscore, obey hierarchic scoping rules:
1. They only apply BELOW the point at which they are defined in the tree
2. Values assigned are only available below the point at which they are defined.
3. When processing returns to a higher level in the tree, the value from that level
is restored.
You can include variable names on the RIGHT of the assignment in Assistant shapes,
but only in the format ?#name:
Examples of assignments
??companyid=12345678
??entity=?#companyid.
<<– will later be replaced by 12345678
??concat=?#companyid.?#_pipe.ABC will be replaced by 12345678|ABC
Variable names can be used in WHEN and FOR statements, and can also be coded in
the Automation scripts, where they will be replaced by the currently assigned value.
Variables can also be used within included files. For diagnostic purposes, you can
include the SHOW command in a consultant shape to display the current value of a
variable.
Some examples of the use of variables are shown in previous screen shots.
Built-in variables
Some built-in variables have been provided to overcome restrictions in the available
characters in Visio and Excel. These are listed in an appendix.
The EVAL (evaluate) function
You can use this function to set the value of a variable to the results of a calculation,
usually on the values of other variables:
Example: ??result=EVAL(?#arg1.*?#arg2. + SQRT(?#arg3.))
For the calculation to be successful, all variables used should contain numeric values.
This facility makes use of Excel to obtain the result, and the formula can therefore
include any valid Excel function which takes only numeric arguments. If the formula
is incorrect or any argument is not numeric, the value ERROR is returned.
Uses for EVAL include calculation of dependent values within data definitions, and
inclusion of expected results in test scripts. It can also be used to assign values to the
variables referenced within FOR and WHEN conditions, though the function itself
cannot be used there.
Neil Jennings
Page 36
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Data and External references
All Automation test data and test actions will be held within assistant shapes attached
to appropriate managers. These assistant shapes can also contain commands which are
use to copy sets of commands from external text files. These are INCLUDE,
DEFINE, POPULATE and INCLUDEPATH. (Populate is only available in Advanced
version of Trantor Test)
Several of these copy commands may be coded in one assistant shape, but if so, they
must currently all be of the same type.
Only one assistant can be attached to a manager shape. One assistant can be attached
to another, to produce a single chain of statements. The various commands will report
an error if two or more assistant shapes are attached to a manager or another assistant
shape.
INCLUDEPATH statement
The default path for external references such as INCLUDE is set in the Paths tab of
the main form. The INCLUDEPATH command specifies a full path name to be used
to override the default, for all subsequent INCLUDE commands. It must not contain
embedded spaces or quotes.
INCLUDE statement
This specifies the name of a text file to be copied into the current test script. At
present, the filename must not contain embedded spaces, nor quotes.
When used in a manager shape, the included text file may contain any text which is
allowable in a manager, such as user actions, system actions or preconditions. It can
also contain textual replacement variables.
When used in an assistant shape, the included text file should contain only variable
assignments. Included files may NOT refer to other INCLUDEs.
The program will insert comment lines before and after the included text, to identify
the file from which it was taken.
DEFINE and POPULATE statements (in assistant shape)
These specify the name of a text file or Excel worksheet to be copied into the current
test script. At present, it must not contain embedded spaces, nor quotes. The file or
worksheet contains a set of variable definitions and values which can then be used in
various places within the script. The action of the two is identical, the reason for
different commands is for clarification within the diagram.
DEFINE should be used for files which include a set of variables defining the
variables and their initial values, to be used for a test or set of tests. Note that any
incorrectly formatted definitions may result in spurious lines appearing in the Data
file. In particular, any data values containing spaces or certain reserved characters like
pipe should be enclosed in quotes.
Neil Jennings
Page 37
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Example of external file used in Define:
DEFINE can alternatively be used to specify a worksheet within an excel workbook,
where several columns of data values can be provided for one set of variable names,
for different test cases.
POPULATE is used to include files which define a test data (or expected results)
record layout by specifying the textual replacement variables and suitable delimiters.
The records produced will be written to the output test data file (Facility available
only in the advanced edition of Trantor test).
Example of a file used in a Populate statement:
Neil Jennings
Page 38
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Example of a script using text files (*.txt) to define test data and populate records:
Neil Jennings
Page 39
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Example using Excel worksheets:
Neil Jennings
Page 40
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Consultant shapes
These are used to hold user-defined logic, i.e. FOR, WHEN and REPEAT commands.
Assistant shapes should not be attached to consultant shapes, as they will be ignored.
WHEN statement
Format:
WHEN {variablename}{condition}{value}
where variablename is in the format ??xxx (or ??_xxx)
Note that the variable name does NOT need to be delimited.
Condition can be any of the following: =, <>, >, >=, < or <=
Value is a text string, optionally enclosed in either apostrophes or quotes.
Therefore you can include embedded, leading or trailing spaces.
It can also be a reference to another variable, in the form ?#xxx.
Examples:
a) WHEN ??blocked=false
b) WHEN ??testcase>?#_test2. (where ??_test2 has already been declared)
This statement must be the only item in a consultant shape. Variable name and data
value are both case-sensitive.
If the stated condition is true, the test case is included in the generated test scripts
(Both manual and automated versions), otherwise it is ignored.
FOR statement
Format 1:
FOR {variablename} IN {valuelist}
where
{variablename} is in the format ??xxx (or ??_xxx)
{Valuelist} is list of values separated by commas
{Valuelist} can include references to other variables
Example
FOR ??Data IN aa, "B B B B", ?#_hash.
This statement must be the only item in a consultant shape.
All subordinate test cases are executed for each value in the list. Each instance of one
test case will be given the same test reference, but with a suffix added for uniqueness.
The main intended use is for generating separate boundary condition tests/test data for
the same basic script. Therefore you may use values like -1, 0, 10,000.
Format 2:
FOR {variablename} ITER {fromvalue},{tovalue}
where
{variablename) is in the format ??xxx (or ??_xxx)
{fromvalue) is an integer
Neil Jennings
Page 41
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
{tovalue} is an integer and is greater than {fromvalue}
Example
FOR ??Data ITER 2, 5
This statement must be the only item in a consultant shape.
Both Manual and Automated tests will be generated for each value. Use this with
caution, because it is easy to generate huge numbers of test scripts.
SHOW statement
This will display a standard Windows message box with the variable name, value, and
formula. The user may then opt to turn off the display for the rest of the run.
SHOW {variablename}
{variablename} should start with ?? (Not ?#) and does not need to be
terminated by a full stop.
Example:
SHOW ??_uniq
Neil Jennings
Page 42
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
DefaultThread, Goto’s, CALL and REPEAT: Advanced features
The original concept of Repeat was that several paths could merge and make use of a
common thread for subsequent processing, rather than duplicate them. This has
proved to introduce further problems in the script and should be used with caution.
One particular problem identified has been described as a ‘precondition clash’ where
the preconditions for two test cases are different and incompatible. When such paths
are recombined, they may not give rise to executable tests.
Repeat will therefore by default only refer to the main path (aka Happy path, Sunny
Day Scenario) subordinate to the target point.
The Repeat All option (see below) can be used to script all subordinate tests when you
are sure that there are no such problems.
Use of Repeat within a test case also imposes serious restrictions on the use and
placement of data specifications. This is not due to the function itself, but due to the
need to accommodate different data and actions depending on the path taken.
For these reasons, some restrictions are required in respect of Repeat.
Repeat can only be used within a Consultant shape.
Repeat cannot refer to a higher point in the same structure, i.e. one already
visited, otherwise the program would loop.
Repeat cannot own any subordinate shapes, other than the Position shape
which contains the test description.
To assist in identifying the default test case which will be executed, a function
(DefaultThread) has been provided which will select the whole path. You must select
the first manager shape (i.e. the target of the Repeat) and then run the function, which
will select and highlight all the other boxes below (and above) it in the test case. Note
that the selected manager shape MUST be connected to an executive shape via the
hierarchy, or nothing will be selected.
If the test case highlighted is NOT the leftmost test case at each branch point, and
your local standards require left-to-right numbering, then the numbering may need
changing. See Appendix 1 ‘Test Case renumbering problems’.
In some cases, the default test case is not suitable, due to different data conditions
being required (see the note on Precondition Clashes above).
Neil Jennings
Page 43
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Repeat All
This format of the Repeat command will generate test scripts for every test case
subordinate to the target label. If the target test case itself contains Repeat commands,
a very large number of tests could be generated. For this reason, it is recommended
that nested Repeats are not used.
The format is
Repeat A all, where A is the target label.
Neil Jennings
Page 44
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
CALL
This command, when coded in a manager shape, copies all text from manager shapes
below the referenced label, down to, but not including, the thread position shape, into
the current manager shape for processing. An example could be to call a common
Login process from each test.
The called label does NOT have to be connected to an executive shape, i.e. it can be
held within a free-standing thread, which would not otherwise generate a script.
Restrictions:
The referenced label should contain only one thread, which must be
terminated by a position shape.
No subordinate assistant shapes will be processed.
Variables can be used, but only if already defined in the calling thread.
Unlike REPEAT, the CALL shape can own subordinate shapes or trees.
This action is controlled by the system variable “__ExpandCalls” which is defaulted
to Y. If set to “N”, then the CALL will be treated as a user action, and the referenced
text is ignored.
Neil Jennings
Page 45
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Go To
This is an instruction used for manual testing only, and may be regarded as a
comment. It is similar to Repeat, but does not generate any test script for the target
branch. It is often used to indicate a return to a previous state, such as redisplaying a
screen.
Example: Go to A
Textual Replacement
Data stored in variables can be used as textual replacements within manager and
position shapes as well as in automated scripts. These are activated during the script
generation process. Some (but not all) textual replacements will also be expanded
during the Renumber pass, for clarity within the test narrative report.
The rules for textual replacement are as follows:
The variable name must start with “??” where it is being defined or assigned a
value, (i.e. is the left-hand side, or LHS, of an assignment) and it must be
delimited by an equals sign. The variable name must start with “?#” where it is
to be replaced, and it must be delimited by a full stop.
It is VERY important to remember that the variable name will be evaluated
(replaced by the current data value) only at the point when the position box
is reached. This is unlike normal programming, where statements are
executed immediately.
You can code two or more levels of replacement by using ?# when assigning a
value to a variable, as follows:
Within an ASSISTANT shape, you could code
??secondlevel=SECOND
??toplevel=GET(?#secondlevel.) <<– note the full stop!
Within a lower level Manager shape,
DISPLAY ?#toplevel.
will then be translated to
DISPLAY GET(SECOND)
Concatenation :
Within an ASSISTANT shape, you could code
??tablename=COMPANY
??tablecolumn=REGISTRATION
??toplevel=?#secondlevel..?#tablecolumn
Within a lower level Manager shape,
DISPLAY ?#toplevel.
will then be translated to
DISPLAY COMPANY.REGISTRATION
Restriction: You cannot include quoted literals in concatenations.
Neil Jennings
Page 46
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
This will NOT work correctly:
??toplevel=?#secondlevel..”quoted string”
The value will be truncated at the embedded space.
Instead, you should use an intermediate variable to hold the string:
??temp=”quoted string”
??toplevel=?#secondlevel..?#temp.
Textual replacement provides a very powerful tool for test scripting, but care must be
taken to avoid recursive definitions which would cause looping.
Precursors
Data steps
Data steps are functions (actions) which need to be run in order to create the initial
state, or initial test data, for a test, but are not part of it. They are identified separately
to ensure that they are not included in the test metrics.
Use Case precursors
These are any data setup actions which may apply to all tests within the current test
set. These are likely to include registration of suitable users, and setting of global
variables.
All data steps and use case precursors should be attached to a separate executive
shape whose contents are the text ‘Data setup’. They must follow the usual test case
rules, must be attached to a manager shape, and each test case must be terminated by
position shape, which can contain a description within braces { }.
Any test case which does not contain a test number in brackets (xx) in the position
shape will also be regarded as a Data setup script.
Test case preconditions and data
There are actions which need to be taken to arrive at the test start point, such as
logging in and navigation. Preconditions will also be listed in the “Test Description”
field of the test script.
Test Specifications
These are data and actions that are part of the test itself.
Checking the output from Automated tests
Scripts can include suitable commands to check the results of user actions. The format
is dependent on the test tool in use. Expected results files can also be generated in the
same way as test data files.
Neil Jennings
Page 47
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Adding the test data and automation scripting to the chart
The following is a suggested process for planning and implementing the test data in
the chart.
Step 1: Decide what general actions are tested in each test case. Examples would be
Register, Create a Charge, Suspend account, send an email.
Step 2: Decide the appropriate point for each in the Visio diagram, bearing in mind
that an action can be copied into each subordinate test case automatically.
Step 3: Insert placeholder comments (Could be in the form of Winrunner comments
in Assistant shapes)
Step 4: For each test case, decide on the necessary data preconditions and navigation
needed.
Decide whether you need conditional execution of this test case – maybe it is blocked
by an existing Test Defect, or the relevant function is not yet delivered – use a WHEN
command with a suitable variable.
Decide whether you need to specify several data values for this one test case – if so,
use a FOR command.
Step 5: Insert data setup and and navigation actions as preconditions (comments if
necessary). If needed, insert a ‘data setup’ executive shape and structure to hold test
cases which initialise data.
Step 6: Check whether the actions with suitable parameters already exist in the Test
Framework “Function Dictionary” or equivalent. If they do, then code the actions
appropriately. If they don’t, then raise a request to update or add actions as necessary.
(They may be present under a different name!).
Step 7: Assign all the expected error messages.
Step 8: Add steps to check output data as necessary. See the Test Automation
appendix for details of the commands.
Step 9: Generate the test script (see next heading, Generating the test scripts) and
check whether it looks correct (i.e. assignments, logins, actions, verify, logout in the
correct sequence).
Correct the Visio diagram and repeat until the scripts look OK.
Neil Jennings
Page 48
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Generating the Test Scripts
This process creates the Manual and Automated test scripts (spreadsheets), and/or the
test data file. The Automated script will be generated, but will be populated with
dummy entries if no Assistant or Consultant shapes are present.
Open the Visio chart, if not already open
If the menu Trantor is present, click on that and select Main
Otherwise:
Click on Tools, then Macros on the menus
If the entry TranMac is present, click on that and select Main
If not present, see Appendix 8 to install the VBA code.
Choose the function to run (Both Scripts button)
You may have to click on OK for a few messages informing you of the
progress
A message Finished is displayed at the end, with a summary of test stats.
Reports generated by Scripts functions
These files will be placed in the directory specified by the user on the form.
As well as the files generated by the manual scripts command, the following will be
populated:
Data file
Filename will be in format xxxx_Data.txt.
Automated Test Script (Winrunner etc.)
This is held in a spreadsheet with the filename of the form format xxxx.xls (or
xslx).
Look for any comments that say that a test case has no testspec (i.e. no
automated scripting information), and ensure this is expected.
The format of this file will need to be tailored to the installation requirements.
Neil Jennings
Page 49
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Appendix 1: Test Case renumbering problems
Test cases not numbered left to right in the diagram
The Visio software stores shapes in the order they were created or connected, NOT
the order in which they are drawn.
Workaround:
If it does not matter which order the boxes are drawn, then you can just swap
them on the drawing to get the test cases displayed in the right order.
If it DOES matter, e.g. if you want the MEF to be the default test case, then
you may have adopt one of the following strategies, in the order shown
a) Disconnect all boxes at the branch point and reconnect from left to right,
and try renumbering again
b) replace existing boxes by new boxes created in the correct sequence
(working from the bottom up, left to right).
This doesn’t take long using Copy & Paste, and should need only to be done
once (but it doesn’t always work first time!).
c) If it still fails, even after recreating the boxes as described, then as a last
resort, physically swap the two boxes (heads of the subordinate test cases),
swap their text, and reconnect their subordinates as appropriate.
Duplicated test case numbers
Can be caused by an apparent bug in Visio where it does not recognise that the
subordinate is joined to its owner, despite the presence of a connector, and therefore
ignores the entire test case.
(Check the error report first)
Resolution: Disconnect BOTH position boxes from their managers, and reconnect.
Appendix 2: Structure of the Automated Test Script
The structure required is defined by the Winrunner requirements, and is tailored to
local requirements.
Appendix 3: Automation syntax notes
Local “Test Framework” details are found in a separate document.
Briefly, the scripts are created as Excel spreadsheets, with one column for each test
case.
The first column is used to identify a Winrunner item name (GUI map item)
The second column defines the type of item, e.g. a text box, dropdown, etc.
Neil Jennings
Page 50
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
The test script column defines actual Winrunner commands to be executed on that
item.
Appendix 4: Action Control characters in Visio charts
Important
Some of these control characters are specific to a particular installation, when the
scripts have been tailored for local use.
Within the assistant boxes, there are a few codes needed for Excel formatting, to force
new rows and new cells where needed. All can be used within INCLUDE files.
(Newline characters in the text are ignored, and are stripped out before processing).
Default action is for each Winrunner test case to be in a separate column, but starting
on the next available row.
Next Cell
~ is used for movement to the next cell
Tab to column
@ is used for movement to the correct column for the current test case
New line
! is used for new line (new action) in the script
i.e. to separate commands within a single assistant shape or
INCLUDE file
Any command with # in the second position is a comment and will be ignored
by the Test Framework
Example 1:
Browser~start_app@set¬CHIPS_L
Meaning
The first column of the test spreadsheet will contain the text Browser,
which is a framework item identifier
The ~ means next cell
start_app is the startup function
@ means move to the correct column for this test case
set¬CHIPS_L is a framework Winrunner command for login
Example 2 – insert a comment in the script
AEF01 test description~#@#Description of test
Meaning
This will put a test description in the correct column for the current
Neil Jennings
Page 51
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
test case
Several actions can be coded within one assistant shape, using the new action
(separator) facility, but it may be clearer to use a separate box for each.
Note:
One possible use is for several Test Script spreadsheets to be merged later to produce
regression test packs. The feasibility of this depends on the specific structure of the
installation’s test framework.
Appendix 5: Quality Center restrictions
Test History
Special consideration is needed when creating updated versions of a script.
Firstly, test case numbers should not be changed, because Quality Center retains an
execution history for each test case. Changing the test number would corrupt this
history.
Secondly, when a test case is deleted from the script, Quality Center will
automatically bring forward the old version. Therefore in order to prevent this, a
dummy test case has to be included in the new version.
Thirdly, if a new test case has fewer steps than the previous version, Quality Center
will bring forward the old steps. In order to recognise this, the scripting function will
insert text indicating which is the last step in a test case. Any subsequent steps should
be ignored (or marked as step deleted) by the test executor.
To overcome this, the last user action will have text @@@@@ Last step of Test nn
@@@@@ added automatically by the function. This is to inform the tester that any
further steps present in Quality Center are left over from a previous version of the
script, and are not to be executed.
Reserved characters:
Quality Center may not import Excel data containing the following characters,
therefore they should NOT be used in descriptive text, such as the flow descriptions.
They will be translated to underscores if found when writing to the spreadsheet:
\
/
:
%
'
*
?
<
>
|
"
Backslash
Slash
Colon
Percent
Apostrophe
Asterisk
Question mark
Less than
Greater Than
Vertical bar (pipe)
Quotes (double)
Neil Jennings
Page 52
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Appendix 6: MS Visio software defects
Different versions of Visio have a number of defects which can affect the use of the
test suite commands.
Sheet Shape bug
Visio sometimes seems to convert manager or position shapes to SHEET type, for
reasons unknown. If a sheet, manager or position box is found in the wrong place, the
renumber function will add its name to its visible text, to make it easier to find in the
Visio and replace. This bug was common in Visio 2000, but has only been seen very
rarely in Visio 2003.
Removing SHEET shapes
Just deleting and creating a new shape of the correct type does not usually work,
because Visio once again converts it. The following procedure seems to be the most
reliable method.
Add two or more new manager shapes and connect them to the shape which
owns the SHEET shape. Do not add any subordinates.
Run Renumber again
Note which of the new manager shapes is still a manager (Not changed to
Sheet) and use this to replace the rogue SHEET box. Delete the unwanted
shapes.
Visio 2000
Exponential refresh time
This version effectively has a limit to the depth of a chart. The time taken to process a
chart depends exponentially on its total depth. When the hierarchy depth exceeds 17
levels, the refresh time becomes excessive, and adding each new level doubles the
diagram refresh time. It was to overcome this restriction that the use of assistant boxes
for test data was introduced. Not seen in Visio 2003.
Undo limit.
Sometimes, it refuses to reconnect a shape which has been disconnected or pasted –
this seems to occur after the user has made a large number of changes. You have to
create a new shape and paste the content. Also, when the undo limit is reached, it will
no longer connect any shapes. You have to save the chart, completely exit from Visio
2000, and restart it.
Floating Organisation Chart toolbar
Very often, when a shape is selected, Visio 2000 undocks and floats the toolbar.
Incorrect action of Delete key
Often when you are attempting to delete text characters, Visio 2000 also moves the
shape on the page.
Incorrect relocation of shapes
When you enlarge a shape, it only moves the subordinate shapes HALF as far as it
should. This is seen in all versions.
Neil Jennings
Page 53
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Visio 2003
This version has a peculiar treatment of text within shapes:
a) If you put more than one line feed in a shape, then it truncates the text
when copying and pasting the shape. This seems to be a result of using a
number of separate objects to hold lines of text, but only copying the first
two. The workaround is to copy the text separately.
b) This fault also affects the export of charts. Only the first few lines of text
are exported, and you lose the rest. Therefore a bespoke import/export has
been provided – see below.
c) When you copy and paste a shape or group of shapes, it often resets their
sizes to the default value even though it knows how big they should be,
because it leaves the right amount of space for them.
Re-Layout bug
As mentioned above, never use the Re-Layout menu function, because it can
sometimes seriously damage your chart, and undo does not fix it.
Incomplete Move bug
If you have a structure more than 9 levels deep, then in some circumstances, Visio
does not redraw the chart properly. This occurs when you try to move a top-level
shape on the page, and also when you resize the page. The symptom is that all shapes
below the 9th level are not moved at all, though they do remain connected. The cure is
to select one shape and use Arrange Subordinates. Usually, all instances are fixed, but
occasionally you have to repeat.
Neil Jennings
Page 54
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Appendix 7: Diagram export/import
Visio Organisation Charts can be exported to Excel workbooks, and can be imported
using the Organisation Chart Wizard. However, using the standard Visio wizards will
remove formatting, change shape types, and remove text.
Note particularly that the Standard VISIO export removes all text which follows the
second Carriage Return within a shape. (Why on earth did they do this?)
Therefore Import and Export functions have been provided, which overcome these
problems.
EXPORT will export the chart to a spreadsheet which is compatible with the standard
VISIO Import Wizard. It replaces all occurrences of carriage return by the text #CR#,
forcing the entire text (but limited by Excel to 1024 chars) to be exported. It also
correctly identifies all exported shape types.
However, it will only export connected shapes as used in this method, which are
descended from an Executive shape. Unconnected shapes are ignored.
IMPORT will just replace each occurrence of #CR# in a shape’s text by a carriage
return. It is run after using the VISIO Import wizard:
Organization chart -> Import Organization data
Information already stored in a file
A text, org Plus or Excel file
Browse for the csv file
Choose the columns that contain the information... -> next
Choose the columns to display -> next
Choose the columns you want to add as custom property fields -> next
Select Option "I want to specify how much to display on each page" -> finish
(Default is a new page for each executive shape - this is what we need)
Chart is loaded by Visio
Now use Trantor menu -> Main and click Import on the form
Shape text is corrected, fields coloured and menus added.
Shape sizes may still be wrong, because the Visio import wizard just creates them all
at the default size. Before running Resize Shapes, it might be advisable to run the
Change Spacing option on the Organization Chart menu to set custom spacing.
You can then use the Resize Shape option, followed by the Change Spacing to tighten
the spacing again. Unfortunately, there does not seem to be any way to automate this.
Neil Jennings
Page 55
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Appendix 8: Chart Preparation – Importing the VBA files
If you have purchased a software upgrade, and have the password, you can apply
upgrades as follows:
Ensure you have correct project references: (Tools->Macros->Visual Basic Editor,
then Tools->References)
Microsoft Excel 12.0 library if using Excel 2010
Microsoft Excel 11.0 library if using Excel 2003
These cannot co-exist – must have one or the other.
Four VBA modules and two VBA Forms are used, which are found in the VB files:
TranMac.bas
(Macro subroutine calls)
DoScript.bas
(Function code)
TranMain.bas
(Function code)
TranTest.frm
main Form
Statusform
Form for updating Status values
And either of
NoPopulate.bas
Populate.bas
Standard version of Trantor Test
Advanced version
The actual location of these files is provided in a separate document.
Note: Visio 2003 is the recommended version. There are some performance
problems and a number of bugs in older versions of Visio, described in an
appendix.
To add the test suite functions to a Visio chart, you must
Copy the VBA files to a local directory
Make sure you have no other Visio chart open (As VBA is easily confused)
Open the chart
Select Tools/macros/Visual Basic Editor (or use Alt-F11)
File/Import file (or Ctrl-M)
If any modules or forms are already listed, select them and use the Remove
option from the file menu to delete them.
Import the form and modules (listed above) from the source directory.
Staying within the VB window, select Tools/References and check the box for
Microsoft Excel Object Library.
Now select ‘Close and return to Visio’ from the VB window menu bar
Neil Jennings
Page 56
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
When you subsequently save the Visio chart, the VBA code will be saved with it.
Neil Jennings
Page 57
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Appendix 9: Built-in variables
Some built-in variables have been provided to overcome restrictions in the available
characters in Visio and Excel text.
The current list contains
_pipe
the pipe character “|”
_eq
the equals sign
_at
@
_amp
&
_back
\
_til
~
_excl
!
_hash
#
_null
returns a null string
_AEF
returns the current flow identifier
_uniq
returns a serial number which is unique for each test
_uniq4
returns the same value as a 4 digit number
_uniq8
returns the same value as an 8 digit number
_uniqbase
sets or resets the first number in the uniq series – default is zero
_crlf
returns a newline character string (CR & LF).
This is necessary because newlines have to be stripped out of
Visio shape text during processing
_custom1 thru _custom9
allow custom columns to be added to the QC script, with values
as defined in the variables during the run.
_Component may be selected in the column picker – this sets its value
_Module
may be selected in the column picker – this sets its value
_QCpath
For use in QC script
_QCPrefix
For use in QC script
Control variables, which are all global, start with TWO underscore characters:
__Gtrace
is a diagnostic aid used to write a trace of a selected variable, or
all variables to the error file:
__Gtrace
varname
(without the ??)
__Grace
_all
(underscore followed by all)
__Split =“Y”
enables a built-in data file splitter for test data files. This
function needs to be tailored to client requirements.
__Lastline =“Y”
tells the program to include a dummy last line with @@@@ in
each test, to overcome QC restrictions.
__Winrunner =“N”
disables the production of automated test scripts
__Combine= “N”
forces the program to put each action and response on a new
line.
Neil Jennings
Page 58
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Default is to combine actions of the same type.
__ExpandCalls= “N”
Inhibits the expansion of CALLs. Default is “Y”
__Separator
Allows you to change the default data file unit separator from
Pipe (|) to one of the following: comma, semi-colon, backslash,
hash (#).
Example: ??__Separator=“;”
Neil Jennings
Page 59
2/12/2016
Trantor Ltd
Copyright © 2006, 2011
Acknowledgements
Reference
VBA
Visio
Excel
Winrunner
Loadrunner
Quality Center
Owner
MicroSoft
MicroSoft
MicroSoft
Mercury
Mercury
HP
These are used within this guide for reference purposes only, and all rights belong to
the respective owners as listed above.
System Version 1.1.29
Prepared by:
Neil Jennings
Trantor Ltd
www.greenhedges.com
November 2011
Neil Jennings
Page 60
2/12/2016
Download