Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of Automated testing method of cell phone short messages and system, for solve in prior art, the test existed in automatic test is carried out to short message function before need the corresponding STE of human configuration, test script depends on mobile phone software and hardware setting to be tested, test script is not easy amendment, needs artificially judge the problems such as test result.
For achieving the above object and other relevant objects, the invention provides a kind of SMS test automation method, described SMS test automation method realizes following steps in the first script: the information reading the test request file preset, and determines the item to be tested that described SMS is tested accordingly; Multiple test item information arranged with preset format is included in described test request file; Described item to be tested is the test item needing to perform; For item to be tested described in each, perform the test script of described item correspondence to be tested, and obtain the test result information of described test script; Described test result information comprises test result; The test script of described item correspondence to be tested is Robotium script; The test result information of described item to be tested is outputted in test result file.
Alternatively, the content of the test script of described item correspondence to be tested comprises: the test operation performing described item to be tested, and judge described test operation complete after result whether be consistent with the default result of described item to be tested, if be consistent, then described test result is for passing through; If do not met, then described test result is unsuccessfully.
Alternatively, the test operation of described item to be tested comprises: perform the operation entering the test interface of described item to be tested, if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is not for pass through.
Alternatively, the test operation of described item to be tested comprises acquisition test sectional drawing, to record the test process of described item to be tested.
Alternatively, do not need the test item of execution for each, generating test result is do not test the test result information of mark, is that the test result information not testing mark outputs in test result file by described test result.
Alternatively, described SMS test automation method is also included in the second script and realizes: carry out signature verification to described first script, and is installed on mobile phone to be tested by described first script.
Alternatively, described SMS test automation method is also included in the 3rd script and realizes: in described mobile phone to be tested, start described first script test, obtain described test result file after test completes.
The present invention also provides a kind of SMS automation system for testing, and described system comprises: SMS test module, and described SMS test module comprises detecting information acquiring unit, test execution unit, test result generation unit; Described detecting information acquiring unit for reading the information of default test request file, and determines the item to be tested that described SMS is tested accordingly; Multiple test item information arranged with preset format is included in described test request file; Described item to be tested is the test item needing to perform; Described test execution unit, is connected with described detecting information acquiring unit, for for item to be tested described in each, performs the test script of described item correspondence to be tested, and obtains the test result information of described test script; Described test result information comprises test result; The test script of described item correspondence to be tested is Robotium script; Described test result generation unit, is connected with described test item performance element, for receiving described test result information and exporting described test result information in test result file.
Alternatively, the content of the test script of described item correspondence to be tested comprises: the test operation performing described item to be tested, and judge described test operation complete after result whether be consistent with the default result of described item to be tested, if be consistent, then described test result is successfully; If do not met, then described test result is unsuccessfully.
Alternatively, the test operation of described item to be tested comprises: perform the operation entering the test interface of described item to be tested, if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is unsuccessfully.
Alternatively, the test operation of described item to be tested comprises acquisition test sectional drawing, to record the test process of described item to be tested.
Alternatively, described SMS test module is for the test item not needing in SMS detecting information acquiring unit described in each to perform, generating corresponding test result is do not test the test result information of mark, is that the test result information not testing mark sends to described test result generation unit by described test result.
Alternatively, described SMS automation system for testing also comprises SMS test installation module, for carrying out signature verification to described SMS test module, and in mobile phone to be tested, installs described SMS test module.
Alternatively, described SMS automation system for testing also comprises SMS test starting module, for starting described SMS test module, and obtains described test result file.
As mentioned above, SMS test automation method and system of the present invention, there is following beneficial effect: develop based on Robotium script, operating handset can be carried out based on control ID, avoid as the problem that the needs caused distinguish mobile phone hardware difference and UI variation in script developed by employing MonkeyRunner script, simultaneously, utilize Robotium script can realize judging described test operation complete after result whether be consistent with the default result of described item to be tested, improve automaticity and recycling rate of waterused, reduce maintenance cost.Meanwhile, technical scheme of the present invention have employed the mode of test request file read test information from the multiple test item information arranged with preset format of including of presetting, and is convenient to very much modify to test request.Technical scheme of the present invention additionally provides to be verified and installation the automatic signature of test program, and automatic acquisition test result, greatly simplify the work of SMS test.
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.
It should be noted that, the diagram provided in the present embodiment only illustrates basic conception of the present invention in a schematic way, then only the assembly relevant with the present invention is shown in graphic but not component count, shape and size when implementing according to reality is drawn, it is actual when implementing, and the kenel of each assembly, quantity and ratio can be a kind of change arbitrarily, and its assembly layout kenel also may be more complicated.
The invention provides a kind of SMS test automation method.As shown in Figure 1, in one embodiment, described SMS test automation method realizes following steps in the first script:
Step S1, reads the information of the test request file preset, and determines the item to be tested that described SMS is tested accordingly; Multiple test item information arranged with preset format is included in described test request file; Described item to be tested is the test item needing to perform.In one embodiment, described test request file is XML file (Setting.xml), and described XML file arranges test item information with preset format.Under described XML file is positioned over default file directory, its form is as follows:
Described first script reads the content of described XML file by CaseControl class, and read content is corresponded to Name and the Execute field of CaseInfo class.Described first script comprises the application that Java language realizes.In described XML with <Case Id=" " > starts the corresponding test item information of content of </Case> ending, the corresponding test case information of each test item information; The value of <Name></NameGrea tT.GreaT.GT wherein corresponds to the Name field of CaseInfo class, and the value of <Execute></Execu te> corresponds to the Execute field of CaseInfo class.The value of <Execute></Execu te> is this test item of 1 expression is the test item needing to perform, i.e. described item to be tested; The value of <Execute></Execu te> is this test item of 0 expression is the test item not needing to perform.Need to import CaseControl jar bag during described first script of editor to the use of described CaseControl class and CaseInfo class.CaseControl jar comprises CaseControl class, XmlHandle class and CaseInfo class in wrapping.Wherein, CaseControl class can be used for: the value reading Setting.xml; Judge whether Case needs to perform; Result is write XML file; Export debugging log information; Sectional drawing is copied to assigned catalogue etc.XmlHandle class can be used for: read XML file; Write (newly-built write) XML file; Analyzing XML file; Export XML file and arrive assigned address etc.CaseInfo class is for storing the various information of Case (test case), and a CaseInfo records the information of a Case (test case), mainly contains: Name field (the execution function name of Test); Execute field (represent whether respective function performs 0 for not perform, 1 for performing).Described CaseInfo class can also comprise: CaseNo field (representing the sequence number of this Case); CaseName field (representing the title of Case); CaseRes field (representing the result of Case); Comment field (representing the remarks after Case execution); MmsToman field (in note test contact phone); MmsText; Field (information of other people will be issued in note test).Described test request file also can be the file of other types, it also can be other preset format that described preset format is arranged, described reading and recording method and form are neither limited to above illustrated form, can set as required in practice, as long as can meet for described first script reads and determines the item to be tested that described SMS is tested accordingly.In one embodiment, described test item can comprise following test item: send a note; Retrieve the note existed; Newly-built common phrases; Amendment common phrases; Delete common phrases; Delete all dialogues; Reception note is tested; Transmission note is expressed one's feelings; Long by rear deletion note; Long by after copy a note; Long by rear forwarding short message content; Long by rear locking note; Long by being stored into SIM card.
Step S2, for item to be tested described in each, performs the test script of described item correspondence to be tested, and obtains the test result information of described test script; Described test result information comprises test result; The test script of described item correspondence to be tested is Robotium script.In one embodiment, described item to be tested is Execute field value in CaseInfo record is the test item of 1.The test script of described item correspondence to be tested is the test script corresponding with the value of described Xiang Zhongyu Name field to be tested adopting Robotium script edit.As being the example to be tested of testCase01 for Name, can be set in script corresponding to it in the first test script is method testCase01 or function testCase01.Robotium is a external Android automatic test script, black box automatic test is carried out in application mainly for Android platform, it provide the various gesture operation of simulation (click, long by, slip etc.), search and assert and the API of mechanism can operate to various control.Robotium reaches in conjunction with the test frame that Android official provides the test that application programs carries out automation.Robotium script creates test case (or being called test case) mainly through using the example of Solo object, and the main action statement of Solo has: solo.clickOnView (click view); Solo.sendKey (clicking secondary or physical bond Menu, Home, Back); Solo.enterText (input characters); Solo.clickOnButton (click specific button); Solo.clickOnImageButton (clicking particular pictorial button); Solo.waitForActivity (confirming that specific Activity is not activated); Solo.searchText (whether search occurs specifying word); Solo.takeScreenshot (current page sectional drawing) etc.
In one embodiment, the content of the test script of described item correspondence to be tested comprises: the test operation performing described item to be tested, and judge described test operation complete after result whether be consistent with the default result of described item to be tested, if be consistent, then described test result is for passing through; If do not met, then described test result is unsuccessfully.In one embodiment, different default results is had for different test cases, such as, the default result sending a note (can adopt statement if (solo.waitForText (testPhoneNo1+ " message received " for the receipt obtaining message received, 1, WAITTIME*50)) judge).For different test cases, contrast short message content can be adopted whether to meet preset content, send successful icon whether to show, prompting whether is had to send successful POP frame message, whether message list has increases or reduces, and concrete Activity has the methods such as not correct startup to judge whether test result.These judgements are provided with different default results, and can adopt solo statement to realize.By judge described test operation complete after result whether be consistent with the default result of described item to be tested, determine that whether described example to be tested is by this test; If be consistent, then described test result is for passing through; If do not met, then described test result is unsuccessfully (or not passing through).
In one embodiment, the test operation that described test script also comprises described item to be tested comprises: perform the operation entering the test interface of described item to be tested, if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is unsuccessfully (or not passing through).Such as, when testing test case " note that retrieval has existed ", after completing the note sent for retrieval, need to enter information list interface, at this moment, can detect and whether enter described test interface (now for " information list interface "), can adopt Solo statement judge (if (! Solo.waitForActivity (" ConversationList ", WAITTIME*4))), if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is unsuccessfully (or not passing through).If judge to enter described test interface, then proceed test.
In one embodiment, the test operation of described item to be tested comprises acquisition test sectional drawing, to record the test process of described item to be tested.Such as, for the test of test case " newly-built note ", respectively when the operation of newly-built note starts, when writing note number content, when sending note, obtaining when sending result and obtaining test sectional drawing, and described test sectional drawing is kept in default catalogue.The process saving test that these test sectional drawings are complete, may be used for manually determining test result for user.
Step S3, outputs to the test result information of described item to be tested in test result file.Particularly, output in test result file by the test result information of the item to be tested obtained, described test result information is kept in described test result file with preset format.In one embodiment, described test result file is XML file (as: CaseRes.xml), and its content is as follows:
<ResInfo>
<Res?Id=”Music_01”>
<CaseName> sends note (newly-built) </CaseName>
<CaseRes>Pass</CaseRes>
<Comment> decision method: occur sending receipt </Comment>
</Res>
<ResInfo>
<Res?Id=”Music_02”>
<CaseName> retrieves the note </CaseName> existed
<CaseRes>Pass</CaseRes>
<Comment> decision method: the number of the number retrieved and title display meets, and retrieval of content please check sectional drawing </Comment>
</Res>
Wherein, Pass represent test result be by or success; If test result is do not pass through or failure, then can represent with Fail.
In one embodiment, described first script also comprises the operation for not needing the test item performed: the test item not needing execution for each, generating test result is do not test the test result information of mark, is that the test result information not testing mark outputs in test result file by described test result.Described mark of not testing can be defined by user, if definition " NT " is not for test mark, then to not needing the test result of the test item performed to be set to " NT ".The corresponding contents of its test result file (CaseRes.xml) is as follows:
<ResInfo>
<Res?Id=”Music_03”>
<CaseName> retrieves the note </CaseName> existed
<CaseRes>NT</CaseRes>
<Comment> decision method: create self-defined phrase success </Comment>
</Res>
In one embodiment, described SMS test automation method is also included in the second script and realizes: carry out signature verification to described first script, and is installed on mobile phone to be tested by described first script.Described second script comprises the installation order after to the signature verification order of described first script and signature verification.Described second script can also comprise to again signature after automatic test script be optimized.An example of described second script realize comprising of content:
@echo?off
set?apkname=Mms_Test.apk
:: apkname automatized script apk title
set?apkname=Mms_Test_new.apk
:: the automatized script title after apknewname signs again
java–jar?signapk.jar?testkey.x509.pem?testkey.pk8%apkname%%apknewname%
:: optimize apk
adb?install–r%apknewname%
:: the automatized script after again signing is mounted to mobile phone
pause
Wherein:: represent annotation.User { can find the signature files such as platform.pk8 platform.x509.pem from Android source code position platform/build/target/product/security/}.Signapk.jar file { can find/out/host/linux-x86/framework/} from Android source code position.Under the execution of described second script needs first automatic test script file (Mms_Test.apk) and signature file (platform.pk8 platform.x509.pem) and signapk.jar file to be put the file at the second script place in a tester, and adb is adopted to be connected in test machine mobile phone to be tested.
In one embodiment, described SMS test automation method is also included in the 3rd script and realizes: in described mobile phone to be tested, start described first script test, obtain described test result file after test completes.Described 3rd script is included in firm first script that starts in mobile phone to be tested and carries out the order tested and the order obtaining described test result file after having tested.In one embodiment, described 3rd script can also comprise the order of the test sectional drawing file obtained in test.An example of described 3rd script realize comprising of content:
@echo?off
set?TestPackageName=com.example.ad.test
:: the PackageName of TestPackageName test script
set?TestedPackageName=com.android.music
:: the PackageName of the tested apk of TestedPackageName
adb?shell?am?instrument-w%TestPackageName%/com.neenbedankt.android.test.InstrumentationTestRunner
:: adb shell am instrument starts the supervision to instrument example
:: the AndroidManifest.xml searching testing engineering under this environment of com.neenbedankt.android.test.InstrumentationTestRunner, therefrom obtain the PackageName of tested APK, for keeping adb shell until tested
Echo completes
adb?pull/data/data/%TestedPackageName%/files/TEST-all.xml?d:\TestResult
adb?pull/mnt/sdcard/CaseRes.xml?d:\TestResult
Echo completes
pause
Wherein, com.example.ad.test is the bag name of the test script including the first script, and com.android.music is the bag name of tested apk.Adb shell-command is tested for the first script started in mobile phone to be tested; Adopt adb pull order from mobile phone to be tested, obtain test result file (CaseRes.xml).
The present invention also provides a kind of SMS automation system for testing.In one embodiment, as shown in Figure 2, described SMS automation system for testing 1 comprises:
SMS test module 11, described SMS test module 11 comprises detecting information acquiring unit 111, test execution unit 112, test result generation unit 113.Wherein:
Described detecting information acquiring unit 111 for reading the information of default test request file, and determines the item to be tested that described SMS is tested accordingly; Multiple test item information arranged with preset format is included in described test request file; Described item to be tested is the test item needing to perform.In one embodiment, described test request file is XML file (Setting.xml), and described XML file arranges test item information with preset format.Under described XML file is positioned over default file directory, its form is as follows:
Detecting information acquiring unit 111 reads the content of described XML file by CaseControl class, and read content is corresponded to Name and the Execute field of CaseInfo class.In described XML with <Case Id=" " > starts the corresponding test item information of content of </Case> ending, the corresponding test case information of each test item information; The value of <Name></NameGrea tT.GreaT.GT wherein corresponds to the Name field of CaseInfo class, and the value of <Execute></Execu te> corresponds to the Execute field of CaseInfo class.The value of <Execute></Execu te> is this test item of 1 expression is the test item needing to perform, i.e. described item to be tested; The value of <Execute></Execu te> is this test item of 0 expression is the test item not needing to perform.Need to import CaseControl jar bag to the use of described CaseControl class and CaseInfo class.CaseControl jar comprises CaseControl class, XmlHandle class and CaseInfo class in wrapping.Wherein, CaseControl class can be used for: the value reading Setting.xml; Judge whether Case needs to perform; Result is write XML file; Export debugging log information; Sectional drawing is copied to assigned catalogue etc.XmlHandle class can be used for: read XML file; Write (newly-built write) XML file; Analyzing XML file; Export XML file and arrive assigned address etc.CaseInfo class is for storing the various information of Case (test case), and a CaseInfo records the information of a Case (test case), mainly contains: Name field (the execution function name of Test); Execute field (represent whether respective function performs 0 for not perform, 1 for performing).Described CaseInfo class can also comprise: CaseNo field (representing the sequence number of this Case); CaseName field (representing the title of Case); CaseRes field (representing the result of Case); Comment field (representing the remarks after Case execution); MmsToman field (in note test contact phone); MmsText; Field (information of other people will be issued in note test).Described test request file also can be the file of other types, it also can be other preset format that described preset format is arranged, described reading and recording method and form are neither limited to above illustrated form, can set as required in practice, also determine the item to be tested that described SMS is tested accordingly as long as can meet for detecting information acquiring unit 111 reads.In one embodiment, described test item can comprise following test item: send a note; Retrieve the note existed; Newly-built common phrases; Amendment common phrases; Delete common phrases; Delete all dialogues; Reception note is tested; Transmission note is expressed one's feelings; Long by rear deletion note; Long by after copy a note; Long by rear forwarding short message content; Long by rear locking note; Long by being stored into SIM card.
Described test execution unit 112 is connected with described detecting information acquiring unit 111, for for item to be tested described in each, performs the test script of described item correspondence to be tested, and obtains the test result information of described test script; Described test result information comprises test result; The test script of described item correspondence to be tested is Robotium script.Particularly, test execution unit 112 for obtain from described detecting information acquiring unit 111 each described in item to be tested, perform the test script of described item correspondence to be tested, and obtain the test result information of described test script; Described test result information comprises test result; The test script of described item correspondence to be tested is Robotium script.In one embodiment, described item to be tested is Execute field value in CaseInfo record is the test item of 1.The test script of described item correspondence to be tested is the test script corresponding with the value of described Xiang Zhongyu Name field to be tested adopting Robotium script edit.As being the example to be tested of testCase01 for Name, can be set in script corresponding to it in the first test script is method testCase01 or function testCase01.Robotium is a external Android automated test frame, black box automatic test is carried out in application mainly for Android platform, it provide the various gesture operation of simulation (click, long by, slip etc.), search and assert and the API of mechanism can operate to various control.Robotium reaches in conjunction with the test frame that Android official provides the test that application programs carries out automation.Robotium script creates test case (or being called test case) mainly through using the example of Solo object, and the main action statement of Solo has: solo.clickOnView (click view); Solo.sendKey (clicking secondary or physical bond Menu, Home, Back); Solo.enterText (input characters); Solo.clickOnButton (click specific button); Solo.clickOnImageButton (clicking particular pictorial button); Solo.waitForActivity (confirming that specific Activity is not activated); Solo.searchText (whether search occurs specifying word); Solo.takeScreenshot (current page sectional drawing).
In one embodiment, the content of the test script of described item correspondence to be tested comprises: the test operation performing described item to be tested, and judge described test operation complete after result whether be consistent with the default result of described item to be tested, if be consistent, then described test result is for passing through; If do not met, then described test result is unsuccessfully.In one embodiment, different default results is had for different test cases, such as, the default result sending a note (can adopt statement if (solo.waitForText (testPhoneNo1+ " message received " for the receipt obtaining message received, 1, WAITTIME*50)) judge).For different test cases, contrast short message content can be adopted whether to meet preset content, send successful icon whether to show, prompting whether is had to send successful POP frame message, whether message list has increases or reduces, and concrete Activity has the methods such as not correct startup to judge whether test result.These judgements are provided with different default results, and can adopt solo statement to realize.By judge described test operation complete after result whether be consistent with the default result of described item to be tested, determine that whether described example to be tested is by this test; If be consistent, then described test result is for passing through; If do not met, then described test result is unsuccessfully (or not passing through).
In one embodiment, the test operation that described test script also comprises described item to be tested comprises: perform the operation entering the test interface of described item to be tested, if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is unsuccessfully (or not passing through).Such as, when testing test case " note that retrieval has existed ", after completing the note sent for retrieval, need to enter information list interface, at this moment, can detect and whether enter described test interface (now for " information list interface "), can adopt Solo statement judge (if (! Solo.waitForActivity (" ConversationList ", WAITTIME*4))), if judge not enter described test interface, then the test of described item to be tested terminates, and described test result is unsuccessfully (or not passing through).If judge to enter described test interface, then proceed test.
In one embodiment, the test operation of described item to be tested comprises acquisition test sectional drawing, to record the test process of described item to be tested.Such as, for the test of test case " newly-built note ", respectively when the operation of newly-built note starts, when writing note number content, when sending note, obtaining when sending result and obtaining test sectional drawing, and described test sectional drawing is kept in default catalogue.The process saving test that these test sectional drawings are complete, may be used for manually determining test result for user.
Test result generation unit 113 is connected with described test item performance element 112, for receiving described test result information and exporting described test result information in test result file.Particularly, the test result information of the item to be tested obtained from described test item performance element 112 outputs in test result file by test result generation unit 113, and described test result information is kept in described test result file with preset format.In one embodiment, described test result file is XML file (as: CaseRes.xml), and its content is as follows:
<ResInfo>
<Res?Id=”Music_01”>
<CaseName> sends note (newly-built) </CaseName>
<CaseRes>Pass</CaseRes>
<Comment> decision method: occur sending receipt </Comment>
</Res>
<ResInfo>
<Res?Id=”Music_02”>
<CaseName> retrieves the note </CaseName> existed
<CaseRes>Pass</CaseRes>
<Comment> decision method: the number of the number retrieved and title display meets, and retrieval of content please check sectional drawing </Comment>
</Res>
Wherein, Pass represent test result be by or success; If test result is do not pass through or failure, then can represent with Fail.
In one embodiment, described test execution unit 112 also comprises the operation for not needing the test item performed: the test item not needing execution for each, generating test result is do not test the test result information of mark, is that the test result information not testing mark outputs in test result file by described test result.Described mark of not testing can be defined by user, if definition " NT " is not for test mark, then to not needing the test result of the test item performed to be set to " NT ".The test result information of the test item that the needs obtained from described test item performance element 112 will perform outputs in test result file by test result generation unit 113, described test result information is kept in described test result file with preset format, and the corresponding contents of its test result file (CaseRes.xml) is as follows:
<ResInfo>
<Res?Id=”Music_03”>
<CaseName> retrieves the note </CaseName> existed
<CaseRes>NT</CaseRes>
<Comment> decision method: create self-defined phrase success </Comment>
</Res>
In one embodiment, described SMS automation system for testing 1 also comprises SMS test installation module 12, SMS test installation module 12 for carrying out signature verification to described SMS test module 11, and installs described SMS test module 11 in mobile phone to be tested.Particularly, signature verification is carried out to described SMS test module 11, and described SMS test module 11 is installed on mobile phone to be tested.Described SMS test installation module 12 comprises the installation order after to the signature verification order of described SMS test module 11 and signature verification.Described SMS test installation module 12 can also comprise and being optimized the automatic test script after signature again.An example of described SMS test installation module 12 realize comprising of content:
@echo?off
set?apkname=Mms_Test.apk
:: apkname automatized script apk title
set?apkname=Mms_Test_new.apk
:: the automatized script title after apknewname signs again
java–jar?signapk.jar?testkey.x509.pem?testkey.pk8%apkname%%apknewname%
:: optimize apk
adb?install–r%apknewname%
:: the automatized script after again signing is mounted to mobile phone
pause
Wherein:: represent annotation.User { can find the signature files such as platform.pk8 platform.x509.pem from Android source code position platform/build/target/product/security/}.Signapk.jar file { can find/out/host/linux-x86/framework/} from Android source code position.The execution of described SMS test installation module 12 needs first automatic test script file (Mms_Test.apk) and signature file (platform.pk8 platform.x509.pem) and signapk.jar file to be put under the file at installation module 12 place test by SMS in a tester, and is connected in test machine by mobile phone employing adb to be tested.
In one embodiment, described SMS automation system for testing also comprises SMS test starting module 13, and SMS test starting module 13 for starting described SMS test module, and obtains described test result file.Particularly, SMS test starting module 13 to be included in mobile phone to be tested and just to start SMS test module 11 and carry out the order tested and the order obtaining described test result file after having tested.In one embodiment, described SMS test starting module 13 can also comprise the order of the test sectional drawing file obtained in test.An example of described SMS test starting module 13 realize comprising of content:
@echo?off
set?TestPackageName=com.example.ad.test
:: the PackageName of TestPackageName test script
set?TestedPackageName=com.android.music
:: the PackageName of the tested apk of TestedPackageName
adb?shell?am?instrument-w%TestPackageName%/com.neenbedankt.android.test.InstrumentationTestRunner
:: adb shell am instrument starts the supervision to instrument example
:: the AndroidManifest.xml searching testing engineering under this environment of com.neenbedankt.android.test.InstrumentationTestRunner, therefrom obtain the PackageName of tested APK, for keeping adb shell until tested
Echo completes
adb?pull/data/data/%TestedPackageName%/files/TEST-all.xml?d:\TestResult
adb?pull/mnt/sdcard/CaseRes.xml?d:\TestResult
Echo completes
pause
Wherein, com.example.ad.test is the bag name of the test script including SMS test module 11, and com.android.music is the bag name of tested apk.Adb shell-command is tested for the SMS test module 11 started in mobile phone to be tested; Adopt adb pull order from mobile phone to be tested, obtain test result file (CaseRes.xml).D: TestResult be the deposit position of test result.
In one embodiment, as shown in Figure 3, describe SMS test module 11 and SMS test starting module 13 in SMS automation system for testing and perform flow process.SMS test starting module 13 starts SMS test module 11 and starts to perform.SMS test module 11 reads Setting.xml file, corresponds in CaseInfo by the value of reading, for each test case, judges whether this test case performs, and namely whether this test case is use-case to be tested.Test case is according to the test case (example to be tested or item to be tested) whether performing test case and the needs execution being divided into and not needing to perform.If do not need to perform, by NT (not performing mark) information write CaseRes.xml (test result file), terminate the test of this test case.If need to perform (this test case is example to be tested), then perform corresponding test script (performing Solo operation).Judge whether to enter required interface.If do not enter required interface, by Fail (test crash or do not pass through) information write CaseRes.xml (test result file), terminate the test of this test case.If enter required interface, then continue solo operation, know that operation part completes, intercept current interface picture.Now, judge whether test result meets anticipated conditions, if met, by Pass (test crash or do not pass through) information write CaseRes.xml (test result file), terminate the test of this test case.If do not met, by Fail (test crash or do not pass through) information write CaseRes.xml (test result file), terminate the test of this test case.After the test of this test case terminates, judge whether that all wall scroll Case (test case) are all performed.If not, then the test of next test case is continued.If so, then all terminate, test result file (CaseRes.xml) copies in test machine by SMS test starting module 13, and notifies that user test terminates.
In sum, SMS test automation method and system of the present invention, there is following beneficial effect: develop based on Robotium script, operating handset can be carried out based on control ID, avoid as the problem that the needs caused distinguish mobile phone hardware difference and UI variation in script developed by employing MonkeyRunner script, simultaneously, utilize Robotium script can realize judging described test operation complete after result whether be consistent with the default result of described item to be tested, improve automaticity and recycling rate of waterused, reduce maintenance cost.Meanwhile, technical scheme of the present invention have employed the mode of test request file read test information from the multiple test item information arranged with preset format of including of presetting, and is convenient to very much modify to test request.Technical scheme of the present invention additionally provides to be verified and installation the automatic signature of test program, and automatic acquisition test result, greatly simplify the work of SMS test.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.