CN114661623A - UI automatic testing method for testing real Native application - Google Patents
UI automatic testing method for testing real Native application Download PDFInfo
- Publication number
- CN114661623A CN114661623A CN202210580822.6A CN202210580822A CN114661623A CN 114661623 A CN114661623 A CN 114661623A CN 202210580822 A CN202210580822 A CN 202210580822A CN 114661623 A CN114661623 A CN 114661623A
- Authority
- CN
- China
- Prior art keywords
- test
- test data
- database
- testing
- data
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention relates to the technical field of data testing, and discloses a UI automatic testing method for testing read Native application, which comprises the following steps: setting fields of test data and a test frame in a database, wherein the fields comprise execution operation, and performing association marking on the test data and the test frame based on the execution operation fields; if the database contains related test cases, directly reading the test data; if the database does not contain related test cases, generating test data by using the Apium, storing the generated test data into the database, and reading and analyzing the test data; mapping the test data into a test task executable by a detox test framework through a database; and executing the test process and storing the execution result into a database. The method and the device improve the execution efficiency when the React Native is used as the UI automation test of the core technology stack project.
Description
Technical Field
The invention relates to the technical field of data testing, in particular to a UI automatic testing method for testing read Native application.
Background
In the field of automatic UI test of mobile client iOS system and Android system, a UI automatic test scheme exists for pure Native APP developed as a main frame based on OC language and JAVA language or hybrid development architecture APP with H5, RN and Flutter, but no relevant research exists at present on how to realize automatic UI test for APP constructed by taking React Native technology stack as a main frame.
Currently, UI automation testing for mobile client APPs is based on an Appium automation testing framework. The application is formed by adding an automatic API extension to the mobile equipment based on a WebDriver protocol, the WebDriver is based on an http protocol, a session is established in the first connection, a JSON is sent through a post to inform a server of relevant test information, and the JSON is a syntax for storing and exchanging data. The whole test process is a black box test, and an executable test script cannot be directly generated aiming at the APP developed by the RN.
At present, UI automation test research of APP built by taking a real Native technology stack as a main framework is in a blank stage. The UI automation test scheme based on the APP automation test framework is used for integrating APP with a React Native as a core technology stack into a project inconveniently, and the ash box test cannot be carried out. Compared with the UI automatic test scheme using the detox test frame, the UI automatic test scheme based on the APP test frame has higher efficiency in testing the APP with the React Native as the core technology stack.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: in order to solve the problems, the invention provides an automatic UI test method for testing the React Native application.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows: a UI automatic test method for testing React Native application comprises the following steps:
step S1, setting the fields of the test data and the test frame in the database to include execution operation, and carrying out association marking on the test data and the test frame based on the execution operation fields;
step S2, if the database contains relevant test cases, directly reading the test data; if the database does not contain related test cases, generating test data by using the Apdium, storing the generated test data into the database, and reading and analyzing the test data;
step S3, mapping the test data into a test task executable by the detox test framework through a database;
in step S4, a test procedure is performed, and the result of the test procedure is stored in a database.
Further, in step S1, the test data includes the following fields: element identification, execution operation, text content.
Further, in step S1, the method set of the test framework package includes the following fields: execution operation, execution method, execution result.
Further, in step S2, if the database does not contain a relevant test case, the device is subjected to screen operation recording, elements and input test data in the operation process are recorded, and the element identifier and the test data are obtained and written into the database at the same time.
Further, aiming at the IOS equipment, the Webdriver is deployed on the target equipment, the Apdium client is started to start the Http service, the test operation is carried out through the Apdium client, the XCUITest drive test is executed, elements in the operation process and input test data are recorded, and the element identification and the test data of the operation are acquired and written into the database at the same time.
Further, aiming at the Android device, the UIAutomator is deployed on the target device, the Apdium client is started to start the Http service, the test operation is carried out through the Apdium client, the UIAutomator2 drive test is executed, elements in the operation process and input test data are recorded, and the element identification and the test data of the operation are obtained and written into the database at the same time.
Further, the field of the kernel data structure of the Apium comprises an element, an identifier, an element type, a path, a text and an event identifier; extracting relevant information in the identification and path fields as element identification fields of the test data; extracting relevant information in the event identification field as an execution operation field of the test data; and extracting the related information in the text field as the text content of the test data, and finishing the processing of the test data based on the extracted element identification, the execution operation and the text content.
Further, in step S3, the original API of the detox includes element positioning, element event, and element judgment, and the execution method of the detox test framework completes the execution of the test case through the original API.
Compared with the prior art, the invention has the following beneficial effects:
the technical scheme of the invention adopts a detox test framework which is convenient for research and development and integration into projects and is a gray box test scheme for testing a read Native technology stack; compared with other automatic test frameworks, the technical scheme of the invention improves the execution efficiency of UI automatic test with read Native as a core technology stack project; according to the technical scheme, the test case is generated in a mode of operating the screen recording, so that the time cost for writing the case script is greatly saved, and errors are not easy to occur.
Drawings
FIG. 1 is a flow chart of the UI automation testing method for testing the React Native application according to the present invention.
FIG. 2 is a diagram of entity relationships that perform operations as identifications of test data associated with a test framework.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Detox is a mobile-end APP automated testing framework.
The Appium is an open source, cross-platform automated testing tool.
The fact Native (RN for short) is a cross-platform mobile application development framework.
Webdriver is an automatic testing tool for Web applications.
XCUITest is a user interface test box launched by Apple in 2015.
Http is the hypertext transfer protocol.
UIAutomator and UIAutomator2 are an automated test open source tool.
An API refers to an application programming interface.
As shown in fig. 1, an automated UI testing method for testing a read Native application includes:
step S1, in the stage of setting database, setting the fields of test data and test frame in the database to include execution operation, and associating and marking the test data and the test frame based on the execution operation fields; step S2, starting testing, if the database contains relevant test cases, directly reading the test data; if the database does not contain related test cases, generating test data by using the Apdium, storing the generated test data into the database, and reading and analyzing the test data; step S3, mapping the test data into a test task executable by the detox test framework through a database; in step S4, a test procedure is performed, and the result of the test procedure is stored in a database.
In one embodiment, the database design, in which test data is automatically generated by the recording and playback stages, contains the fields shown in table 1 below.
TABLE 1
In some embodiments, the API provided by detox is sparse, such as to perform a click on a button, and if not packaged, then two lines of code need to be written, the first line of code finds the element, and the second line of code performs a click operation. If packaged, the function of clicking a button is executed as a line of code.
Test framework in database design: the method set based on the detox encapsulation includes the following fields as shown in the following table 2.
TABLE 2
The data generated in the actual operation process of the user is converted into the execution basis in the UI automation test process by using the 'execution operation' as the identification for associating the test data with the test framework, and an E-R diagram (an entity relation diagram) is shown in FIG. 2.
Preferably, in step S2, if the database does not contain a relevant test case, the device is subjected to screen operation recording, elements and input test data in the operation process are recorded, and the element identifier and the test data are obtained and written into the database at the same time. And for different equipment systems, the bottom layer adopted for recording screen recording operation is different.
Specifically, aiming at IOS equipment, the method comprises the steps of deploying Webdriver on target equipment, starting an Appeium client to start an Http service, carrying out test operation through the Appeium client, executing XCUITest drive test, recording elements and input test data in the operation process, and obtaining element identification and the test data of the operation and writing the element identification and the test data into a database.
Specifically, for Android equipment, the UIAutomator is deployed on target equipment, an Apdium client is started to start http service, test operation is carried out through the Apdium client, UIAutomator2 driving test is executed, elements in the operation process and input test data are recorded, and element identification and the test data of the operation are obtained and written into a database at the same time.
In the embodiment, a database table structure is designed, element identifiers and test data generated in the recording and playback processes are mapped to serve as related test objects, data verification is completed in the analysis process, and finally, automatic testing is performed through a method set after detox packaging.
Preferably, in order to meet the data storage rule in the database design, a script needs to be written to extract and store the test data generated by the app into the database.
The field of the Apium core data structure comprises an element, an identifier, an element type, a path, a text and an event identifier; the data extraction rules are as follows:
(1) an example of the Appium original part core data structure field is shown in table 3 below.
TABLE 3
According to the data structure acquired by the element in the Apdium, the data extraction rule is as follows: extracting relevant information in the identification and path fields as element identification fields of the test data; extracting relevant information in the event identification field as an execution operation field of the test data; and extracting the related information in the text field as the text content of the test data. And finishing processing and storing the whole original data by the aid of the written script through the above operations.
(2) The core original API of the Detox part is shown in table 4 below.
TABLE 4
For the "execution method" field in the test frame table, for example, "onPress" completes the execution of the test case by combining the element location method "by.id ()" and the element event method ". tap ()".
After the test data is generated, when the test data is mapped to a test task executable by a detox test framework through a database, the database mapping is realized according to a data extraction rule of the test data acquired by the Appium, and the bottom logic of the database mapping is the prior art.
Finally, it should be noted that: the above embodiments are only preferred embodiments of the present invention to illustrate the technical solutions of the present invention, but not to limit the technical solutions, and certainly not to limit the patent scope of the present invention; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention; that is, the technical problems to be solved by the present invention, which are not substantially changed or supplemented by the spirit and the concept of the main body of the present invention, are still consistent with the present invention and shall be included in the scope of the present invention; in addition, the technical scheme of the invention is directly or indirectly applied to other related technical fields, and the technical scheme is included in the patent protection scope of the invention.
Claims (8)
1. A UI automatic test method for testing React Native application is characterized by comprising the following steps:
step S1, setting the fields of the test data and the test frame in the database to include execution operation, and carrying out association marking on the test data and the test frame based on the execution operation fields;
step S2, if the database contains relevant test cases, the test data is directly read; if the database does not contain related test cases, generating test data by using the Apdium, storing the generated test data into the database, and reading and analyzing the test data;
step S3, mapping the test data into a test task executable by the detox test framework through a database;
in step S4, a test procedure is performed, and the result of the test procedure is stored in a database.
2. The method for automated UI testing of a React Native application according to claim 1, wherein in step S1, the test data comprises the following fields: element identification, execution operation, text content.
3. The method for automated UI testing of React Native application according to claim 1, wherein in step S1, the method set of the test framework package comprises the following fields: execution operation, execution method, execution result.
4. The method for automatically testing UI of a test React Native application according to claim 1, wherein in step S2, if the database does not contain related test cases, the method records screen operation on the device, records elements and input test data in the operation process, and obtains element identifiers and test data and writes the element identifiers and the test data into the database at the same time.
5. The method for automatically testing the UI of the read Native application according to claim 4, wherein for the IOS device, the WebDriver is deployed on the target device, the app client is started to start the Http service, the app client performs the test operation, the XCUITest is executed, the element in the operation process and the input test data are recorded, and the element identifier and the test data of the operation are obtained and written into the database at the same time.
6. The method for automatically testing the UI of the React Native application according to claim 4, wherein for Android devices, UIAutomate is deployed on target devices, an Appeium client is started to start an Http service, test operation is performed through the Appeium client, UIAutomate 2 drive test is executed, elements and input test data in the operation process are recorded, and element identification and the test data of the operation are obtained and written into the database at the same time.
7. The method for automated UI testing of a test React Native application of claim 1, wherein the Apium core data structure field comprises an element, an identity, an element type, a path, a text, an event identity; extracting relevant information in the identification and path fields as element identification fields of the test data; extracting relevant information in the event identification field as an execution operation field of the test data; and extracting the related information in the text field as the text content of the test data, and finishing the processing of the test data based on the extracted element identification, the execution operation and the text content.
8. The method for automatically testing UI of claim 1, wherein in step S3, the primitive API of the detox includes element location, element event, and element judgment, and the execution method of the detox test framework completes the execution of the test case through the primitive API.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210580822.6A CN114661623B (en) | 2022-05-26 | 2022-05-26 | UI automatic test method for testing React Native application |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210580822.6A CN114661623B (en) | 2022-05-26 | 2022-05-26 | UI automatic test method for testing React Native application |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114661623A true CN114661623A (en) | 2022-06-24 |
CN114661623B CN114661623B (en) | 2022-08-16 |
Family
ID=82038454
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210580822.6A Active CN114661623B (en) | 2022-05-26 | 2022-05-26 | UI automatic test method for testing React Native application |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114661623B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116257458A (en) * | 2023-05-16 | 2023-06-13 | 国网信息通信产业集团有限公司 | Automatic testing method and system for mobile API (application program interface) in hybrid development mode |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150339213A1 (en) * | 2014-05-21 | 2015-11-26 | Cgi Technologies And Solutions Inc. | Automated testing of an application system |
CN111459810A (en) * | 2020-03-25 | 2020-07-28 | 南阳柯丽尔科技有限公司 | Method of constructing application program, programming apparatus, and computer-readable storage medium |
CN111679977A (en) * | 2020-05-29 | 2020-09-18 | 杭州趣链科技有限公司 | Jest-based React project unit testing method, equipment and storage medium |
CN112100080A (en) * | 2020-11-03 | 2020-12-18 | 广州市玄武无线科技股份有限公司 | Control testing method and device, terminal equipment and computer readable storage medium |
CN114238130A (en) * | 2021-12-21 | 2022-03-25 | 平安壹钱包电子商务有限公司 | Performance test method, device, equipment and storage medium |
-
2022
- 2022-05-26 CN CN202210580822.6A patent/CN114661623B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150339213A1 (en) * | 2014-05-21 | 2015-11-26 | Cgi Technologies And Solutions Inc. | Automated testing of an application system |
CN111459810A (en) * | 2020-03-25 | 2020-07-28 | 南阳柯丽尔科技有限公司 | Method of constructing application program, programming apparatus, and computer-readable storage medium |
CN111679977A (en) * | 2020-05-29 | 2020-09-18 | 杭州趣链科技有限公司 | Jest-based React project unit testing method, equipment and storage medium |
CN112100080A (en) * | 2020-11-03 | 2020-12-18 | 广州市玄武无线科技股份有限公司 | Control testing method and device, terminal equipment and computer readable storage medium |
CN114238130A (en) * | 2021-12-21 | 2022-03-25 | 平安壹钱包电子商务有限公司 | Performance test method, device, equipment and storage medium |
Non-Patent Citations (5)
Title |
---|
EMANUEL SURIANO: ""React Native end-to-end testing with Detox"", 《HTTPS://BLOG.LOGROCKET.COM/REACT-NATIVE-END-TO-END-TESTING-DETOX/》 * |
JIYR: ""Detox: 高效进行React Native E2E测试"", 《HTTPS://JUEJIN.CN/POST/6862979132976791566》 * |
KAVEH MADANI等: ""Serious games on environmental management"", 《SUSTAINABLE CITIES AND SOCIETY》 * |
侯津 等: ""基于控件路径的跨设备UI自动化测试方法"", 《计算机系统应用》 * |
李凡: ""社区戒毒App的UI创新设计与实践"", 《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116257458A (en) * | 2023-05-16 | 2023-06-13 | 国网信息通信产业集团有限公司 | Automatic testing method and system for mobile API (application program interface) in hybrid development mode |
CN116257458B (en) * | 2023-05-16 | 2023-10-17 | 国网信息通信产业集团有限公司 | Automatic testing method and system for mobile API (application program interface) in hybrid development mode |
Also Published As
Publication number | Publication date |
---|---|
CN114661623B (en) | 2022-08-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3433732B1 (en) | Converting visual diagrams into code | |
CN109800258B (en) | Data file deployment method, device, computer equipment and storage medium | |
CN109033772B (en) | Verification information input method and device | |
CN104951515B (en) | A method of it extracts and analyzes Android phone whereabouts trace information | |
CN112181854B (en) | Method, device, equipment and storage medium for generating process automation script | |
CN114661623B (en) | UI automatic test method for testing React Native application | |
CN111913889A (en) | Test system building method and test system | |
CN107846344B (en) | Method and device for pushing messages in batch in instant messaging tool and electronic equipment | |
CN109918338B (en) | Safety chip operating system testing device | |
CN111367890A (en) | Data migration method and device, computer equipment and readable storage medium | |
CN113435862B (en) | Bill processing method and device based on mailbox | |
CN111078529B (en) | Client writing module testing method and device and electronic equipment | |
CN108984757A (en) | A kind of data lead-in method and equipment | |
CN116484836B (en) | Questionnaire generation system and method based on NLP model, electronic equipment and medium | |
CN117033249A (en) | Test case generation method and device, computer equipment and storage medium | |
CN107404426A (en) | The method, apparatus and electronic equipment of batch addition good friend in immediate communication tool | |
CN109474822B (en) | Android television multi-language automatic testing method and device | |
CN116501431A (en) | Page element positioning method, device and storage medium | |
CN113641594B (en) | Cross-terminal automatic testing method and related device | |
CN110532186B (en) | Method, device, electronic equipment and storage medium for testing by using verification code | |
CN114637672A (en) | Automatic data testing method and device, computer equipment and storage medium | |
CN114896161A (en) | File construction method and device based on artificial intelligence, computer equipment and medium | |
CN106327560A (en) | File version identification method and identification client side | |
CN107766228A (en) | It is a kind of based on multilingual automated testing method and device | |
CN110262856B (en) | Application program data acquisition method, device, terminal and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
EE01 | Entry into force of recordation of patent licensing contract | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20220624 Assignee: Yunzhu Information Technology (Chengdu) Co.,Ltd. Assignor: China Construction e-commerce Co.,Ltd. Contract record no.: X2023980032450 Denomination of invention: A UI automation test method for testing React Native applications Granted publication date: 20220816 License type: Common License Record date: 20230220 |