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.
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.