TestComplete使用Word文件下载.docx

上传人:b****5 文档编号:20795021 上传时间:2023-01-25 格式:DOCX 页数:14 大小:22.54KB
下载 相关 举报
TestComplete使用Word文件下载.docx_第1页
第1页 / 共14页
TestComplete使用Word文件下载.docx_第2页
第2页 / 共14页
TestComplete使用Word文件下载.docx_第3页
第3页 / 共14页
TestComplete使用Word文件下载.docx_第4页
第4页 / 共14页
TestComplete使用Word文件下载.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

TestComplete使用Word文件下载.docx

《TestComplete使用Word文件下载.docx》由会员分享,可在线阅读,更多相关《TestComplete使用Word文件下载.docx(14页珍藏版)》请在冰豆网上搜索。

TestComplete使用Word文件下载.docx

∙Right-clicktheapplication’sprocess(oranyofitschildobjects)intheObjectBrowser’sObjectTreeandselect

AddProcesstoTestedAppsfromthecontextmenu.

Addingatestedapplicationbycopyingpropertiesofanexistingone

∙Right-clickthedesireditemintheTestedAppseditorandselectCopyfromitscontextmenu.

∙Right-clicksomewherewithintheeditorandselectPastefromthecontextmenu.

∙SelectthedesireditemintheTestedAppseditorandchooseEdit|CopyfromTestComplete’smainmenu.

∙SelectEdit|Pastefromthemainmenutopastethecopiedobjecttotheeditor.

Afterthenewitemappearsinthetestedapplication’slist,youcanmodifyitsproperties,forexample,thecommand-lineparameters,therunmodeandothers.

Addingatestedapplicationduringtestrecording

TestCompletecanautomaticallyaddapplicationsthatyoustartduringrecordingtotheTestedApplicationscollectionofyourproject.YoucanenablethisbehaviorusingtheAddapplicationstothelistoftestedapplicationsandShow'

Add<

ApplicationName>

tothelistoftestedapplications?

'

messageoptions.

IftheShow'

messageisenabled,themessageaskingwhetheryouwishtoaddtheapplicationinvokedduringrecordingtothelistoftestedapplicationswillappearafteryoustoprecording.IfyouselectYes,theapplicationwillbeautomaticallyaddedtotheTestedApplicationscollectionofyourproject.IftheShow'

messageoptionisdisabled,theapplicationwillbeautomaticallyaddedtothelistofTestedApplicationornotdependingonwhethertheAddapplicationstothelistoftestedapplicationsoptionisselectedornot.

Iftheapplicationisaddedtothelistoftestedapplications,theprogram'

sstartisrecordedastheTestedApps.ProgramName.Run(1,True)scriptinstructionorRunTestedAppkeywordtestoperation.

Addingatestedapplicationfromtests

YoucanaddapplicationstotheTestedApplicationscollectionanddefinetheirpropertiesdirectlyfromyourtests.Todefineatestedapplication,calltheTestedApps.Addmethodinthebeginningofyourtestscript.Inakeywordtest,youcancallthismethodusingtheCallObjectMethodorRunCodeSnippetoperation.Themethodhasthefollowingparameters:

TestedApps.Add(FullName,Parameters,Count,Launch,WorkDir)

∙FullName-Thefully-qualifiedpathtotheapplication’sexecutableorbatchfile.

∙Parameters-Thecommand-lineargumentstobepassedtotheapplicationatstartup,ifany.(Default:

None.)

∙Count-Thenumberofapplicationinstancestolaunch.(Default:

1.)

∙Launch-Specifieswhetherthetestedapplication’slaunchisenabledordisabled.(Default:

True.)

∙WorkDir-Specifiestheworkingfolderfortheapplication.(Default:

Thefolderoftheexecutablefile.)

ThefollowingcodedemonstrateshowyoucanusetheTestedApps.Addmethodinscripts.ItaddsNotepadtotheTestedApplicationscollectionandspecifiesthepathtotheTestComplete8InstallationNotesfileasacommand-lineargumentforNotepad.ItthenlaunchesNotepadsothatitopensthespecifiedfile.

ShowExample

HideExample

VBScript

CopyCode

SubAddTestedApp

DimTC,params,ind

Getthepathtothe"

TestComplete8InstallationNotes"

file

SetTC=GetObject(,"

TestComplete.TestCompleteApplication"

params=aqFileSystem.GetFolderInfo(TC.Manager.ProductInfo.ProductPath).ParentFolder.Path&

"

install.txt"

AddNotepadtoTestedApplications

ind=TestedApps.Add("

%WINDIR%\notepad.exe"

params)

CallLog.Message(aqString.Format("

NotepadwasaddedtoTestedAppsunderthename"

"

%s"

andindex%d."

_

TestedApps.Items(ind).ItemName,ind))

LaunchNotepad

TestedApps.Items(ind).Run

End 

Sub

JScript

functionAddTestedApp()

{

varTC,params,ind;

//Getthepathtothe"

TC=GetObject("

"

);

params=aqFileSystem.GetFolderInfo(TC.Manager.ProductInfo.ProductPath).ParentFolder.Path+"

;

//AddNotepadtoTestedApplications

%WINDIR%\\notepad.exe"

params);

Log.Message(aqString.Format("

NotepadwasaddedtoTestedAppsunderthename\"

%s\"

TestedApps.Items(ind).ItemName,ind));

//LaunchNotepad

TestedApps.Items(ind).Run();

}

DelphiScript

procedureAddTestedApp;

begin

TC:

=Sys.OleObject['

TestComplete.TestCompleteApplication'

];

params:

=aqFileSystem.GetFolderInfo(TC.Manager.ProductInfo.ProductPath).ParentFolder.Path+'

install.txt'

ind:

=TestedApps.Add('

%WINDIR%\notepad.exe'

Log.Message(aqString.Format('

andindex%d.'

TestedApps.Items[ind].ItemName,ind));

TestedApps.Items[ind].Run;

end;

C++Script,C#Script

params=aqFileSystem["

GetFolderInfo"

](TC["

Manager"

]["

ProductInfo"

ProductPath"

])["

ParentFolder"

Path"

]+"

ind=TestedApps["

Add"

]("

Log["

Message"

](aqString["

Format"

TestedApps["

Items"

](ind)["

ItemName"

],ind));

Run"

]();

Note:

YoucanexecutethescriptcodeabovefromyourkeywordtestusingtheRunScriptRoutineoperation.

TestedAppsEditor

TheTestedAppseditorletsyouviewandconfigurealistoftestedapplicationsdefinedinthegivenTestCompleteproject.ToopenthiseditorintheWorkspacepanel,double-clicktheTestedAppsprojectitemintheProjectExplorerpanelorright-clickthisprojectitemandselectEditfromthecontextmenu.Notethatthelistoftheproject’stestedapplicationsisalsodisplayedbelowtheTestedAppsprojectitemintheProjectExplorerpanel.Youcanopentheeditorbydouble-clickingthedesiredapplication’snodeundertheTestedAppsnode.

Hereisasampleeditorimage:

ThecolumnsintheTestedAppseditorrepresentpropertiesofthelistedtestedapplications:

Column

Description

Icon

Theapplication’sicon.IftheFileNameandFilePathcolumnspointtoannon-existentfile,thecolumnsdisplaythe

icon.

Launch

Specifieswhethertheapplicationistoberunduringtestsessions.

Name

Theuniquenameofthetestedapplicationwithinacollectionoftestedapplications.Thispropertyletsyoudistinguishtwolistentriesthatrefertothesameexecutable,buthavedifferentproperties(differentpath,parameters,andsoon).

FileName

Nameoftheexecutablefile(.exe,.com,.bator.cmd).

Count

Numberofapplicationinstancestobesimultaneouslylaunchedduringtestsessions.

TheCountvalueisignorediftheDebugorProfilerunmodeisselected.

FilePath

Pathofthefolderholdingtheexecutablefile.

Tospecifythepath,youcanusetheoperatingsystem’senvironmentvariables(%USERPROFILE%,%SYSTEMROOT%,%WINDIR%andothers)andalsoprojectandprojectsuitevariables.Namesoftheprojectorprojectsuitevariablesmustbeenclosedinparenthesisandfollowthe$sign,forexample,$(PathToApp).

Anewenvironmentvariablebecomesavailabletoapplicationsthatwerelaunchedafterthevariablecreation.Itisnotseeninapplicationslaunchedbeforethecreation.Makesu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 金融投资

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1