beautypg.com

Writing ats vb scripts, 1 creating the main objects, Creating the main objects – Teledyne LeCroy ST Automated Test Suite User Manual User Manual

Page 12: Chapter 4, writing ats vb scripts

background image

12

4. Writing ATS VB Scripts

The most important and significant part of running an automation test is writing their VB Scripts. You
need to write your own VB Scripts for your automation tests and therefore you must understand how
VB Scripts should be prepared.

NOTE: Currently, ATS does support segmented memory and auto run. Auto run is an application
feature which the user can implement in VB script.

4.1 Creating the Main Objects


You must create two main automation objects at the beginning of any VB Script. The first one is the
STATS object, which sends test results, reports, and possible errors to the STATS environment. The
second one is the SierraSASAnalyzer object, which runs Analyzer, Emulator, Trainer, InFusion, and
VSE projects.

To create automation objects, call the CreateObject function. LECROY is the name of the
namespace that includes all LeCroy automation objects.

To create the STATS automation object, use the following code in your VB Script:


Set MySTATS = WScript.CreateObject("LECROY.STATS")
If Err.Number <> 0 Then

WScript.Echo "STATS Creation Failed"

WScript.Quit

ELSE

MySTATS.ReportText ("My STATS started...")

MySTATS.ReportText ("STATS Automation object is created")

End If

To create the SierraSASAnalyzer automation object, use the following code in your VB Script:


Set MySASAutomation = WScript.CreateObject("LECROY.

SierraSASAnalyzer")

If Err.Number <> 0 Then

MySTATS.ReportError Err.number, Err.Description

End If
MySTATS.ReportText ("Analyzer is created successfully")

The STATS Object has the following reporting functions:

o

HRESULT

ReportText

(

BSTR

bstrText

); Reports the text that will appear on the output

bar in the STATS environment.

o

HRESULT

ReportError

(

LONG

nErrorCode

,

BSTR

bstrDescription

): Reports

possible errors with error codes and descriptions that appear on both the output bar
and the Detail column of the running area in the STATS software.

o

HRESULT

ReportResult

(

LONG

nResult

): Sends the result of the automation test to

display on the Result column of the running area in the STATS environment. Numbers
indicate:
0 =Not Applicable (N/A)
1 = Pass
2 = Fail

o

HRESULT ReportDetail(BSTR bstrDetailText): Sends the detail of the automation test

to display on the Detail column of the running area in the STATS environment.