Microsoft KB Archive/142785

= Microsoft Knowledge Base =

FAQ: Microsoft Visual Test Version 4.0 for Windows
Last reviewed: July 25, 1996

Article ID: Q142785

The information in this article applies to:


 * Microsoft Visual Test for Windows 95 and Windows NT, version 4.0

SUMMARY
This article answers some of the most frequently asked questions (FAQ) about Microsoft Visual Test 4.0.

MORE INFORMATION
1. Q. I installed Visual Test 4.0. Now I can't gain access to the Visual Test 4.0 Books online.

A. The books online may not have registered correctly during installation. You have to open a file to let it register and then you will be able to access it. Please follow these steps:

1. On the File menu, click Open.

2. Change directory to C:\Msdev\Help or whereever you installed Visual Test.

3. Select Mst40bks.mvb from the file list box, and click OK.

Now, you should be able to access the Books Online. On the Help menu, click Open Information Title from the Developer Studio.

2. Q. I am trying to test an MS-DOS-based application on Window s95. Visual Test's Scenario Recorder does not record strokes for an MS-DOS-based application.

A. Visual Test uses a a method called journaling to record keystrokes. This method won't record keystrokes in MS-DOS-based applications in     Windows 95. You can, however, use Play commands in the script to send the keyboard or mouse events to the active window in an MS-DOS-based application.

3. Q. Where can I find information on upgrading Microsoft Test 3.0 scripts to Visual Test 4.0?

A. Select "Upgrading existing Test Scripts" in Books Online under Visual Test 4.0 Books Online Programmer's Guide for information on upgrading scripts. Also in Books Online, refer to the Knowledge Base Article "How to Incorporate Resources into a Visual Test Script" if you have used resources in your script.

4. Q. Can I use Visual Test 4.0 to test applications that are running under the Windows 3.1 or Windows for WorkGroups operating systems?

A. No. Visual Test works only on Windows 95 or Windows NT version 3.51. Test 3.0 is provided on the same CD-ROM compact disc as Visual Test 4.0. You can use Test 3.0 to test 16-bit Windows-based applications running under Windows 3.x.

5. Q. How do I find more information about the control that I am working with such as its class name or ID?

A. Use the Window Information (WInfo) utility. You can run WInfo by     choosing the WInfo command from the Test menu in Microsoft Developer Studio. Please search in Books Online using "Window Information     Utility" for more information.

6. Q. How do I start my application using a Visual Test script?

A. Use the RUN Statement to start your application. Please refer to the "RUN Function" or "RUN Statement" topic in the Language Reference in Books Online for more information. For example, the following line of code starts Notepad from within a Test script:

RUN  "C:\WINDOWS\NOTEPAD.EXE", NOWAIT

7. Q. The Scenario Recorder displays a Define Unknown Control dialog box. What is the type of control that I need to select?

A. Select Window for the type of control if you are not sure about the type of control. If you are sure that the specific type of     control behaves like some standard control and you know that it      processes standard messages for that control, you can select that type. For example, if the control behaves like an edit box and processes EM_XXXXX messages, you can select Edit for the type of     control.

8. Q. How can I distribute my Visual Test scripts or run them on other computers without installing Visual Test?

A. You can compile your scripts into a .pcd file and distribute them along with the necessary files needed to run your scripts. Choose Compile from the Test menu in Microsoft Developer Studio to compile your scripts into .pcd files. Please search for "PCD" in the Help file for more information.

9. Q. How do I synchronize my test script with the application I am     testing?

A. A test script is not going to wait until the application under test finishes the task or event triggered by the test script. The test script runs the next line of code as soon as it hands over some task to the application under test. Therefore, if you need to make the test script wait, you need to have commands in your script to do     this. Please refer to Knowledge Base article Q136208, "Techniques for     Determining When a Task Has Completed" in Books Online. 10.Q. How do I run multiple scripts as a test suite?

A. You can use Suite Manager to create, manage, and run test suites. After you've created a test project with Microsoft Developer Studio, use Suite Manager to create and run different suites of test folders. Test case files that fully test the application. Please refer to     "Suite Manager" in the Utilities User's Guide in Books Online for more information. 11.Q. Can Visual Test 4.0 be used as an OLE Automation controller?

A. Yes. Please refer to Visual Test 4.0 Books Online by following this path: \Programmer's Guide \Advanced Programming Techniques \OLE Automation, or search for the "OLE Automation Testing" and "OLE     Automation Procedures" topics in the Help file. You can also refer to     the OLE Automation samples in the Msdev\Samples\Vtest40\OLE\Disptest Directory. 12.Q. Where Can I find information on testing OLE Controls with Visual

Test 4.0?

A. Please read the topic \programmers guide \ Simulating and Verifying User Actions \Working with OLE Controls in Books Online. You need to     place the Mstest.ocx file on the form or window that has the OLE controls that you want to test before you can use the OLE Functions from Visual Test 4.0.

Please make sure that you are dealing with an OLE Control. Use the Winfo Utility to check the properties. Winfo will display the OLE Control's properties in an additional dialog box. 13.Q. Do you have some information or sample code to show me how to use the

OLE Control APIs?

A. Here is a small sample code that shows the usage:

' This tests the Grid Control VB sample(\sample\grid\loan.vbp) in  ' VisualBasic 4.0. You need to run the VB sample and enter some values. ' Then Place the Mstest.ocx on the main form before you run a  ' script with the following code.

'$include 'decalres.inc' dim control$,property$ dim retval as variant CurrentWindow = WFndWndWaitC("LoanSheet", "ThunderForm", _                               FINDWINDOWFLAGS_IF, Timeout) WSetWndPosSiz(CurrentWindow, 36, 96, 473, 427) control$ = "#grdPayments" 'Name property value from Winfo.. 'Select a range of cells OlectlSetproperty(control$,"SelstartCol" ,1 ,10) OlectlSetproperty(control$,"SelstartRow" ,1 ,10) OlectlSetproperty(control$,"SelendCol" ,5 ,10) OlectlSetproperty(control$,"Selendrow" ,11 ,10) property$ = "Clip" 'Get the values in those cells retval = OleCtlGetProperty ( control$, property$ ,10 ) print retval

14.Q. My program works fine when I manually start it, but it fails when I

use the Run statement in the Script to start it. I am including the Complete path and the program name in the Run statement. What am I     doing wrong?

A. Some programs may require the working directory to be set before you start the program; it needs to use the working directory to find its initialization and other files needed to run the program. Please use the CHDIR or CHDRIVE commands to set the working directory for the Program as in the following example:

Chdrive "d:"  'If the program(.exe) is in a different drive Chdir "d:\mydir" Run "d:\mydir\myprog.exe" ,Nowait 15.Q. Screen comparison functions indicate that there is a mismatch between

the source and the target files/screens. How can I see what the differences are?

A. Save the screen image to a new file when there is a mismatch, and use the Screen Utility to compare the two files (the source and the     target). That should give you a comparison image to view. 16.Q. How do I trap the error message window displayed by the application I

am testing?

A. Use Visual Test's notifications functionality. Please refer to the "Handling Errors and Events" topic in the Programmer's Guide in Books Online for more information on this. Also, you can search in the Knowledge Base articles included in Books Online for an article on     this topic.