Examining Data in Variables

The best way to examine the contents of data variables during playback is to make use of the Visual Basic MsgBox function.

Playback causes the contents of the variable to display in a message box. The message box displays until the OK button is clicked, at which point playback continues.

The following example shows a simple use of the command to display the contents of a variable:

Imports SilkTest.Ntf.Wpf

Public Module Main
	Dim _desktop As Desktop = Agent.Desktop
	
	Public Sub Main()
		Dim sCarmake = "Honda"
		MsgBox(sCarmake)
	
		With _desktop.WPFWindow("@caption='WPF Sample Application'")
			.Restore()
			.WPFMenuItem("@caption='Basic Controls'").Select()
		End With
		With _desktop.WPFWindow("@caption='Basic Controls'")
			.WPFTabControl("@automationId='tabControl'").Select("Text")
			.WPFTextBox("@automationId='textBoxSingle'").SetText(sCarmake)
		End With
	End Sub

End Module

In the preceding example, the sCarmake variable value, which in this case is Honda, displays in the message box during playback.

Note: This example is meant to illustrate how you can implement the MsgBox function. You must add an application configuration and make any necessary adjustments for your test application to successfully implement this code. If you cut and paste this example into your script, an error occurs because the application configuration is missing.