Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Authoring Tests in Scripting Languages
<?xml version="1.0" ?>
<!-- Te.exe DataDrivenTest.wsc -->
<!-- C:\Program Files (x86)\Windows Kits\10\Testing\Runtimes\TAEF > ./TE.exe DataDrivenTest.wsc -->
<!-- Test Authoring and Execution Framework v5.8k for x64 -->
<!-- StartGroup: VBSampleTests::TestOne -->
<!-- Calling TestOne -->
<!-- EndGroup: VBSampleTests::TestOne [Passed] -->
<!-- Summary: Total=1, Passed=1, Failed=0, Blocked=0, Not Run=0, Skipped=0 -->
<?component error="true" debug="true"?>
<package>
<ModuleProperty name="Owner" value="Someone"/>
<component id="VBSampleTests">
<object id="Log" progid="WEX.Logger.Log" />
<reference guid="e65ef678-a232-42a7-8a36-63108d719f31" version="1.0"/>
<TestClassProperty name="DocumentationUrl" value="http://shelltestkb/"/>
<public>
<method name="TestOne">
<TestMethodProperty name="Priority" value="1"/>
</method>
</public>
<script language="VBScript">
<![CDATA[
Function TestOne()
Log.Comment("Calling TestOne")
CreateObject("WScript.Shell").Run("cmd.exe")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objWMIService.Create "notepad.exe", null, null, intProcessID
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent Within 1 Where TargetInstance ISA 'Win32_Process'")
Do Until i = 1
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.ProcessID = intProcessID Then
i = 1
End If
Loop
End Function
]]>
</script>
</component>
</package>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.