CN104133770A - Universal automatic testing method - Google Patents

Universal automatic testing method Download PDF

Info

Publication number
CN104133770A
CN104133770A CN201410379259.1A CN201410379259A CN104133770A CN 104133770 A CN104133770 A CN 104133770A CN 201410379259 A CN201410379259 A CN 201410379259A CN 104133770 A CN104133770 A CN 104133770A
Authority
CN
China
Prior art keywords
testing
case
conds
automationelement
new
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410379259.1A
Other languages
Chinese (zh)
Inventor
常亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN201410379259.1A priority Critical patent/CN104133770A/en
Publication of CN104133770A publication Critical patent/CN104133770A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention provides a universal automatic testing method. According to the universal automatic testing method, a testing case configuration file is read, testing operation is simulated, a testing process the same as a testing process carried out by testing personnel can be realized through programs under windows, the testing case configuration file is convenient to store and transfer, the problem that testing cases between iteration versions can not be completely covered is solved, testing cases can be shared among the testing personnel, and the discount problem of knowledge transmission in the traditional testing case transferring process (oral transferring or document transferring) is avoided. According to the universal automatic testing method, the testing cases are saved through files, the testing process can be assigned through a timed task, an unattended testing process can be realized, manpower is saved, and the testing time is shortened. The quality of new versions can be guaranteed through version iteration of the testing cases, automatic testing enables the testing personnel to spend more time in analyzing and improving the testing cases, and the universal automatic testing method can greatly improve quality of software products.

Description

A kind of general automatic test approach
Technical field
The present invention relates to a kind of computer utility, specifically a kind of general automatic test approach.
Background technology
At present under windows, the test job of application program is all still that tester tests by manual operation software substantially, test case can preserve can, inheritance is lower, between tester, the transmission of test case also exists knowledge transmission to omit problem; Cover the use-case of version in the past completely because the existence of these problems has caused being difficult to the definitely use-case of a rear version in version iterative process, cause test to omit.
Summary of the invention
The object of this invention is to provide a kind of general automatic test approach.
The object of the invention is to realize in the following manner, to use XML configuration file accurately to describe testing procedure, routine call XML configuration file automatic imitation user operation, realize software automated testing work, by read test use-case configuration file, program under windows is simulated with operation, the test case of taking is used document storing, test process is specified by timed task, realize unattended test process, thereby save manpower and test duration, can ensure the quality of redaction by version iteration tests use-case.
Excellent effect of the present invention is as follows:
1) test process can ensure complete reproduction test case in the past;
2) test case can cover the test case of last revision completely;
3) test process can be realized the test automatically of unmanned ground;
4) testing tool completely the action of the mouse-keyboard in simulation test process carry out test job.
Each test case is used the mode of file to preserve, once definition, all determine in steps, can not there is not again causing because of the difference operating in test process in manual testing's process the difference of test result.
Test case can form according to this edition iteration of tested system the iteration version of test case, the test case that can ensure redaction covers the test of early version completely and has used, the feature automatically performing in conjunction with test case, tester is without considering old test case, only need to be concerned about the function that redaction increases, existing function can rely on early version test case to ensure.
Test process can automatically perform, and can realize unattended test process, can effectively save tester's time and efforts.
This method of testing is no longer simply to use windwosAPI to realize the operation of analog mouse keyboard, but uses more advanced interface control Dynamic Acquisition technology.Used windowsAPI can get most of interface control in the past, but the interface (as DirectUI) for dynamic generation is to get control, thereby analog subscriber operation accurately, and the method for the interface control Dynamic Acquisition that this method is used can realize the operation at conventional interface, also can realize the operation at the interface of dynamic generation.
Embodiment
Embodiment:
Concrete steps are as follows:
1) defined node
private?const?int?WM_GETTEXTLENGTH?=?0x000E;
private?const?int?WM_GETTEXT?=?0x000D;
private?const?int?WM_SETTEXT?=?0x000C;
public?class?Mstt
{
public?XmlNode?node;
public?AutomationElement?element;
public?List<Mstt>?children;
}
2) carry out testing procedure
// execution testing procedure
public?void?ExecSetp()
{
XmlNode?RootNode?=?m_ScriptDoc.DocumentElement;
XmlNodeList?node_list?=?RootNode.ChildNodes;
Mstt?root?=?new?Mstt();
root.node?=?RootNode;
root.element?=?m_Desktop;
root.children?=?XmlNodeChildNodes_recursive(root);
}
3) recursive analysis node content
public?List<Mstt>?XmlNodeChildNodes_recursive(Mstt?parent)
{
List<Mstt>?rtNodeEle?=?new?List<Mstt>();
rtNodeEle?=?XmlNodeChildNodes(parent);
foreach?(Mstt?i?in?rtNodeEle)
{
i.children?=?XmlNodeChildNodes_recursive(i);
}
return?rtNodeEle;
}
4) obtain child node list
// obtain child node
public?List<Mstt>?XmlNodeChildNodes(Mstt?parent)
{
XmlNode?xmlPraent?=?parent.node;
AutomationElement?AuEParent?=?parent.element;
List<Mstt>?rtNodeEle?=?new?List<Mstt>();
foreach?(XmlNode?node?in?xmlPraent.ChildNodes)
{
Mstt?mt_tmp?=?new?Mstt();
#region?Element
if?(node.Name?==?"element")
{
int?index?=?0;
List<PropertyCondition>?conds?=?new?List<PropertyCondition>();
for?(int?i?=?0;?i?<?node.Attributes.Count;?i++)
{
switch?(node.Attributes[i].Name)
{
case?"index":
index?=?System.Convert.ToInt32(node.Attributes[i].Value);
break;
case?"NameProperty":
conds.Add(new?PropertyCondition(AutomationElement.NameProperty,?node.Attributes[i].Value));
break;
case?"ClassNameProperty":
conds.Add(new?PropertyCondition(AutomationElement.ClassNameProperty,?node.Attributes[i].Value));
break;
#region condition type: ControlTypeProperty
case?"ControlTypeProperty":
{
switch?(node.Attributes[i].Value)
{
case?"Button":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Button));
break;
case?"Calendar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Calendar));
break;
case?"CheckBox":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.CheckBox));
break;
case?"ComboBox":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ComboBox));
break;
case?"Custom":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Custom));
break;
case?"DataGrid":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.DataGrid));
break;
case?"DataItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.DataItem));
break;
case?"Document":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Document));
break;
case?"Edit":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Edit));
break;
case?"Group":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Group));
break;
case?"Header":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Header));
break;
case?"HeaderItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.HeaderItem));
break;
case?"Hyperlink":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Hyperlink));
break;
case?"Image":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Image));
break;
case?"List":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.List));
break;
case?"ListItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ListItem));
break;
case?"Menu":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Menu));
break;
case?"MenuBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.MenuBar));
break;
case?"MenuItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.MenuItem));
break;
case?"Pane":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Pane));
break;
case?"ProgressBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ProgressBar));
break;
case?"RadioButton":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.RadioButton));
break;
case?"ScrollBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ScrollBar));
break;
case?"Separator":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Separator));
break;
case?"Slider":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Slider));
break;
case?"Spinner":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Spinner));
break;
case?"SplitButton":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.SplitButton));
break;
case?"StatusBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.StatusBar));
break;
case?"Tab":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Tab));
break;
case?"TabItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.TabItem));
break;
case?"Table":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Table));
break;
case?"Text":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Text));
break;
case?"Thumb":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Thumb));
break;
case?"TitleBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.TitleBar));
break;
case?"ToolBar":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ToolBar));
break;
case?"ToolTip":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.ToolTip));
break;
case?"Tree":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Tree));
break;
case?"TreeItem":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.TreeItem));
break;
case?"Window":
conds.Add(new?PropertyCondition(AutomationElement.ControlTypeProperty,?ControlType.Window));
break;
default:
System.Console.WriteLine (" not processing costs attribute 0}, value | ì 1} ", node.Attributes[i] .Name, node.Attributes[i] .Value);
break;
}
break;
}
#endregion condition type: ControlTypeProperty
default:
System.Console.WriteLine (" can not processing attribute attribute 0}, value 1} ", and node.Attributes[i] .Name, node.Attributes[i] .Value);
break;
}
}
mt_tmp.node?=?node;
if?(AuEParent?!=?null)
{
if?(index?==?0)
{
if?(conds.Count?==?1)
mt_tmp.element?=?AuEParent.FindFirst(TreeScope.Children,?conds[0]);
else?if?(conds.Count?>?1)
{
mt_tmp.element?=?AuEParent.FindFirst(TreeScope.Children,?new?AndCondition(conds.ToArray()));
}
else?if?(conds.Count?==?0)
{
mt_tmp.element?=?AuEParent.FindFirst(TreeScope.Children,?Condition.TrueCondition);
}
rtNodeEle.Add(mt_tmp);
}
else
{
if?(conds.Count?==?1)
{
AutomationElementCollection?aec?=?AuEParent.FindAll(TreeScope.Children,?conds[0]);
if?(aec.Count?>?index)
{
mt_tmp.element?=?aec[index];
}
else
{
System.Console.WriteLine (" 0} index 1} is too large, find altogether 2} object ", mt_tmp.node.InnerXml, index, aec.Count);
}
}
else?if?(conds.Count?>?1)
{
mt_tmp.element?=?AuEParent.FindAll(TreeScope.Children,?new?AndCondition(conds.ToArray()))[index];
}
else?if?(conds.Count?==?0)
{
mt_tmp.element?=?AuEParent.FindAll(TreeScope.Children,?Condition.TrueCondition)[index];
}
if?(mt_tmp.element?==?null)
System.Console.WriteLine (" do not find Object node: { 0} ", mt_tmp.node.InnerXml);
rtNodeEle.Add(mt_tmp);
}
}
else
{
System.Console.WriteLine (" father node the object of 0} does not find ", xmlPraent.InnerXml);
rtNodeEle.Add(mt_tmp);
}
}
#endregion?Element
#region?Operator
else?if?(node.Name?==?"operator")
{
if?(node.Attributes["event"].Value?==?"Click")
{
ButtonDown(AuEParent);
}
else?if?(node.Attributes["event"].Value?==?"SetText")
{
SetText(AuEParent,?node.Attributes["text"].Value);
}
}
#endregion?Operator
The #region control information of sealing
else?if?(node.Name?==?"printchildren")
{
GetChildrenCtrl(AuEParent,?true);
}
The #endregion control information of sealing
#region prints component information
else?if?(node.Name?==?"print")
{
printMst(parent);
}
The #endregion control information of sealing
}
return?rtNodeEle;
}
// button is pressed
public?void?ButtonDown(AutomationElement?button)
{
var?clickPattern?=?(InvokePattern)button.GetCurrentPattern(InvokePattern.Pattern);
clickPattern.Invoke();
}
[DllImport("User32.dll",?EntryPoint?=?"SendMessage")]
private?static?extern?int?SendMessage(int?hWnd,?int?Msg,?int?wParam,?string?lParam?);
// text is set
public?void?SetText(AutomationElement?edit,?string?text)
{
int?nativeHandle1;
object?nativeHandleNoDefault?=
edit.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty,?true);
if?(nativeHandleNoDefault?!=?AutomationElement.NotSupported)
{
nativeHandle1?=?(int)nativeHandleNoDefault;
System.Console.WriteLine (" handle getting: 0} ", nativeHandle1);
int?textLength?=?SendMessage(nativeHandle1,?WM_SETTEXT,?0,?text);
}
}
Except the technical characterictic described in instructions, be the known technology of those skilled in the art.

Claims (1)

1. a general automatic test approach, it is characterized in that by read test use-case configuration file, program under windows is simulated with operation, the test case of taking is used document storing, test process is specified by timed task, realizes unattended test process, thereby saves manpower and test duration, the quality that can ensure redaction by version iteration tests use-case, concrete steps are as follows:
1) defined node;
2) carry out testing procedure;
3) recursive analysis node content;
4) obtain child node list.
CN201410379259.1A 2014-08-04 2014-08-04 Universal automatic testing method Pending CN104133770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410379259.1A CN104133770A (en) 2014-08-04 2014-08-04 Universal automatic testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410379259.1A CN104133770A (en) 2014-08-04 2014-08-04 Universal automatic testing method

Publications (1)

Publication Number Publication Date
CN104133770A true CN104133770A (en) 2014-11-05

Family

ID=51806453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410379259.1A Pending CN104133770A (en) 2014-08-04 2014-08-04 Universal automatic testing method

Country Status (1)

Country Link
CN (1) CN104133770A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107315681A (en) * 2017-06-09 2017-11-03 上海爱优威软件开发有限公司 Application program self-starting test system, medium and method
CN112199301A (en) * 2020-11-30 2021-01-08 北京七维视觉科技有限公司 User interface automation test method, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110219359A1 (en) * 2010-03-04 2011-09-08 Oracle International Corporation Identifying test cases to be run after changes to modules of a software application
CN102799515A (en) * 2011-05-24 2012-11-28 腾讯科技(深圳)有限公司 Application program testing method and device
CN103678107A (en) * 2012-09-21 2014-03-26 上海斐讯数据通信技术有限公司 Data processing method and system
CN103914375A (en) * 2013-01-07 2014-07-09 百度国际科技(深圳)有限公司 Method and device for testing owner-drawing interface software

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110219359A1 (en) * 2010-03-04 2011-09-08 Oracle International Corporation Identifying test cases to be run after changes to modules of a software application
CN102799515A (en) * 2011-05-24 2012-11-28 腾讯科技(深圳)有限公司 Application program testing method and device
CN103678107A (en) * 2012-09-21 2014-03-26 上海斐讯数据通信技术有限公司 Data processing method and system
CN103914375A (en) * 2013-01-07 2014-07-09 百度国际科技(深圳)有限公司 Method and device for testing owner-drawing interface software

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107315681A (en) * 2017-06-09 2017-11-03 上海爱优威软件开发有限公司 Application program self-starting test system, medium and method
CN112199301A (en) * 2020-11-30 2021-01-08 北京七维视觉科技有限公司 User interface automation test method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
Lettner et al. Automated and unsupervised user interaction logging as basis for usability evaluation of mobile applications
Fenske et al. Variant-preserving refactorings for migrating cloned products to a product line
CN103914375B (en) A kind of test method and device for drawing interface software certainly
Moore Python GUI Programming with Tkinter: Develop responsive and powerful GUI applications with Tkinter
EP1612677A2 (en) Smart GUI Activity Recording and Playback Framework
US7689973B2 (en) Language for development of test harness files
Singh et al. Automated testing of mobile applications using scripting technique: A study on appium
CN109542788A (en) A kind of internal storage data evidence collecting method based on Android platform automated test tool
CN104035873A (en) Method and device for generating testing codes
CN105760296A (en) Automation testing control method, device and terminal
CN104111852A (en) Web application automated testing system and testing method based on data drive
CN106484613A (en) A kind of interface automated test frame based on fitnese
CN104133770A (en) Universal automatic testing method
Peng et al. Cat: Change-focused android gui testing
TW200805155A (en) Method and apparatus for persistently resolving events to event sources
Unger et al. The impact of inheritance depth on maintenance tasks: Detailed description and evaluation of two experiment replications
Lano et al. Case study: Class diagram restructuring
CN106227667B (en) A kind of method for generating test case of the mobile application of the IFML based on extension
Nurmuradov et al. Caret-HM: recording and replaying Android user sessions with heat map generation using UI state clustering
CN109271691B (en) Automatic extraction and quick labeling method for key characteristics
Sadeh et al. Towards unit testing of user interface code for android mobile applications
Guo et al. Crowdsourced requirements generation for automatic testing via knowledge graph
CN106569828A (en) Method of realizing simulation of touch device manual operation in expandable and customized way
CN108733566A (en) A kind of virtualization system automatization test system and method based on python
da Silva et al. Comparing Mobile Testing Tools Using Documentary Analysis

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20141105