CN104320793B - A kind of Automated testing method of cell phone short messages and system - Google Patents

A kind of Automated testing method of cell phone short messages and system Download PDF

Info

Publication number
CN104320793B
CN104320793B CN201410512435.4A CN201410512435A CN104320793B CN 104320793 B CN104320793 B CN 104320793B CN 201410512435 A CN201410512435 A CN 201410512435A CN 104320793 B CN104320793 B CN 104320793B
Authority
CN
China
Prior art keywords
test
item
tested
sms
script
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.)
Active
Application number
CN201410512435.4A
Other languages
Chinese (zh)
Other versions
CN104320793A (en
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.)
Shaanxi Chengtuo Network Co ltd
Original Assignee
Shanghai Feixun Data Communication Technology 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 Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201410512435.4A priority Critical patent/CN104320793B/en
Publication of CN104320793A publication Critical patent/CN104320793A/en
Application granted granted Critical
Publication of CN104320793B publication Critical patent/CN104320793B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/24Arrangements for testing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements

Abstract

The present invention provides a kind of SMS test automation method and system.The SMS test automation method realizes following steps in the first script:The information of preset test request file is read, and determines therefrom that the item to be tested of the SMS test;Include multiple test item information being arranged with preset format in the test request file;The item to be tested is the test item for needing to execute;For item to be tested described in each, the corresponding test script of the item to be tested is executed, and obtain the test result information of the test script;The test result information includes test result;The corresponding test script of the item to be tested is Robotium scripts;The test result information of the item to be tested is output in test result file.Technical scheme of the present invention not only increases the durability of test, and greatly improves the degree of automation of test.

Description

A kind of Automated testing method of cell phone short messages and system
Technical field
The present invention relates to a kind of mobile phone tests, more particularly to a kind of Automated testing method of cell phone short messages and system.
Background technology
Currently, the SMS function of mobile phone has become one of necessary functions of mobile phone.SMS is divided into two kinds:It is a kind of short The word or digital information that letter, which is user, to be directly transmitted or received by mobile phone or other telecommunication terminals, user can receive every time with The number of characters for sending short message, is 160 English or numerical character or 70 Chinese characters.One is multimedia message, its maximum spies Color is exactly to support multimedia function, can the comprehensive content of transfer function and information, these information include word, image, sound, The information of the various multimedia forms such as data.In the exploitation test of mobile phone, short message function test is usually needed to expend A large amount of manpower and time this is because short message function is various, and are not easy to carry out automatic test.SMS it is normal See that function includes sending short message, answer short message deletes short message, retrieves short message, short message forwarding, and short message replicates, and sends expression, sends The functions such as common phrases.Although some existing technologies have done the automatic test of short message function certain trial, but still So there is a problem of a large amount of.For example, needing the corresponding software testing environment of human configuration before test, it cannot really realize test certainly Dynamicization;Test script depends on mobile phone software and hardware setting to be tested, causes script recycling rate of waterused low;Test script is not easy Modification, it is difficult to carry out specific aim selection test, need artificially to judge test result etc..
In consideration of it, a kind of method that can be good at realizing and automatic test is carried out to short message function how is found, Become those skilled in the art to expect to solve the problems, such as.
Invention content
In view of the foregoing deficiencies of prior art, the purpose of the present invention is to provide a kind of SMS automatic tests Method and system carry out short message function to need people before testing present in automatic test in the prior art for solving Work configures corresponding software testing environment, test script is not easy dependent on mobile phone software and hardware setting to be tested, test script Modification needs artificial the problems such as judging test result.
In order to achieve the above objects and other related objects, the present invention provides a kind of SMS test automation method, institute It states SMS test automation method and realizes following steps in the first script:Read the letter of preset test request file Breath, and determine therefrom that the item to be tested of the SMS test;Include in the test request file it is multiple with preset lattice The test item information of formula setting;The item to be tested is the test item for needing to execute;For item to be tested described in each, execute The corresponding test script of the item to be tested, and obtain the test result information of the test script;The test result information Including test result;The corresponding test script of the item to be tested is Robotium scripts;By the test knot of the item to be tested Fruit information is output in test result file.
Optionally, the content of the corresponding test script of the item to be tested includes:Execute the test behaviour of the item to be tested Make, and judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, if be consistent It closes, then the test result is to pass through;If do not met, the test result is failure.
Optionally, the test operation of the item to be tested includes:Execute the behaviour for the test interface for entering the item to be tested Make, if it is determined that not entering the test interface, then the test of the item to be tested terminates, and the test result is not pass through.
Optionally, the test operation of the item to be tested includes obtaining test sectional drawing, to record the survey of the item to be tested Examination process.
Optionally, for the test item that each need not be executed, it is not test the test knot of mark to generate test result The test result is not test the test result information of mark to be output in test result file by fruit information.
Optionally, the SMS test automation method further includes being realized in the second script:To first foot This progress signature verification, and first script is installed on mobile phone to be tested.
Optionally, the SMS test automation method further includes being realized in third scenario:Described to be tested Start first script in mobile phone to be tested, the test result file is obtained after the completion of test.
The present invention also provides a kind of SMS automation system for testing, the system comprises:SMS test module, The SMS test module includes test information acquisition unit, test execution unit, test result generation unit;The survey Examination information acquisition unit is used to read the information of preset test request file, and determines therefrom that waiting for for the SMS test Test item;Include multiple test item information being arranged with preset format in the test request file;The item to be tested is Need the test item executed;The test execution unit is connected with the test information acquisition unit, for being directed to each institute Item to be tested is stated, executes the corresponding test script of the item to be tested, and obtain the test result information of the test script;Institute It includes test result to state test result information;The corresponding test script of the item to be tested is Robotium scripts;The test As a result generation unit is connected with the test item execution unit, for receiving the test result information and exporting the test In result information to test result file.
Optionally, the content of the corresponding test script of the item to be tested includes:Execute the test behaviour of the item to be tested Make, and judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, if be consistent It closes, then the test result is successfully;If do not met, the test result is failure.
Optionally, the test operation of the item to be tested includes:Execute the behaviour for the test interface for entering the item to be tested Make, if it is determined that not entering the test interface, then the test of the item to be tested terminates, and the test result is failure.
Optionally, the test operation of the item to be tested includes obtaining test sectional drawing, to record the survey of the item to be tested Examination process.
Optionally, the SMS test module is tested in information acquisition unit not for each described SMS The test item executed is needed, it is not test the test result information of mark to generate corresponding test result, by the test result Test result information not test mark is sent to the test result generation unit.
Optionally, the SMS automation system for testing further includes SMS test installation module, for institute It states SMS test module and carries out signature verification, and the SMS test module is installed in mobile phone to be tested.
Optionally, the SMS automation system for testing further includes SMS test starting module, for starting The SMS test module, and obtain the test result file.
As described above, the SMS test automation method and system of the present invention, have the advantages that:It is based on Robotium scripts are developed, and can be avoided based on control ID come operating handset as led using the exploitation of MonkeyRunner scripts The needs of cause distinguish the problem of mobile phone hardware difference and UI variations in script, meanwhile, it may be implemented using Robotium scripts Judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, improves automation journey Degree and recycling rate of waterused, reduce maintenance cost.Meanwhile technical scheme of the present invention use from it is preset include multiple In a manner of the test request file read test information of the test item information of preset format setting, it is highly convenient for test request It modifies.Technical scheme of the present invention additionally provides the automatic signature verification and installation to test program, and automatic acquisition Test result greatly simplifies the work of SMS test.
Description of the drawings
Fig. 1 is shown as the flow diagram of the SMS test automation method of the present invention.
Fig. 2 is shown as the module diagram of the SMS automation system for testing of the present invention.
Fig. 3 is shown as the workflow schematic diagram of the SMS automation system for testing of the present invention.
Component label instructions
1 SMS automation system for testing
11 SMS test modules
111 test information acquisition units
112 test execution units
113 test result generation units
12 SMSs test installation module
13 SMS test starting modules
S1~S3 steps
Specific implementation mode
Illustrate that embodiments of the present invention, those skilled in the art can be by this specification below by way of specific specific example Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through in addition different specific realities The mode of applying is embodied or practiced, the various details in this specification can also be based on different viewpoints with application, without departing from Various modifications or alterations are carried out under the spirit of the present invention.
It should be noted that the diagram provided in the present embodiment only illustrates the basic conception of the present invention in a schematic way, Then component count, shape and size when only display is with related component in the present invention rather than according to actual implementation in schema are painted System, when actual implementation kenel, quantity and the ratio of each component can be a kind of random change, and its assembly layout kenel also may be used It can be increasingly complex.
The present invention provides a kind of SMS test automation method.As shown in Figure 1, in one embodiment, the hand Machine short message test automation method realizes following steps in the first script:
Step S1, reads the information of preset test request file, and determines therefrom that the to be measured of the SMS test Try item;Include multiple test item information being arranged with preset format in the test request file;The Xiang Weixu to be tested The test item to be executed.In one embodiment, the test request file is XML file (Setting.xml), the XML Test item information is arranged with preset format in file.The XML file is positioned under preset file directory, the following institute of format Show:
First script reads the content of the XML file by CaseControl classes, and by read content pair Name the and Execute fields of CaseInfo classes should be arrived.First script includes the application that Java language is realized.The XML In with<Case Id=" ">Beginning</Case>The content of ending corresponds to a test item information, each test item information pair Answer a test case information;It is therein<Name></Name>Value correspond to the Name fields of CaseInfo classes,<Execute ></Execute>Value correspond to the Execute fields of CaseInfo classes.<Execute></Execute>Value be 1 indicate should Test item is the test item for needing to execute, i.e., the described item to be tested;<Execute></Execute>Value be 0 indicate the test Item is the test item that need not be executed.The use of the CaseControl classes and CaseInfo classes is needed to edit described first CaseControl jar packets are imported when script.Include CaseControl classes, XmlHandle classes in CaseControl jar packets With CaseInfo classes.Wherein, CaseControl classes can be used for:Read the value of Setting.xml;Judge whether Case needs It executes;Write the result into XML file;Output debugging log information;Sectional drawing is copied into specified directory etc..XmlHandle classes are available In:Read XML file;Write-in (newly-built write-in) XML file;Parse XML file;XML file is exported to specified address etc.. CaseInfo classes are used to store the various information of Case (test case), and a CaseInfo records the letter of a Case (test case) Breath, mainly has:Name field (the execution function name of Test);Execute fields (indicate whether respective function executes 0 as not It executes, 1 is execution).The CaseInfo classes can also include:CaseNo fields (serial number for indicating this Case); CaseName fields (title for indicating Case);CaseRes fields (result for indicating Case);Comment fields (indicate Case Remarks after execution);MmsToman fields (contact phone in short message test);MmsText;Field (will be sent out in short message test To the information of other people).The test request file may be other kinds of file, and the preset format setting can also For other preset formats, the reading and recording method and format are all not limited to the format of example provided above, can be in practice It is set as needed, as long as the item to be tested that the SMS test is read and determined therefrom that for first script can be met .In one embodiment, the test item may include following test item:Send a short message;It retrieves already existing Short message;Newly-built common phrases;Change common phrases;Delete common phrases;Delete all dialogues;Receive short message test;It sends Short message expression;A short message is deleted after long-press;A short message is replicated after long-press;Forwarding short message content after long-press;It is locked after long-press Short message;Long-press is stored into SIM card.
Step S2 executes the corresponding test script of the item to be tested, and obtain institute for item to be tested described in each State the test result information of test script;The test result information includes test result;The corresponding test of the item to be tested Script is Robotium scripts.In one embodiment, the item to be tested is Execute field values in CaseInfo records For 1 test item.The corresponding test script of the item to be tested is using Robotium script edits and the item to be tested In test script corresponding with the value of Name field.It is such as directed to the example to be tested that Name is testCase01, may be set in the The corresponding script of its in one test script is method testCase01 or function testCase01.Robotium is a external Android automatic test scripts, the application mainly for Android platform carry out black box automatic test, it provides mould The API for intending various gesture operations (click, long-press, sliding etc.), searching and assert mechanism, can operate various controls. The test frame that Robotium combination Android officials provide reaches the test automated to application program.Robotium Script mainly creates test case (or being test case), the main action statement of Solo by using the example of Solo objects Have:Solo.clickOnView (clicks view);Solo.sendKey (clicks secondary or physical bond Menu, Home, Back); Solo.enterText (input word);Solo.clickOnButton (clicks specific button); Solo.clickOnImageButton (clicks particular pictorial button);Solo.waitForActivity (confirms specific Activity is either with or without startup);Solo.searchText (whether search specified word occurs);solo.takeScreenshot (current page sectional drawing) etc..
In one embodiment, the content of the corresponding test script of the item to be tested includes:Execute the item to be tested Test operation, and judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, If be consistent, the test result is to pass through;If do not met, the test result is failure.In one embodiment In, there is different default results for different test cases, for example, the default result for sending a short message can be to have been connect Receive message receipt (can be used sentence if (solo.waitForText (and testPhoneNo1+ " message received ", 1, WAITTIME*50)) judge).It for different test cases, may be used whether comparison short message content meets preset content, send Whether success icon shows, if has prompt to send successfully POP frames message, whether message list has increase or reduction, specifically Activity is either with or without the methods of correct startup to determine whether test result.These judgements are provided with different default results, And solo sentences may be used to realize.By judge result after the completion of the test operation whether with the item to be tested Whether default result is consistent, determine the example to be tested by the test;If be consistent, the test result is logical It crosses;If do not met, the test result is failure (or not passing through).
In one embodiment, the test script further includes that the test operation of the item to be tested includes:Execute entrance The operation of the test interface of the item to be tested, if it is determined that do not enter the test interface, then the test of the item to be tested Terminate, the test result is failure (or not passing through).For example, being surveyed to test case " retrieving already existing short message " It when examination, completes after sending for the short message of retrieval, needs to enter information list interface, at this moment, can detect whether to enter described Test interface (being at this time " information list interface "), can be used Solo sentences judge (if (!solo.waitForActivity(" ConversationList ", WAITTIME*4))), if it is determined that do not enter the test interface, then the survey of the item to be tested Examination terminates, and the test result is failure (or not passing through).If it is determined that into the test interface, then continue to test.
In one embodiment, the test operation of the item to be tested includes obtaining test sectional drawing, described to be measured to record Try the test process of item.For example, for test case " newly-built short message " test, respectively newly-built short message operation beginning when, When note number content is written, when sending short message, test sectional drawing is obtained when obtaining transmission result, and the test sectional drawing is preserved In preset catalogue.These test sectional drawings completely save the process of test, can be used for manually determining test for user As a result.
The test result information of the item to be tested is output in test result file by step S3.Specifically, it will obtain The test result information of item to be tested be output in test result file, the test result information is stored in preset format In the test result file.In one embodiment, the test result file be XML file (such as:CaseRes.xml), Its content is as follows:
<ResInfo>
<Res Id=" Music_01 ">
<CaseName>Send a short message (newly-built)</CaseName>
<CaseRes>Pass</CaseRes>
<Comment>Determination method:Occur sending receipt</Comment>
</Res>
<ResInfo>
<Res Id=" Music_02 ">
<CaseName>Retrieve already existing short message</CaseName>
<CaseRes>Pass</CaseRes>
<Comment>Determination method:The item number that the item number and title retrieved is shown meets, and retrieval content please check sectional drawing </Comment>
</Res>
Wherein, Pass indicates that test result is to pass through or successfully;If test result be not by or failure, can be with Fail is indicated.
In one embodiment, first script further includes the operation for the test item that need not be executed:For every One test item that need not be executed, it is not test the test result information of mark to generate test result, by the test result Test result information not test mark is output in test result file.The mark of not testing can be fixed by user Justice, it is not test mark such as to define " NT ", then the test result of the test item to that need not execute is set as " NT ".It tests knot The corresponding contents of fruit file (CaseRes.xml) are as follows:
<ResInfo>
<Res Id=" Music_03 ">
<CaseName>Retrieve already existing short message</CaseName>
<CaseRes>NT</CaseRes>
<Comment>Determination method:Create self-defined phrase success</Comment>
</Res>
In one embodiment, the SMS test automation method further includes being realized in the second script:To institute It states the first script and carries out signature verification, and first script is installed on mobile phone to be tested.Second script includes pair The signature verification order of first script and the installation order after signature verification.Second script can also include counterweight Automatic test script after new signature optimizes.The realization content of one example of second script includes:
@echo off
Set apkname=Mms_Test.apk
::Apkname automatized script apk titles
Set apkname=Mms_Test_new.apk
::Apknewname sign again after automatized script title
Java-jar signapk.jar testkey.x509.pem testkey.pk8%apkname%% Apknewname%
::Optimize apk
Adb install-r%apknewname%
::Again the automatized script after signing is installed to mobile phone
pause
Wherein,::Indicate annotation.User can be from Android source code positions { platform/build/target/ Product/security/ } inner find the signature files such as platform.pk8 platform.x509.pem.signapk.jar File can be found from Android source code positions {/out/host/linux-x86/framework/ } are inner.Second script Execution need first by automatic test script file (Mms_Test.apk) and signature file (platform.pk8 Platform.x509.pem) and signapk.jar files are put under the file where the second script in a tester, and will Mobile phone to be tested is connected to using adb in test machine.
In one embodiment, the SMS test automation method further includes being realized in third scenario:Institute It states and starts first script in mobile phone to be tested and tested, the test result file is obtained after the completion of test.It is described Third scenario is included in the order and institute is obtained after the completion of test for just having started that the first script is tested in mobile phone to be tested State the order of test result file.In one embodiment, the third scenario can also include that the test obtained in test is cut The order of map file.The realization content of one example of the third scenario includes:
@echo off
Set TestPackageName=com.example.ad.test
::The PackageName of TestPackageName test scripts
Set TestedPackageName=com.android.music
::TestedPackageName is tested the PackageName of apk
Adb shell am instrument-w%TestPackageName%/ com.neenbedankt.android.test.InstrumentationTestRunner
::Adb shell am instrument start the monitoring to instrument examples
::Under com.neenbedankt.android.test.InstrumentationTestRunner this environment The AndroidManifest.xml of testing engineering is searched, the PackageName for being tested APK is therefrom obtained, for keeping adb Shell is completed until test
Echo is completed ...
Adb pull/data/data/%TestedPackageName%/files/TEST-all.xml d:\ TestResult
adb pull/mnt/sdcard/CaseRes.xml d:\TestResult
Echo is completed ...
pause
Wherein, com.example.ad.test is the packet name for the test script for including the first script, Com.android.music is the packet name of tested apk.Adb shell-commands are used to start the first foot in mobile phone to be tested This is tested;Test result file (CaseRes.xml) is obtained from mobile phone to be tested using adb pull orders.
The present invention also provides a kind of SMS automation system for testing.In one embodiment, as shown in Fig. 2, it is described SMS automation system for testing 1 includes:
SMS test module 11, the SMS test module 11 include test information acquisition unit 111, test Execution unit 112, test result generation unit 113.Wherein:
The test information acquisition unit 111 is used to read the information of preset test request file, and determines therefrom that institute State the item to be tested of SMS test;Include multiple test item letters being arranged with preset format in the test request file Breath;The item to be tested is the test item for needing to execute.In one embodiment, the test request file is XML file (Setting.xml), test item information is arranged with preset format in the XML file.The XML file is positioned over preset file Under catalogue, format is as follows:
Test information acquisition unit 111 reads the content of the XML file by CaseControl classes, and will be read Content correspond to Name the and Execute fields of CaseInfo classes.In the XML with<Case Id=" ">Beginning</ Case>The content of ending corresponds to a test item information, each test item information corresponds to a test case information;It is therein <Name></Name>Value correspond to the Name fields of CaseInfo classes,<Execute></Execute>Value correspond to The Execute fields of CaseInfo classes.<Execute></Execute>Value be the 1 expression test item be the survey for needing to execute Try item, i.e., the described item to be tested;<Execute></Execute>Value be the 0 expression test item be the test that need not be executed .The use of the CaseControl classes and CaseInfo classes is needed to import CaseControl jar packets.CaseControl Include CaseControl classes, XmlHandle classes and CaseInfo classes in jar packets.Wherein, CaseControl classes can be used for:It reads Take the value of Setting.xml;Judge whether Case needs to execute;Write the result into XML file;Output debugging log information;It will Sectional drawing copies to specified directory etc..XmlHandle classes can be used for:Read XML file;Write-in (newly-built write-in) XML file;Parsing XML file;XML file is exported to specified address etc..Various information of the CaseInfo classes for storing Case (test case), one CaseInfo records the information of a Case (test case), mainly has:Name field (the execution function name of Test); Execute fields (indicate whether respective function executes 0 not execute, 1 is execution).The CaseInfo classes can also include: CaseNo fields (serial number for indicating this Case);CaseName fields (title for indicating Case);CaseRes fields (indicate The result of Case);Comment fields (indicate the remarks after Case is executed);(contact person is electric in short message test for MmsToman fields Words);MmsText;Field (information that other people is issued in short message test).The test request file may be other classes The file of type, the preset format setting or other preset formats, the reading and recording method and format are neither It is limited to the format of example provided above, can be set as needed in practice, is read for test information acquisition unit 111 as long as can meet Take and determine therefrom that the item to be tested of the SMS test.In one embodiment, the test item may include Following test item:Send a short message;Retrieve already existing short message;Newly-built common phrases;Change common phrases;It deletes common Phrase;Delete all dialogues;Receive short message test;Send short message expression;A short message is deleted after long-press;One is replicated after long-press Short message;Forwarding short message content after long-press;Short message is locked after long-press;Long-press is stored into SIM card.
The test execution unit 112 is connected with the test information acquisition unit 111, is waited for described in each for being directed to Test item executes the corresponding test script of the item to be tested, and obtains the test result information of the test script;The survey Test result information includes test result;The corresponding test script of the item to be tested is Robotium scripts.Specifically, test is held Row unit 112 is directed to each the described item to be tested obtained from the test information acquisition unit 111, executes described to be tested The corresponding test script of item, and obtain the test result information of the test script;The test result information includes that test is tied Fruit;The corresponding test script of the item to be tested is Robotium scripts.In one embodiment, the item to be tested is The test item that Execute field values are 1 in CaseInfo records.The corresponding test script of the item to be tested is to use The test script corresponding with the value of Xiang Zhongyu Name fields to be tested of Robotium script edits.Such as it is for Name The example to be tested of testCase01, may be set in the corresponding script of its in the first test script is method testCase01 or letter Number testCase01.Robotium is the Android automated test frames of a foreign countries, mainly for Android platform Using black box automatic test is carried out, it provides the various gesture operations (click, long-press, sliding etc.) of simulation, searches and assert The API of mechanism can operate various controls.The test frame that Robotium combination Android officials provide reaches pair The test that application program is automated.Robotium scripts mainly create test case by using the example of Solo objects (or being test case), the main action statement of Solo has:Solo.clickOnView (clicks view);solo.sendKey (clicking secondary or physical bond Menu, Home, Back);Solo.enterText (input word);Solo.clickOnButton (is clicked special Determine button);Solo.clickOnImageButton (clicks particular pictorial button);Solo.waitForActivity (confirms Specific Activity is either with or without startup);Solo.searchText (whether search specified word occurs); Solo.takeScreenshot (current page sectional drawing).
In one embodiment, the content of the corresponding test script of the item to be tested includes:Execute the item to be tested Test operation, and judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, If be consistent, the test result is to pass through;If do not met, the test result is failure.In one embodiment In, there is different default results for different test cases, for example, the default result for sending a short message can be to have been connect Receive message receipt (can be used sentence if (solo.waitForText (and testPhoneNo1+ " message received ", 1, WAITTIME*50)) judge).It for different test cases, may be used whether comparison short message content meets preset content, send Whether success icon shows, if has prompt to send successfully POP frames message, whether message list has increase or reduction, specifically Activity is either with or without the methods of correct startup to determine whether test result.These judgements are provided with different default results, And solo sentences may be used to realize.By judge result after the completion of the test operation whether with the item to be tested Whether default result is consistent, determine the example to be tested by the test;If be consistent, the test result is logical It crosses;If do not met, the test result is failure (or not passing through).
In one embodiment, the test script further includes that the test operation of the item to be tested includes:Execute entrance The operation of the test interface of the item to be tested, if it is determined that do not enter the test interface, then the test of the item to be tested Terminate, the test result is failure (or not passing through).For example, being surveyed to test case " retrieving already existing short message " It when examination, completes after sending for the short message of retrieval, needs to enter information list interface, at this moment, can detect whether to enter described Test interface (being at this time " information list interface "), can be used Solo sentences judge (if (!solo.waitForActivity(" ConversationList ", WAITTIME*4))), if it is determined that do not enter the test interface, then the survey of the item to be tested Examination terminates, and the test result is failure (or not passing through).If it is determined that into the test interface, then continue to test.
In one embodiment, the test operation of the item to be tested includes obtaining test sectional drawing, described to be measured to record Try the test process of item.For example, for test case " newly-built short message " test, respectively newly-built short message operation beginning when, When note number content is written, when sending short message, test sectional drawing is obtained when obtaining transmission result, and the test sectional drawing is preserved In preset catalogue.These test sectional drawings completely save the process of test, can be used for manually determining test for user As a result.
Test result generation unit 113 is connected with the test item execution unit 112, for receiving the test result letter It ceases and exports in the test result information to test result file.Specifically, test result generation unit 113 will be from the survey The test result information for the item to be tested that examination item execution unit 112 obtains is output in test result file, the test result Information is stored in preset format in the test result file.In one embodiment, the test result file is XML texts Part is (such as:CaseRes.xml), content is as follows:
<ResInfo>
<Res Id=" Music_01 ">
<CaseName>Send a short message (newly-built)</CaseName>
<CaseRes>Pass</CaseRes>
<Comment>Determination method:Occur sending receipt</Comment>
</Res>
<ResInfo>
<Res Id=" Music_02 ">
<CaseName>Retrieve already existing short message</CaseName>
<CaseRes>Pass</CaseRes>
<Comment>Determination method:The item number that the item number and title retrieved is shown meets, and retrieval content please check sectional drawing </Comment>
</Res>
Wherein, Pass indicates that test result is to pass through or successfully;If test result be not by or failure, can be with Fail is indicated.
In one embodiment, the test execution unit 112 further includes the operation for the test item that need not be executed: For the test item that each need not be executed, it is not test the test result information of mark to generate test result, by the survey Test result is not test the test result information of mark to be output in test result file.The mark of not testing can be user It is defined, it is not test mark such as to define " NT ", then the test result of the test item to that need not execute is set as " NT ".Test As a result generation unit 113 believes the test result of the needs test item to be executed obtained from the test item execution unit 112 Breath is output in test result file, and the test result information is stored in preset format in the test result file, The corresponding contents of test result file (CaseRes.xml) are as follows:
<ResInfo>
<Res Id=" Music_03 ">
<CaseName>Retrieve already existing short message</CaseName>
<CaseRes>NT</CaseRes>
<Comment>Determination method:Create self-defined phrase success</Comment>
</Res>
In one embodiment, the SMS automation system for testing 1 further includes SMS test installation module 12, SMS test installation module 12 is used to carry out signature verification to the SMS test module 11, and to be tested The SMS test module 11 is installed in mobile phone.Specifically, signature verification is carried out to the SMS test module 11, And the SMS test module 11 is installed on mobile phone to be tested.The SMS test installation module 12 includes pair The signature verification order of the SMS test module 11 and the installation order after signature verification.The SMS test It can also includes being optimized to the automatic test script after signing again to install module 12.The SMS test installation The realization content of one example of module 12 includes:
@echo off
Set apkname=Mms_Test.apk
::Apkname automatized script apk titles
Set apkname=Mms_Test_new.apk
::Apknewname sign again after automatized script title
Java-jar signapk.jar testkey.x509.pem testkey.pk8%apkname%% Apknewname%
::Optimize apk
Adb install-r%apknewname%
::Again the automatized script after signing is installed to mobile phone
pause
Wherein,::Indicate annotation.User can be from Android source code positions { platform/build/target/ Product/security/ } inner find the signature files such as platform.pk8 platform.x509.pem.signapk.jar File can be found from Android source code positions {/out/host/linux-x86/framework/ } are inner.The SMS The execution of test installation module 12 needs first by automatic test script file (Mms_Test.apk) and signature file (platform.pk8 platform.x509.pem) and signapk.jar files put SMS test peace in a tester Under file where die-filling piece 12, and mobile phone to be tested is connected to using adb in test machine.
In one embodiment, the SMS automation system for testing further includes SMS test starting module 13, SMS test starting module 13 obtains the test result file for starting the SMS test module. Specifically, SMS test starting module 13, which is included in mobile phone to be tested, has just started SMS test module 11 and has been surveyed The order of examination and the order that the test result file is obtained after the completion of test.In one embodiment, the mobile phone is short Believe that test starting module 13 can also include the order for obtaining the test sectional drawing file in test.The SMS test starting The realization content of one example of module 13 includes:
@echo off
Set TestPackageName=com.example.ad.test
::The PackageName of TestPackageName test scripts
Set TestedPackageName=com.android.music
::TestedPackageName is tested the PackageName of apk
Adb shell am instrument-w%TestPackageName%/ com.neenbedankt.android.test.InstrumentationTestRunner
::Adb shell am instrument start the monitoring to instrument examples
::Under com.neenbedankt.android.test.InstrumentationTestRunner this environment The AndroidManifest.xml of testing engineering is searched, the PackageName for being tested APK is therefrom obtained, for keeping adb Shell is completed until test
Echo is completed ...
Adb pull/data/data/%TestedPackageName%/files/TEST-all.xml d:\ TestResult
adb pull/mnt/sdcard/CaseRes.xml d:\TestResult
Echo is completed ...
pause
Wherein, com.example.ad.test is the packet name for the test script for including SMS test module 11, Com.android.music is the packet name of tested apk.The mobile phone that adb shell-commands are used to start in mobile phone to be tested is short Letter test module 11 is tested;Test result file is obtained from mobile phone to be tested using adb pull orders (CaseRes.xml).d:TestResult be test result deposit position.
In one embodiment, as shown in figure 3, describing SMS in SMS automation system for testing tests mould Block 11 and SMS test starting module 13 execute flow.SMS test starting module 13 starts SMS test Module 11 starts to execute.SMS test module 11 reads Setting.xml files, and the value of reading is corresponded to CaseInfo In, for each test case, judge whether this test case executes, i.e., whether this test case is to be measured on probation Example.Test case according to whether execute be divided into test case that the test case that need not be executed and needs execute (example to be tested or Item to be tested).If you do not need to executing, by NT (not executing mark) information write-in CaseRes.xml (test result file), knot The test of this test case of beam.If needing to execute (test case is example to be tested), executes corresponding test script and (execute Solo is operated).Judge whether to enter required interface.If not entering required interface, by Fail, (test crash is obstructed Cross) information write-in CaseRes.xml (test result file), terminates the test of this test case.If into required interface, Then continue solo operations, it is known that operation part is completed, and current interface picture is intercepted.At this point, it is pre- to judge whether test result meets Phase condition, if met, by Pass (test crash does not pass through) information write-in CaseRes.xml (test result file), knot The test of this test case of beam.If do not met, CaseRes.xml is written into Fail (test crash does not pass through) information and (is surveyed Test result file), terminate the test of this test case.After the test of this test case, judge whether all singles Case (test case) is performed.If it is not, then continuing the test of next test case.If it is, all terminating, hand Machine short message test starting module 13 copies to test result file (CaseRes.xml) in test machine, and notifies user test Terminate.
In conclusion the SMS test automation method and system of the present invention, have the advantages that:It is based on Robotium scripts are developed, and can be avoided based on control ID come operating handset as led using the exploitation of MonkeyRunner scripts The needs of cause distinguish the problem of mobile phone hardware difference and UI variations in script, meanwhile, it may be implemented using Robotium scripts Judge whether the result after the completion of the test operation is consistent with the default result of the item to be tested, improves automation journey Degree and recycling rate of waterused, reduce maintenance cost.Meanwhile technical scheme of the present invention use from it is preset include multiple In a manner of the test request file read test information of the test item information of preset format setting, it is highly convenient for test request It modifies.Technical scheme of the present invention additionally provides the automatic signature verification and installation to test program, and automatic acquisition Test result greatly simplifies the work of SMS test.So the present invention effectively overcome it is in the prior art various Disadvantage and have high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe The personage for knowing this technology can all carry out modifications and changes to above-described embodiment without violating the spirit and scope of the present invention.Cause This, institute is complete without departing from the spirit and technical ideas disclosed in the present invention by those of ordinary skill in the art such as At all equivalent modifications or change, should by the present invention claim be covered.

Claims (14)

1. a kind of SMS test automation method, which is characterized in that the SMS test automation method is first Following steps are realized in script:
The information of preset test request file is read, and determines therefrom that the item to be tested of the SMS test;The survey Examination requires to include multiple test item information being arranged with preset format in file;The item to be tested is the test for needing to execute ;
For item to be tested described in each, the corresponding test script of the item to be tested is executed, and obtain the test script Test result information;The test result information includes test result;The corresponding test script of the item to be tested is Robotium scripts;
The test result information of the item to be tested is output in test result file;
The test item includes:Send a short message;Retrieve already existing short message;Newly-built common phrases;Change common phrases; Receive short message test;Send short message expression;A short message is replicated after long-press;Forwarding short message content after long-press;It is locked after long-press short Letter;Long-press is stored into SIM card.
2. SMS test automation method according to claim 1, it is characterised in that:The item to be tested is corresponding The content of test script includes:The test operation of the item to be tested is executed, and judges the result after the completion of the test operation Whether it is consistent with the default result of the item to be tested, if be consistent, the test result is to pass through;If be not inconsistent It closes, then the test result is failure.
3. SMS test automation method according to claim 2, it is characterised in that:The test of the item to be tested Operation includes:The operation for executing the test interface for entering the item to be tested, if it is determined that do not enter the test interface, then institute The test for stating item to be tested terminates, and the test result is not pass through.
4. SMS test automation method according to claim 2, it is characterised in that:The test of the item to be tested Operation includes obtaining test sectional drawing, to record the test process of the item to be tested.
5. SMS test automation method according to claim 1, it is characterised in that:It need not be held for each Capable test item, it is not test the test result information of mark to generate test result, is not test mark by the test result Test result information be output in test result file.
6. SMS test automation method according to claim 1, it is characterised in that:The SMS test is certainly Dynamicization method further includes being realized in the second script:Signature verification is carried out to first script, and first script is pacified It is attached on mobile phone to be tested.
7. SMS test automation method according to claim 1, it is characterised in that:The SMS test is certainly Dynamicization method further includes being realized in third scenario:Start first script in the mobile phone to be tested to be tested, The test result file is obtained after the completion of test.
8. a kind of SMS automation system for testing, it is characterised in that:The system comprises:SMS test module, institute It includes test information acquisition unit, test execution unit, test result generation unit to state SMS test module;Wherein:
The test information acquisition unit is used to read the information of preset test request file, and determines therefrom that the mobile phone is short Believe the item to be tested of test;Include multiple test item information being arranged with preset format in the test request file;It is described Item to be tested is the test item for needing to execute;
The test execution unit is connected with the test information acquisition unit, for being directed to each described item to be tested, holds The corresponding test script of the row item to be tested, and obtain the test result information of the test script;The test result letter Breath includes test result;The corresponding test script of the item to be tested is Robotium scripts;
The test result generation unit is connected with the test item execution unit, for receiving the test result information simultaneously It exports in the test result information to test result file;
The test item includes:Send a short message;Retrieve already existing short message;Newly-built common phrases;Change common phrases; Receive short message test;Send short message expression;A short message is replicated after long-press;Forwarding short message content after long-press;It is locked after long-press short Letter;Long-press is stored into SIM card.
9. SMS automation system for testing according to claim 8, it is characterised in that:The item to be tested is corresponding The content of test script includes:The test operation of the item to be tested is executed, and judges the result after the completion of the test operation Whether it is consistent with the default result of the item to be tested, if be consistent, the test result is successfully;If be not inconsistent It closes, then the test result is failure.
10. SMS automation system for testing according to claim 9, it is characterised in that:The survey of the item to be tested Examination operates:The operation for executing the test interface for entering the item to be tested, if it is determined that not entering the test interface, then The test of the item to be tested terminates, and the test result is failure.
11. SMS automation system for testing according to claim 9, it is characterised in that:The survey of the item to be tested Examination operation includes obtaining test sectional drawing, to record the test process of the item to be tested.
12. SMS automation system for testing according to claim 8, it is characterised in that:The SMS test Module generates corresponding test for the test item that need not be executed in each described SMS test information acquisition unit As a result it is not test the test result information of mark, is not test the test result information of mark to be sent to by the test result The test result generation unit.
13. SMS automation system for testing according to claim 8, it is characterised in that:The SMS test Automated system further includes SMS test installation module, for carrying out signature verification to the SMS test module, And the SMS test module is installed in mobile phone to be tested.
14. SMS automation system for testing according to claim 8, it is characterised in that:The SMS test Automated system further includes SMS test starting module, for starting the SMS test module, and described in acquisition Test result file.
CN201410512435.4A 2014-09-29 2014-09-29 A kind of Automated testing method of cell phone short messages and system Active CN104320793B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410512435.4A CN104320793B (en) 2014-09-29 2014-09-29 A kind of Automated testing method of cell phone short messages and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410512435.4A CN104320793B (en) 2014-09-29 2014-09-29 A kind of Automated testing method of cell phone short messages and system

Publications (2)

Publication Number Publication Date
CN104320793A CN104320793A (en) 2015-01-28
CN104320793B true CN104320793B (en) 2018-10-12

Family

ID=52375945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410512435.4A Active CN104320793B (en) 2014-09-29 2014-09-29 A kind of Automated testing method of cell phone short messages and system

Country Status (1)

Country Link
CN (1) CN104320793B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294172B (en) * 2016-08-17 2018-10-30 刘华英 App self-testing methods based on terminal device and device
CN107948942A (en) * 2017-11-23 2018-04-20 北京百悟科技有限公司 A kind of short message service automated testing method and device
CN108376115B (en) * 2018-01-29 2022-01-18 数据通信科学技术研究所 Automatic testing method and system across Android platform
CN109597728B (en) * 2018-11-15 2022-09-06 Oppo(重庆)智能科技有限公司 Control method and device of test equipment and computer readable storage medium
CN110290486A (en) * 2019-07-04 2019-09-27 深圳壹账通智能科技有限公司 Short message sends test method, device, computer equipment and storage medium
CN111999707A (en) * 2020-08-19 2020-11-27 无锡威孚高科技集团股份有限公司 Automatic testing method, device and system for millimeter wave radar

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156672A (en) * 2011-04-19 2011-08-17 广东欧珀移动通信有限公司 Method for realizing automated test on mobile phone calculator
WO2013000439A1 (en) * 2011-06-30 2013-01-03 华为数字技术(成都)有限公司 Method, device and security policy system for executing security policy script
CN103400063A (en) * 2013-08-06 2013-11-20 深信服网络科技(深圳)有限公司 Method and device for executing script file
CN103744784A (en) * 2014-01-06 2014-04-23 中国移动(深圳)有限公司 Method and system for automatically testing mobile phone applications

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104156305B (en) * 2013-05-15 2018-01-09 腾讯科技(深圳)有限公司 A kind of applied program testing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156672A (en) * 2011-04-19 2011-08-17 广东欧珀移动通信有限公司 Method for realizing automated test on mobile phone calculator
WO2013000439A1 (en) * 2011-06-30 2013-01-03 华为数字技术(成都)有限公司 Method, device and security policy system for executing security policy script
CN103400063A (en) * 2013-08-06 2013-11-20 深信服网络科技(深圳)有限公司 Method and device for executing script file
CN103744784A (en) * 2014-01-06 2014-04-23 中国移动(深圳)有限公司 Method and system for automatically testing mobile phone applications

Also Published As

Publication number Publication date
CN104320793A (en) 2015-01-28

Similar Documents

Publication Publication Date Title
CN104320793B (en) A kind of Automated testing method of cell phone short messages and system
US8839201B2 (en) Capturing test data associated with error conditions in software item testing
CN104407980B (en) Mobile solution automatic test device and method
US7529977B2 (en) Automated extensible user interface testing
US9292416B2 (en) Software development kit testing
US10067858B2 (en) Cloud-based software testing
US8839202B2 (en) Test environment managed within tests
US9684587B2 (en) Test creation with execution
WO2018120721A1 (en) Method and system for testing user interface, electronic device, and computer readable storage medium
CN104899016B (en) Allocating stack Relation acquisition method and device
US8949794B2 (en) Binding a software item to a plain english control name
Su et al. Fully automated functional fuzzing of Android apps for detecting non-crashing logic bugs
CN110955428A (en) Page display method and device, electronic equipment and medium
CN104731566B (en) Integrated Development Environment test device, method and system
CN110362545A (en) Log monitoring method, device, terminal and computer readable storage medium
US20160306736A1 (en) Translation verification testing
CN110716853A (en) Test script recording method, application program testing method and related device
CN105022694A (en) Test case generation method and system for mobile terminal test
CN107615270A (en) A kind of man-machine interaction method and its device
US20220350857A1 (en) Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors
CN106326088A (en) Test object constructing method and device, and service configuration testing device
CN103326930B (en) Open platform interface automatic detecting method and system
CN104008089B (en) For verifying the method and system of document
US10387294B2 (en) Altering a test
CN109271316A (en) Android device and its automated testing method, memory

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201216

Address after: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee after: Bengbu 309 Technology Consulting Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right

Effective date of registration: 20210203

Address after: 313001 room 1019, Xintiandi office building, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee before: Bengbu 309 Technology Consulting Co.,Ltd.

TR01 Transfer of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A Method and System for Automatic Test of Mobile Short Message

Effective date of registration: 20230111

Granted publication date: 20181012

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2023330000072

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20231205

Granted publication date: 20181012

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2023330000072

PC01 Cancellation of the registration of the contract for pledge of patent right
TR01 Transfer of patent right

Effective date of registration: 20240205

Address after: 710000, Building B, Huihao Tree Center, Keji 3rd Road, High tech Zone, Xi'an City, Shaanxi Province, China 1508

Patentee after: Shaanxi Chengtuo Network Co.,Ltd.

Country or region after: China

Address before: 313001 room 1019, Xintiandi office building, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee before: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right