equivalent vb filedialog feature in testcomplete
for several situations i've been able to write a vb script and paste it into a testcomplete script and it works just fine. My manager has requested that I look into how we can use the TestComplete File Compare to examine two files for differences but he stipulates "Ideally, when running this you would be able to select the 2 files for comparison and not hard code the file location/name into the test case". I know how to code that functionality into a VB script that allows the user to navigate to files through the Windows File Explorer using FileDialog. The following code snippet does just that (post continued below code)
Sub filepicker()
Dim fd As FileDialog
Dim baselinefile As String
Dim targetfile As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Title = "Navigate to and select the baseline file for comparison"
.AllowMultiSelect = False
If .Show = False Then Exit Sub
baselinefile = .SelectedItems(1)
End With
With fd
.Title = "Navigate to and select the target file for comparison"
.AllowMultiSelect = False
If .Show = False Then Exit Sub
targetfile = .SelectedItems(1)
End With
End Sub
This Sub however does not work in a Test Complete script. Is there anything in TestComplete that would accomplish the task of throwing up a File Explorer GUI and allow me to navigate to and select two files, save them in variables, and then perform the Files.Add(baselinefile, "Baseline") command followed by the Files.Baseline.Check(targetfile) command?
The other alternative would be user forms.
https://support.smartbear.com/testcomplete/docs/testing-with/advanced/user-forms/index.htmlThis allows you to create a visual form that will be displayed during the automation to allow for user input. We use a user form in our automation when it's run manually versus when it's run as a commandline so I can vouch for it's usability and the use case.