Skip to content

Instantly share code, notes, and snippets.

@N3mes1s
Created November 7, 2017 06:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save N3mes1s/5b75a4cd6aa4d41bb742acace2c8ab42 to your computer and use it in GitHub Desktop.
Save N3mes1s/5b75a4cd6aa4d41bb742acace2c8ab42 to your computer and use it in GitHub Desktop.
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