Overviewofresults Classmapping
Overviewofresults Classmapping
5
Overview of Results Logging – Overview of Class Mapping
This will affect all tests run from the testplan at the level of the optionset keyword. Once
that level is complete, logging will be turned back on, unless another option set is
specified that also excludes LogResults.inc from the UseFiles.
Having logging turned off will mean no individual test data for those affected testcases
will be written to the database, and if logging is still off at the end of the run, no summary
data for the testplan will be written to the database.
A separate installer for the results repository is provided with SilkTest. The results
repository installer has three components:
• Results Logging: enables your computer to log test results
• Results Repository component: creates the SilkTest results repository (database
and tables).
• Results Viewer: configures an existing Microsoft Web server for the
demonstration HTML results viewer.
The host computer must satisfy the configuration requirements of a Results Repository.
7 If you choose to create the SilkTest results repository, the installer prompts you to
specify the name of the computer on which to create the database and tables. The installer
then creates/updates a system data source, called SilkTestRepository, on the computer
running the installer. The data source will be associated with the computer where the
database and tables are created.
8 On the InstallShield Wizard Complete dialog, click Finish to exit the InstallShield
Wizard.
1 Rename your existing function and then call it from the appropriate function
within LogResults.inc. For example:
• CompanyOverrides.inc contains an existing use of the TestCaseExit function.
Rename the existing function CompanyTestCaseExit (Boolean bException).
• Then, in LogResults.inc, modify TestCaseExit (Boolean bException) to call
CompanyTestCaseExit as appropriate.
1 In order to edit an option set you must first close it. In SilkTest, select
Options/Close Options Set, if necessary.
2 Select File/Open, navigate to the option set you wan to edit, and click Open.
3 In the .opt file, scroll to UseFiles. If necessary, click Edit/Find, type UseFiles
in the Find What text box, and click Find Next.
4 Type the path and file name, <SilkTest installation
directory>\Resultslogging\LogResults.inc, in the UseFiles. Be sure to place
this file before the SilkTest defined include files (for example
extend\explorer.inc) and use a comma to separate.
5 Save the option set. Click File/Save.
If the option set is not used by a large number of testplans, you may want to create a copy
of the existing option set and then add the LogResults.inc file to the UseFiles in the copy.
Rename the copied option set with a name that distinguishes it from the original as one
that logs results. In taking this approach, you will only need to re-specify the .opt file
used by the optionset keyword in the test plan.
For example, SilkTest supports the standard MFC library, which is a library of functions
that allow for the creation of objects and the mechanism of interaction with them. In
supporting these libraries, SilkTest contains algorithms to interrogate the objects based
If the class mapping does not work, it is because of the following reason.
• The object truly is a custom object; that is, the software in the application under
test that creates and manipulates the object is not from the standard library. That
means that the SilkTest algorithms written to interrogate this kind of object will
not work, and other approaches will have to be used to manipulate the object.
How you support custom objects depends on whether the object is a graphical control,
such as a tool bar, or whether it is not a graphical control, such as a text box.
However, if the object is not actually a custom object, but is instead a standard object that
your application’s developers have renamed, you can record and run testcases merely by
establishing a class map between the renamed class and the standard 4Test class. You can
also filter out unneeded custom classes can be filtered from the class hierarchy.
Class mapping only works for objects that are created with standard API calls but are
given non-standard names.
After filtering out a custom container class you may occasionally lose the ability to see its
child objects. In the above example, all the dialog objects (which are children of the
custom TBFrame class) might be no longer visible to 4Test.
You can also map a class to LookUnder to look ‘through’ the class, seeing the objects
under it. For example, there is a BlackFrame class in Visual Basic that is a 3-D black
border around controls. LookUnder is not in the standard classes list, so if you want to
use it you must type it in.
About style-bits
Classes may allow different styles of instantiation. Style-bits determine the styles that can
be applied to an object. For example, a PushButton, CheckBox, and RadioButton are all
variants of the native Windows Button class. They are all the same class, but each has
different style-bit to determine the specific look and behavior of the button.
You can map not only an entire class, but also specific ‘styles’ of one class to another,
known class.
Notes
The style-mask may also take the format: 0xFFFFFFFF, where ‘F’ includes the bit and
‘0’ turns it off. For example, one custom PageList may look like 0x12345678 and
another of the same type may look like 0x12345679. You could class map it like:
newpageclass,0x12345678,0x12345678=PageList
newpageclass,0x12345679,0x12345679=PageList
And on and on for each one like it, or…
newpageclass,0x12345678,0xFFFFFFF0=PageList
1 Press Ctrl+Alt. The declarations are frozen in the Window Declaration list box in
the lower half of the Record Window Declarations dialog.
2 In the Window Declarations list box, click on the line containing the declaration
for the custom object. The line is highlighted and the declaration for the CustomWin
appears in the Window Detail group box.
3 In the Window Detail group box, click Class Map. The Class Map dialog appears.
The name of the custom class is displayed in the Custom Class text field.
4 In the Standard Class field, enter the name of the built-in 4Test class to which you
are mapping the custom class.
5 Click Add. SilkTest adds the class name.
6 Click OK.
When you resume recording, the object has the standard 4Test class. If SilkTest
encounters a similar object, it automatically maps the object to the correct 4Test classes.
You must modify any prerecorded declarations containing these objects to use the
standard class.