You are on page 1of 35

3.

35

DPI V300R005C00

/10096

2012-5-19


DVP05T01 V2.8 /

DPI V300R005C00

Date

2012-5-19
2012-5-23

Revision
Version

1.00
2.00

2012-5-29

3.00

CR ID

Sec No.

Change Description

Author

CR

235

DPI V300R005C00


1 .............................................................................................................................................5
1.1 ......................................................................................................................................... 5
1.2 ....................................................................................................................... 5
1.3 ..........................................................................................................................5
2 .............................................................................................................................................5
2.1 ....................................................................................................................... 5
2.2 Qaliber ...........................................................................................................5
3 ...........................................................................................................................7
3.1 .................................................................................................................................7
3.2 .................................................................................................................................. 8
4 QAliber....................................................................................................................14
4.1 ...............................................................................................................................15
4.2 ...............................................................................................................................19
5 ....................................................................................................................................21

335

DPI V300R005C00

DPI V300R005C00
Qalber

QAlber

435

DPI V300R005C00

1
1.1
DPI V300R005C00
Qaliber

1.2
QAliberGUI
Windows QAliber
VisualStudio Qaliber
http://sourceforge.net/projects/qaliber/files/Qaliber
http://nchc.dl.sourceforge.net/project/qaliber/QAliberTestSuiteSetup.exe

1.3
Windows Xp
Microsoft Visual Studio 2010 Qaliber

2
2.1

2.2 Qaliber
QAliberGUI
Windows Qaliber

535

DPI V300R005C00

QAliber Test Builder(2-1) QAliber Developer Standalone(2-2)


QAliber Test BuilderQAliber
Developer StandaloneQAliber Developer Standalone
vs2010Spy++(
2-3)C++
Qaliber Developer StandaloneSpy++

(2-1)

(2-2)

635

DPI V300R005C00

(2-3)

3
-------------

3.1
V3R5_
DownLoadBase.csAudioAndVideoCalledBase.cs
AudioAndVideoCallerBase.csLoginBase.cs

1 ----
inixml
2
3

4
wincapDpiEX
NetTafficSpeed.ProcessSpeed

735

DPI V300R005C00

1 ----
inixml
2
3

1 ----
inixml
2
3
4
5

6 NetTafficSpeed.ProcessSpeed

3.2
3.2.1 QAliber Developer Standalone
QAliber Developer Standalone(2-2)Qaliber
1
2C#VB.NET
3
.txt3-1-1
Hello,the World

3-1-1
1 QAliber Developer Standalone
ctrl+shift+4Qaliber
bug

835

DPI V300R005C00

2 .txtHello,the World(
3-1-2)

3-1-2
3 ctrl+shift+6
4 QAliber Developer StandaloneGenerated Code
(3-1-3)

3-1-3

3.2.2 Spy++
Spy++(2-3)Microsoft Visual Studio 2010Win32

1Windows
2
3
4
5Finder
6
Spy++135

935

DPI V300R005C00

QQQQ QQ
(3-2-1)QQ

(3-2-1)
2

Qaliber (3-3)QQ

(3-2-2)
3

Spy++(3-4)QQ

1035

DPI V300R005C00

(3-2-3)
Spy++
QAliber Developer Standalone QAliber

3.2.3
Microsoft Visual Studio 2010QAliber
Developer StandaloneSpy++
Qaliber

1vs2010projectTestCasesPackage.NET
Framework3.5bootNotepad(3-3-1)Framework3.5 (Qaliber
bug)3-3-2

(3-3-1)

1135

DPI V300R005C00

3-3-2
2Runner.csMain()(3-3-3)new
MyTestCase().Body(); MyTestCase()

(3-3-3)
3BootNotepad.csBoot3-3-4

1235

DPI V300R005C00

3-3-4
43.2.1 Boot
public void Boot()
{

UIAListItem txt39 = Desktop.UIA[@"Program Manager", @"Progman", @"UIAPane"][@"


", @"SysListView32", @"1"][@".txt", @"", @"UIAListItem"] as UIAListItem;
txt39.DoubleClick(MouseButtons.Left, new Point(29, 46));
UIADocument unknown40 = Desktop.UIA[@".txt - ", @"Notepad",
@"UIAWindow"][@"", @"Edit", @"15"] as UIADocument;
unknown40.Click(MouseButtons.Left, new Point(361, 75));
unknown40.Write("Qaliber");

1335

DPI V300R005C00

5Runner.csmainBootNotepad().Boot()
3-3-5

3-3-5
3-3-6

3-3-6

Continuevs2010Debug---Exceptions
ExceptionsManaged Debugging ExceptionsNonComVisibleBaseClass

4 QAliber

1435

DPI V300R005C00

4.1
4.1.1 QAliber
QAliber Developer Standalone
CodePath
4-1

4-1
1. public virtual UIControlBase this[string name]//
Desktop.UIA[@" - "]

2. public virtual UIControlBase this[string name, bool useRegex]//


namebooltrue
false
Desktop.UIA[@" - ",false]
Desktop.UIA[@".*",true]

3. public UIControlBase this[string name, string id]//


ID
Desktop.UIA[@" - ","UIAWindow"]

4. public UIControlBase this[string name, string id, bool


useRegex]//bool useRegexname
Desktop.UIA[@" - ","UIAWindow",fasle]
Desktop.UIA[@".*","UIAWindow",true]

5. public UIControlBase this[string name, string className, string


id]//ID
Desktop.UIA[@" - ", @"Notepad", @"UIAWindow"]

1535

DPI V300R005C00

6. public virtual QAliber.Engine.Controls.UIA.UIAControl this[string


id, int idIndex]// IDID
Desktop.UIA"UIAWindow",2]

null
4-2
WaitForControlByIDid

Desktop.UIA[@" - ", @"Notepad", @"UIAWindow"][@" - ", @"",


@"TitleBar"]

UIAWindow newWin = Desktop.UIA[@" - ", @"Notepad",


@"UIAWindow"] as UIAWindow;
UIAButton title = newWin.WaitForControlByID("TitleBar", 3000) as
UIAButton;

WaitForControlByName

Desktop.UIA[@" - ", @"Notepad", @"UIAWindow"][@" - ", @"",


@"TitleBar"]

UIAWindow newWin = Desktop.UIA[@" - ", @"Notepad",


@"UIAWindow"] as UIAWindow;
UIAButton title = newWin.WaitForControlByName(" - ", 3000)
as UIAButton;

WaitForProperty

UIAWindow newWin = Desktop.UIA[@" - ", @"Notepad",


@"UIAWindow"] as UIAWindow;
bool b = newWin.WaitForProperty("ClassName",

"Notepad", 3000);

1635

DPI V300R005C00

4-2

4.1.2 Spy++
QaliberSpy++
window api Sender
4-3,4-4
FindWindowEx

int hd =

Finder.FindWindowEx("Notepad", " - ");

FindChildWindowEx

int hdChild = Finder. FindChildWindowEx (hd, "Edit", null);

FuzzyFindWindow

int hd = Finder. FuzzyFindWindow ("Notepad", "");

FuzzyFindChildWindowEx

int hdChild = Finder.FuzzyFindChildWindowEx(hd, "Edit", null);

WaitForWindow

int hd = Finder. WaitForWindow ("Notepad", " - ",3000);

WaitForChildWindow

int hdChild = Finder. WaitForChildWindow (hd, "Edit", null,3000);

1735

DPI V300R005C00

FuzzyWaitForWindow

int hd = Finder. FuzzyWaitForWindow ("Notepad", "",3000);

FuzzyWaitForChildWindow

int hdChild = Finder. FuzzyWaitForChildWindow (hd, "Edit", null,3000);

4-3

4-4

4.1.3 Qaliber
Qaliber
AutomationElement

changeAE = AutomationElement.FromHandle((IntPtr)hd);

UIAWindow uiaWindow = new UIAWindow(changeAE));

1835

DPI V300R005C00

Qaliber
Int hd = uiaWindow. Handle;

4.2
4.2.1 Qaliber
Qaliber23

Click()

uiaWindow.Click();
uiaWindow.Click(MouseButtons.Right,new Point(10,10));
DoubleClick()

uiaWindow. DoubleClick ();


uiaWindow. DoubleClick (MouseButtons.Left,new Point(10,10));
Drag()

uiaWindow. Drag (new Point(10,10),new Point(20,20));


MoveMouseTo()

uiaWindow. MoveMouseTo (new Point(10,10));

Write()

uiaKillWindow.Write("a");
uiaKillWindow.Write("{Return}");//
uiaKillWindow.Write("{LeftCtrl}a");//ctrl+a

Refresh()

1935

DPI V300R005C00

uiaKillWindow.Refresh ();//
SetFocus()

uiaKillWindow.SetFocus ();

Invoke()

uiaBtn.Invoke ();
Check()

uiaChk.Check ();
UnCheck()

uiaChk.UnCheck ();
Clear()
Close()Maximize()Minimize()Move()Resize()Restore()
Select()AddToSelection()RemoveFromSelection()

4.2.2
Spy++

Click();

Sender.Click(hd);

Input();

Sender. Input (hd,a);

2035

DPI V300R005C00

SetFocus();

Sender. SetFocus (hd);


windows APIQaliber
SetWindowForeground();//
SetWindowMax();//
SetWindowTop();//

4.2.3 DpiEx
DpiEx
6
1ICA
2
3/
4ICA ICA
5
6
612456DpiEx
DPI V300R005C00

5
Bitcomet
Bitcomet

Bitcomet5-1,5-2

5-1

2135

DPI V300R005C00

5-2
Bitcomet.xmlC:\Documents and Settings\ \Application
Data\BitComet
Bitcomet.xml

5-3

5-3
---------

5-4

5-4
----BT-----
5-55-65-7

2235

DPI V300R005C00

5-5

5-6

5-7
------------------
5-8

2335

DPI V300R005C00

5-8

6
1ICA
2
3Bitcomet/
4ICA ICA
5
6
DownloadBase
//
try { Initial(); }
catch (DpiException e) { throw new Exception(e.Message);
}

catch (Exception e) { throw new Exception("",

e); }

}
", e); }

//
try { CloseApp(); }
catch (DpiException e) { throw new Exception(e.Message);
catch (Exception e) { throw new Exception("
//
try { SetConfig(); }
catch (DpiException e) { throw new Exception(e.Message);

}
", e); }

}
e); }

catch (Exception e) { throw new Exception("


// ICA
try { StartICA(); }
catch (DpiException e) { throw new Exception(e.Message);
catch (Exception e) { throw new Exception("ICA",
//
try { StartApp(); }

2435

DPI V300R005C00

}
", e); }

catch (DpiException e) { throw new Exception(e.Message);


catch (Exception e) { throw new Exception("
//
try { SetOption(); }
catch (DpiException e) { throw new Exception(e.Message);

catch (Exception e) { throw new Exception("",

e); }
//
try { CreateTask(); }
catch (DpiException e) { throw new Exception(e.Message);
}

catch (Exception e) { throw new Exception("",

e); }
////
//try { GetSpeed(); }
//catch (DpiException e) { throw new
Exception(e.Message); }
//catch (Exception e) { throw new Exception("
", e); }
//
try { HandleTestResult(); }
catch (DpiException e) { throw new Exception(e.Message);
}
", e); }

catch (Exception e) { throw new Exception("


//
try { CloseApp(); }
catch { WriteLog(""); }
// ICA
try { CloseICA(); }
catch { WriteLog("ICA"); }
//
try { CopyReport(); }
catch (DpiException e) { WriteLog(e.Message); }
catch (Exception) { WriteLog(""); }
//
try { WriteSql(); }
catch (DpiException e) { WriteLog(e.Message); }
catch (Exception) { WriteLog(""); }

SetConfig SetOptionCreateTask2GetCurrentSpeed
DpiExBitcometDownload
DownloadBase SetConfig SetOptionCreateTask2
GetCurrentSpeed
SetConfigxml
//xmlFile
string xmlFile = GetIniPrivate("bitcometXml");//
ini

2535

DPI V300R005C00

if (File.Exists(xmlFile))
{
File.Delete(xmlFile);
}

CreateTask

//

//mainWindow

UIALabel uiaFoundTask = mainWindow[@"splitter",


@"wxWindowNR", @"-31990"][@"splitter", @"wxWindowNR", @"-31988"]
[@"panel", @"wxWindowNR", @"-31985"][@"", @"SysListView32", @"-31948"]
[@"UIAListItem", 0][@"UIALabel", 6] as UIALabel;
if (null != uiaFoundTask)
{
//
uiaFoundTask.Click();
uiaFoundTask.Write("({LeftCtrl}a)");
//
UIAButton uiaDelTask = mainWindow[@"panel",
@"wxWindowNR", @"-31961"][@"", @"ToolbarWindow32", @"500"][@"", @"",
@"Item 11"] as UIAButton;
uiaDelTask.Click();
.
}

//
UIAButton uiaOpen = mainWindow[@"panel", @"wxWindowNR", @"31961"][@"", @"ToolbarWindow32", @"500"][@"", @"", @"Item 1"] as
UIAButton;
uiaOpen.Click();
//
//
UIAEditBox uiaEdit = mainWindow[@"", @"#32770",
@"UIAWindow"][@"(N):", @"ComboBox", @"1148"][@"(N):", @"Edit",
@"1148"] as UIAEditBox;
//
setValue(uiaEdit, bitcometTask);

//
UIAButton uiaBtnDown = mainWindow[@"BT", @"#32770",
@"UIAWindow"][@"(D)", @"Button", @"5100"] as UIAButton;
uiaBtnDown.Click();
Thread.Sleep(500);

SetOption

UIAButton btnOption = mainWindow[@"panel", @"wxWindowNR",


@"-31961"][@"", @"ToolbarWindow32", @"500"][@"", @"", @"Item 14"] as
UIAButton;
btnOption.Invoke();

//CommonTreebook
UIAPane uiaPane = uiaWinOptionDialog[@"CommonTreebook",
@"wxWindowNR", @"UIAPane"] as UIAPane;
//Tree

2635

DPI V300R005C00

as UIATree;

UIATree uiaTree = uiaPane.WaitForControlByID("-31911", 3000)

//------------------------------
---------------------------------//Tree
UIATreeItem uiaTreeItem = uiaTree[@"", @"",
@"UIATreeItem"][@"", @"", @"UIATreeItem"] as UIATreeItem;
uiaTreeItem.Click();
//
UIAPane uiaPaneContent = uiaPane.WaitForControlByID("31781", 3000) as UIAPane;
UIAComboBox uiaComboBox = uiaPaneContent[@":",
@"ComboBox", @"UIAComboBox"] as UIAComboBox;
//
UIAButton uiaButtonDrop =
uiaComboBox.WaitForControlByID("DropDown", 3000) as UIAButton;
uiaButtonDrop.Click();
//
UIAListItem uiaListItem = uiaComboBox[@":",
@"ComboLBox", @"ListBox"][proxy, @"", @"UIAListItem"] as UIAListItem;
uiaListItem.Select();
//
if (!strNo.Equals(proxy))
{
//
UIAEditBox uiaEditBoxServer = uiaPaneContent[@":",
@"Edit", @"-31779"] as UIAEditBox;
uiaEditBoxServer.Clear();
uiaEditBoxServer.Write(myConfig.proxyIp);
//
UIAEditBox uiaEditBoxPort = uiaPaneContent[@":",
@"Edit", @"-31778"] as UIAEditBox;
uiaEditBoxPort.Clear();
uiaEditBoxPort.DoubleClick();
uiaEditBoxPort.Write(myConfig.proxyPort.ToString());
//
UIACheckBox uiaCheck = uiaPaneContent[@"
", @"Button", @"UIACheckBox"] as UIACheckBox;
if (ToggleState.Off == uiaCheck.CheckState)
{
uiaCheck.Check();
}
//
UIAEditBox uiaEditBoxUser = uiaPaneContent[@":",
@"Edit", @"-31776"] as UIAEditBox;
uiaEditBoxUser.Clear();
uiaEditBoxUser.Write(myConfig.proxyName);
//
UIAEditBox uiaEditBoxCode = uiaPaneContent[@":",
@"Edit", @"-31775"] as UIAEditBox;
uiaEditBoxCode.Clear();
uiaEditBoxCode.Write(myConfig.proxyPwd);
}
//------------------------------
---------------------------------//TreeBT
UIATreeItem uiaTreeItemTaskBtDwon = uiaTree[@"", @"",
@"UIATreeItem"][@"BT", @"", @"UIATreeItem"] as UIATreeItem;
uiaTreeItemTaskBtDwon.Click();
//
UIAPane uiaPaneEncryptContent =

2735

DPI V300R005C00

uiaPane.WaitForControlByID("-31819", 3000) as UIAPane;


UIAComboBox uiaComboBoxEncrypt =
uiaPaneEncryptContent.WaitForControlByID("-31815", 3000) as UIAComboBox;
//BT
UIAButton uiaButtonDropEncrypt =
uiaComboBoxEncrypt.WaitForControlByID("DropDown", 3000) as UIAButton;
uiaButtonDropEncrypt.Click();
//BT
UIAListItem uiaListItemEncrypt = uiaComboBoxEncrypt[@"
BT", @"ComboLBox", @"ListBox"][encrypt, @"",
@"UIAListItem"] as UIAListItem;
uiaListItemEncrypt.Select();

//
int hdConfirmButton =
Finder.FindChildWindowEx(hdOptionDialog, "Button", "");
if (0 == hdConfirmButton)
{
throw new DpiException("!");
}
//
AutomationElement aeConfirem =
AutomationElement.FromHandle((IntPtr)hdConfirmButton);
UIAButton uiaBtnConfirem = new UIAButton(aeConfirem);
//
uiaBtnConfirem.Invoke();

GetCurrentSpeed
int speed = 0;
//
UIAButton titleBar =
mainWindow.WaitForControlByID("TitleBar", 1000) as UIAButton;
string titleBarInfo = titleBar.Name.ToString();
//10 kB/s 10
int beginPos = titleBarInfo.IndexOf(":") + 1;
int endPos = titleBarInfo.IndexOf(",");
int length = endPos - beginPos;
string speedtmp = titleBarInfo.Substring(beginPos, length);
speedtmp = speedtmp.Substring(0, speedtmp.IndexOf("kB"));
Int32.TryParse(speedtmp, out speed);
return (float)speed;

2835

DPI V300R005C00

BitcometDownload
Ini
iniCommon.iniBitcomet.ini
Common.ini
#------------------------------------------------------------------------------#
[SQL]
#Ip
DataBaseIp = 192.168.70.18
#
DataBaseName = dpi_v3r5
#
DataBaseUsr = sa
#
DataBasePwd = sa
#
DataBaseTable = testInfo
#--------------------------------------- --------------------------------------#
[File]
#
Fileserver = 192.168.70.18
FilePath = ICA_Report\ICA_Report_Test
#-------------------------------------------------------------------------------#
[Proxy]
# no;1http;2socks5;3https; 4socks4

ProxyType = no
#IP
ProxyIp = 58.60.106.28
#
ProxyPort = 1080
#
ProxyName = dpitest
#
ProxyPwd = dpitest
#
ProxyHost = www.baidu.com
#---------------------------------------ICA -----------------------------------------#

2935

DPI V300R005C00

[ICA]
#
ICAUserID = 10096
#ica
ICAUserName = xbl
#ica
ICAPassWord = xbl
#ICAIP
ICAIP = 192.168.70.1
#ica
ICAPath = D:\ica_client\bin
#ica
ICAConfigPath = D:\ica_client\config\UserClientCfg.ini
#ICA
ICAProccessName = ICAClient_release_20120503.exe
Bitcomet.ini
# configmanganer
#------------------------------ICA ------------------------------#
[ICA]
#
ICAProtocolName = Bitcomet
#
FilterRule = [block]|[*,*,*,*,*,*,BitTorrent_Data_TCP]|[*,*,*,*,*,*,BitTorrent_Tracker_UDP]|
[*,*,*,*,*,*,BitTorrent_Tracker_HTTP]|[*,*,*,*,*,*,BitTorrent_DHT_Control]|
[*,*,*,*,*,*,BitTorrent_HTTP_GetSeed]|[*,*,*,*,*,*,BitTorrent_Data_UDP]|
[*,*,*,*,*,*,BitTorrent_Data_UDP_Encrypted]|[*,*,*,*,*,*,BitTorrent_Data_TCP_Encrypted]
[*,*,*,*,*,*,BitTorrent_REG_HTTP]|[*,*,*,*,*,*,BitTorrent_Login_HTTP]|
[*,*,*,*,*,*,BitTorrent_Data_HTTP]|[*,*,*,*,*,*,BitTorrent_UTP]
#FilterRule = [limit]|[*,*,*,*,*,*,BitTorrent_Data_TCP,5000]|[*,*,*,*,*,*,BitTorrent_Tracker_UDP,5000]|
[*,*,*,*,*,*,BitTorrent_Tracker_HTTP,5000]|[*,*,*,*,*,*,BitTorrent_DHT_Control,5000]|
[*,*,*,*,*,*,BitTorrent_HTTP_GetSeed,5000]|[*,*,*,*,*,*,BitTorrent_Data_UDP,5000]|
[*,*,*,*,*,*,BitTorrent_Data_UDP_Encrypted,5000]|[*,*,*,*,*,*,BitTorrent_Data_TCP_Encrypted,5000]
[*,*,*,*,*,*,BitTorrent_REG_HTTP,5000]|[*,*,*,*,*,*,BitTorrent_Login_HTTP,5000]|
[*,*,*,*,*,*,BitTorrent_Data_HTTP,5000]|[*,*,*,*,*,*,BitTorrent_UTP,5000]
#softName

3035

DPI V300R005C00

AppName = Bitcomet
#softVersion
AppVersion = 1.32.3.13
#------------------------------ ------------------------------#
[General]
#
LogPath = D:\log\bitcomet\
#exe
ExePath = C:\Program Files\BitComet\BitComet.exe
#_
#Scene = _Bittorrent-()
Scene = _Bittorrent
#------------------------------------------------------------#
#bitcomet
bitcometCache = C:\Downloads
#bicomet
bitcometChildDir = DVD-RMVB.2011

#bitcometxml
bitcometXml = C:\Documents and Settings\chinasoft\Application Data\BitComet\BitComet.xml
#bitcomet
bitcometTask = E:\bttorrent\DVD-RMVB.2011
.torrent
#encryptno
#encrypt = encrypt
encrypt = no
#
Rate = 60
2
/// <summary>
///
/// </summary>
private string GetIniPrivate(string var)
{
if (null == var)

3135

DPI V300R005C00

return null;
}
string fileTmp = Environment.CurrentDirectory;
string currConfigFile = fileTmp + @"\" + configFile;
IniClass myini = new IniClass(currConfigFile);
return myini.IniReadValue("General", var);

/// <summary>
/// INI
/// </summary>
/// <param name="Section">( [TypeName] )</param>
/// <param name="Key"></param>
/// <param name="file"></param>
/// <returns> </returns>
public static string IniReadValue(string Section, string Key, string
file)

{
if (File.Exists(file))
{
StringBuilder temp = new StringBuilder(500);
GetPrivateProfileString(Section, Key, "", temp, 500, file);
return temp.ToString();
}
else
{
return String.Empty;
}
}

3235

DPI V300R005C00

Bitcomt
Qaliberspy++

3335

DPI V300R005C00

Qaliber
Name
UIAButton
UIACheckBox
UIAComboBox
UIAControl
UIADocument
UIAEditbox
UIAGroup
UIALabel
UIAListBox
UIAListItem
UIAMenu
UIAMenuItem
UIAPane
UIARadioButton
UIARange
UIARoot
UIATab
UIATabItem
UIATable
UIAToolbar
UIATree
UIATreeItem

3435

DPI V300R005C00

UIAWindow
overide
Class name
AudioAndVideoCalledBase

Override
SetConfig
SetOption
AcceptInvite
IsWindowsExist

AudioAndVideoCallerBase

ADKiller
SetConfig
SetOption
PrepareForInvite
SendInvite

DownloadBase

ADKiller
SetConfig
SetOption
CreateTask
GetCurrentSpeed

LoginBase

ADKiller
SetConfig
SetOption
LoginAPP
GetLoginResult

ResumeDownloadBase

ADKiller
SetConfig
SetOption
CreateTask
GetCurrentSpeed
PauseTask
ResumeTask
ADKiller

3535

You might also like