NL2032297B1 - Automatic generation method for android application micro-service driven by application scenario - Google Patents

Automatic generation method for android application micro-service driven by application scenario Download PDF

Info

Publication number
NL2032297B1
NL2032297B1 NL2032297A NL2032297A NL2032297B1 NL 2032297 B1 NL2032297 B1 NL 2032297B1 NL 2032297 A NL2032297 A NL 2032297A NL 2032297 A NL2032297 A NL 2032297A NL 2032297 B1 NL2032297 B1 NL 2032297B1
Authority
NL
Netherlands
Prior art keywords
event
application
service
microservice
user
Prior art date
Application number
NL2032297A
Other languages
Dutch (nl)
Inventor
Chen Xiaona
Chen Yan
Chen Xing
Li Zhenghao
Wang Yi
Original Assignee
Univ Fuzhou
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Univ Fuzhou filed Critical Univ Fuzhou
Priority to NL2032297A priority Critical patent/NL2032297B1/en
Application granted granted Critical
Publication of NL2032297B1 publication Critical patent/NL2032297B1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3612Software analysis for verifying properties of programs by runtime analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Abstract

The invention provides an automatic generation method for an Android application micro-service driven by an application scenario comprising: Sl: reconstructing a software architecture when an application runs based on application interface information; S2: 5 executing an objective function many times, and recording the method calling sequence of the objective function to form calling instances of multiple objective function based on the runtime model; S3: analyzing the obtained calling instances to acquire a service module of the micro-service with the objective function; S4: giving a user input; executing the service module to obtain a result identical to the original function. The invention enables recording 10 user calling sequences by monitoring all methods in an Android frame and application; obtaining a calling template of the micro-service by analyzing the multiple user calling sequences and reconstructing the software architecture when the application runs without sound codes and labels; automatic generation of the micro-service being implemented. 24

Description

AUTOMATIC GENERATION METHOD FOR ANDROID APPLICATION
MICRO-SERVICE DRIVEN BY APPLICATION SCENARIO
BACKGROUND OF THE INVENTION
[0001] 1. Technical Field
[0002] The present invention relates to the field of Android application micro-services, particularly to an automatic generation method for an Android application micro-service driven by an application scenario.
[0003] 2. Description of Related Art
[0004] In recent years, as mobile devices flourish, a lot of Android applications have emerged. These applications are inclusive of functions in all aspects, including life, health, travel and the like, and have become a main channel for people to use the Internet at mobile terminals. A single application with many functions may meet the demands of users of the application. However, it is more desirable that some functions of a plurality of applications are combined in use to meet the demand of personalized services, for example, calling a functional interface of application development by means of a mobile phone voice assistant. The precondition to achieve the goal lies in that the functions of the application are capable of providing external services or secondary development, which needs to be implemented by developers editing codes in development stage. With respect to functions which are not open in application development, after the application is issued, a user or a secondary developer of the application is unable to use them.
[0005] At present, by monitoring all methods in Android frame and application by using an Xposed frame, we are capable of obtaining types and methods executed by the application easily, so that the calling sequences for function execution are obtained. There is a problem to generate the micro-service through the calling sequences that in face of complicated applications, we are often unable to obtain a correct micro-service to 1 implement corresponding functions if the calling sequences are not processed.
BRIEF SUMMARY OF THE INVENTION
[0006] In view of this, the present invention is intended to provide an automatic
S generation method for an Android application micro-service driven by an application scenario, which may implement automatic generation of the Android application micro-service by reconstructing the software architecture when the application runs and recording the user calling sequences without sound codes and labels.
[0007] In order to achieve the above-mentioned purpose, the present invention adopts a technical solution as follows:
[0008] an automatic generation method for an Android application micro-service driven by an application scenario includes the following steps:
[0009] S1: reconstructing a software architecture when an application runs based on application interface information;
[0010] S2: executing an objective function for many times, and recording the method calling sequence of the objective function to form calling instances of multiple objective function based on the runtime model;
[0011] S3: analyzing the obtained calling instances to acquire a service module of the micro-service with the objective function;
[0012] S4: thereupon giving a user input, and executing the service module of the micro-service to obtain a result identical to the original function.
[0013] Further, the S2 specifically includes:
[0014] S21: creating Event according to information of current method when detecting that a current method is a dispatchTouchEvent or setText method,
[0015] S22: calling the methods triggered by a current operation of a user, and adding them into InvokeTree of Event; 2
[0016] S23: adding Event into Events.
[0017] Further, the creating Event according to information of current method in S21 specifically includes:
[0018] S211: calling a method of a caller object in method to acquire componentld and path; and
[0019] S212: respectively filling activityld , method and paramter of event with activityld, methodName and methodParameters of method.
[0020] Further, the S2 specifically includes:
[0021] S31: generating portions: activityld , componentld and path, indicating that which component in which page simulates a user operation, wherein activityld indicates a user’ page, componentld and path indicates components in the page; and
[0022] S32: generating InvokeTree, and solving a common subsequence of
InvokeTree so as to obtain a series of methods that will be called by the application after simulating the operation of the user; and
[0023] S33: generating portions: method and Paramters indicating which operation of the user will be simulated so as to obtain a service template corresponding to the micro-service.
[0024] Further, the step S32 specifically includes the following steps:
[0025] S321: filling a data pool with data of a specific method in InvokeTree, wherein the specific method is a method and a sub-method thereof of a method caller for the component in the page, and the filling data is a call of the specific method and the sub-method thereof, a calling parameter and a called returned value;
[0026] S322: deleting a method call in InvokeTree according to the collected data;
[0027] S323: converting InvokeTree into character string sequences so as to 3 obtain n character string calling sequences;
[0028] S324: finding out the shortest character string sequence, and sequentially checking whether character strings in the same positions in other character string sequences are identical based on the character string sequence, and if all the character
S strings in the same positions are identical, adding the character string into a final result till completely checking the character strings in all positions of the shortest character string sequence so as to obtain a final character string form of the public sub-sequence; and
[0029] S325: reversely parsing the final character string form of the public sub-sequence to an InvokeTree.
[0030] Further, the S33 specifically includes:
[0031] S331: dividing the operation into an input operation and a click operation;
[0032] S332: with respect to the click operation, setting method to be dispatchTouchEvent, wherein Paramters represents a position of the current component in a screen, and its value is not needed to be acquired from Input and may be obtained directly by a method of calling a component object MotionEvent itself;
[0033] S333: with respect to the input operation, setting method to be setText, wherein Paramters represents input data of the user, Parameter is originated from input, and a sequence of inputting the parameter is identical to a sequence in the setText method; and
[0034] S334: therefore, traversing sequences in the template by an input type parameter algorithm, and replacing <T;, V;> in Paramters with <T;, j>when it is the setText method, namely, the parameter of the method is data input by the j* user to represent that Input is mapped with data in Paramters.
[0035] Further, the S2 specifically includes:
[0036] S41: instantiating Events of the service according to the user input; and
[0037] S42: executing the Events of the service template of the micro-service, 4 wherein the page represented after executing all Events of the service template of the micro-service 1s Output of the micro-service.
[0038] Further, the S2 specifically includes:
[0039] S411: determining a specific value of Paramters according to a mapping relation between Input in the previously obtained API service template and Paramters in Event;; and
[0040] S412: with respect to a specific user input Input’, when method in
Event; is setText, if a certain parameter in Paramters is <T;, j>, assigning VJ of the data in Input’ to it, namely, the parameter in Paramters becomes a specific value <7; V;>; and when method in Event; is dispatchTouchEvent, stipulating that there is only one parameter in Paramters, and generating a MotionEvent object according to the position of a view component on the page corresponding to componentld and assigning a value to the parameter in Paramters.
[0041] Further, the S42 specifically includes:
[0042] S4421: setting that Event; of each service is started from the first page of the application, namely, the page indicated by activityld of Event; is the first page of the application, and then sequentially executing Events;
[0043] S422: with respect to execution of each Event;, first performing execution in the page indicated by activityld, then determining an object view for simulating the user operation in the interface according to componentld and path, and simulating the user operation by means of the setText method or the dispatchTouchEvent method,
[0044] S423: after simulating the user operation, monitoring the method call performed next by the application to obtain an ExecutionInvokeTree, and comparing it with the method in InvokeTree of the currently executed Event;; and if the two 5 formula are completely identical, considering that execution of current Event; has been finished and executing a next Event; ,; and
[0045] S424: after executing all Events in the micro-service template, wherein the page represented by the application is Output of the micro-service.
[0046] Compared with the prior art, the present invention has the following beneficial effects:
[0047] The present invention is able to record the user calling sequences by monitoring all methods in an Android frame and an application, obtain a calling template of the micro-service by analyzing the multiple user calling sequences and reconstruct the software architecture when the application runs without sound codes and labels, so that automatic generation of the Android application micro-service is implemented.
BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS
[0048] FIG. 1 is a schematic diagram of analysis and conversion processes from user operation to micro-service calling sequences in an embodiment of the present invention.
[0049] FIG. 2 is a process diagram of generating a service module and executing a service according to calling sequences in an embodiment of the present invention.
[0050] FIG. 3 is an algorithmic diagram of recording a user calling sequence in an embodiment of the present invention.
[0051] FIG. 4 is an algorithmic diagram of generating Event in an embodiment of the invention.
[0052] FIG. 5 is an algorithmic diagram of removing an irrelevant method call in an embodiment of the invention.
[0053] FIG. 6 is an algorithmic diagram of acquiring a common subsequence of
InvokeTree in an embodiment of the present invention. 6
[0054] FIG. 7 is an algorithmic diagram of executing a micro-service in an embodiment of the invention.
[0055] FIG. 8 is a micro-service interface of recording QQ music and searching for music in an embodiment of the present invention.
[0056] FIG. 9 is an input interface in an embodiment of the present invention.
[0057] FIG. 10 is an output interface in an embodiment of the present invention.
DETAILED DESCRIPTION OF THE INVENTION
[0058] Further description of the present invention will be made below in combination with drawings and embodiments.
[0059] Referring to FIG. 1, the present invention provides an automatic generation method for an Android application micro-service driven by an application scenario, including the following steps:
[0060] S1: a software architecture is reconstructed when an application runs based on application interface information;
[0061] S2: an objective function is executed for many times, and a method calling sequence of the objective function is recorded to form calling instances of multiple objective function based on the runtime model;
[0062] S3: the obtained calling instances are analyzed to acquire a service module of the micro-service with the objective function; and
[0063] S4: thereupon a user input is given, and the service module of the micro-service is executed to obtain a result identical to the original function.
[0064] In the embodiment, an input set is Input ={ Vi, Vo. Vin}. Vin represents the nth parameter value;
[0065] an output set is output ={ activityld }, wherein activityld represents Id of the page; 7
[0066] a set of method call is [Invoke =< Caller , Method , Args ,
Result >, wherein Caller represents a caller of the method, Method represents a calling method, Args represents all parameters transferred during method call,
[0067] Args ={ Arg,, Arg,...... Arg,}, wherein Arg; represent a certain
S parameter transferred during method call, and result represents a returned value of method call.
[0068] A set of events is Events ={Event,, Event,,... Event, }, wherein
Event; represents the i" user operation Event; ={ activityld, componentld, path, method, Paramters, InvokeTree }, wherein activityld represents the page of executing the operation, componentld represents ID of the component triggering the operation, path represents a path from a root node to the triggered operating node in a view, method represents a method that simulates the user operations, for example, inputting characters (setText) and clicking a screen (dispatchTouch), Paramters represents a parameter needed during execution, wherein Paramters ={<T1, V1><T2,
V2>...<Tn, Vn>}, for example, {<String, Ironman >} which may be acquired from
Input . InvokeTree represents a subsequent calling sequence of the application after the user executes the current operation.
[0069] InvokeTree ={ Invoke, { Invoke,, {...}, Invoke , {...},...},
Invoke,{...},...},
[0070] a set of user calling sequences is instance =< Input, output,
Events >, wherein Input represents an input of the micro-service; output represents an output result of the service, namely, the page represented by the service eventually;
Events represents the user operation in the micro-service execution process.
[0071] A set of application calling logs is Methodlogs ={ method, , method, ,...... method, }, wherein method; ={ caller; , methodName; , 8 methodParameters;, activityld;, methodChilds;}, caller; represents a caller of the method, methodName; represents a name of the method, methodName;={< P,,
V>< Py, Vo>.....< P,, V,>), wherein P; represents a type of the i" parameter, V; represents a value of the i" parameter, activityld; represents Id of the page called by the method, methodChilds; represents a set of other methods called in the method, methodChilds;={ method;, method;,...... method}.
[0072] A set of micro-service service modules is Template=< output,
Events >, wherein output represents the output result of the service, and Events represents the user operation in the micro-service execution process.
[0073] In the embodiment, with respect to one user calling sequence, Input and output may be directly acquired because they are given by the user. Events of the calling sequence may be obtained by analyzing the calling log of the application. The calling log may be acquired by monitoring all methods in the Android frame and applications. Event is acquired through an algorithm shown in FIG. 3:
[0074] Traversal is performed continuously to check method call in methodlogs,
Events is acquired in three steps, and the algorithm is as shown in FIG. 3:
[0075] S1: Event (Lines 3-4) is created according to information of method.
[0076] Event is created according to information of current method when detecting that a current method is a dispatchTouchEvent or setText method.
Specifically, the method of calling the caller object in method acquires componentld and path, and activityld, method and paramter of Event are respectively filled with activityld , methodName and methodParameters of method.
[0077] S2: InvokeTree (Lines 5-8) of Event is generated.
[0078] With respect to a next method and a method prior to the next dispatchTouchEvent or setText method, it is considered that they are method call 9 triggered by current operation of the user and they are added into InvokeTree of Event.
[0079] S3: Event is added into Events (Line 10).
[0080] After the above-mentioned two steps, a formalized representation of a user operation is generated, namely, Event, and the Event is added into Everts.
[0081] With respect to a user operation, a method calling log is generated, and formalized representation, namely, Events, of the user operation in the process may be obtained by means of the above-mentioned method. In addition to Input and Output given by the user, recording of a user calling sequence corresponding to the service is completed.
[0082] In the embodiment, in the service template, output is the page obtained by executing all Event in the template completely. Therefore, it is only needed to generate each Event; of the service template. By analyzing the multiple user calling sequences that execute the same micro-service, the service template of the service may be obtained. The algorithm that generates Event is as shown in FIG. 4:
[0083] the multiple instances are analyzed to generate Event of the service template of the service, and Event of the service template is generated through three steps, the algorithm being as shown in FIG. 4:
[0084] S1: a portion (Lines 2-6) of activityld, componentld and path is generated:
[0085] this portion indicates which component in which page is used to simulate the user operation. activityld indicates a user’ page, and componentld and path indicates components in the page. At the same time, it is assumed that the user’s operation is immobilized when using a certain service. Therefore, with respect to the multiple instances of this service, the quantities of Event are identical, and three elements activityld, componentld and path of Event; (for example, the i"Event;) in same position are identical. Thus, it is only needed to place the three elements in Event; of 10 one instance in the corresponding positions of the template. These elements may be obtained from the log.
[0086] S2: a portion (Lines 7-11) of InvokeTree is generated:
[0087] this portion illustrates a series of methods that will be called by the application after simulating the user operation. Whether the current operation is completed is detected and whether a next operation may be performed just by monitoring the method call in the portion. Generation of InvokeTree is completed through two steps. SI:
InvokeTree is pre-processed. The application will usually perform a series of method calls to respond to the user operation. After the user operation, a part of these method calls
IO occurring in the application is irrelevant to the user operation. Then this part of irrelevant method calls will be removed according to transmissibility of data. S2: the common sub-sequence of InvokeTree is acquired. In this step, the common sub-sequence of
InvokeTree is solved according to a thought of the character string common sub-sequence.
[0088] S3: a portion (Lines 13-14) of method and Paramters is generated:
[0089] this portion indicates which operation of the user is to be simulated. Since the user operation is substantially an input operation or a click operation (a sliding operation may be regarded as continuous click operations), the operation will also be divided into input operation and click operation. With respect to the click operation, method is set to be dispatchTouchEvent, wherein Paramters represents a position of the current component in a screen, and its value is not needed to be acquired from Input and may be obtained directly by a method of calling a component object MotionEvent itself. With respect to the input operation, method is set to be serlext, wherein
Paramters represents input data of the user. Parameter is only originated from input, and a sequence of inputting the parameter is identical to a sequence in the setZext method.
Therefore, sequences in the template will be traversed by an input type parameter 11 algorithm, and replacing <T;, V;> in Paramters with <T;, j> when it is the setText method, namely, the parameter of the method is data input by the j"™ user to represent that
Input is mapped with data in Paramters.
[0090] This portion InvokeTree of Event of the service template is generated through two steps. First of all, this part of irrelevant method calls will be removed according to transmissibility of data, and then the common sub-sequence of InvokeTree is solved.
[0091] First portion: the irrelevant method calls are removed through the algorithm shown in FIG. 5 to pre-process InvokeTree:
[0092] InvokeTree is pre-processed through two steps, the algorithm being shown in FIG. 5:
[0093] First, data (Lines 1-5) in the data pool is initialized.
[0094] A data pool is filled with data of a specific method in InvokeTree, wherein the specific method is a method and a sub-method thereof of a method caller for the component in the page. The filling data is a call of the specific method and the sub-method thereof, a calling parameter and a called returned value. As these data may be associated with the content on the page and change of these data may cause change of the content on the page, these data are selected as a ground of an identification method, namely, as long as these data are not involved in the method, it may be considered that this is a method of insignificance, which may be removed.
[0095] second, a method call (lines 6-10) in InvokeTree is deleted according to the collected data.
[0096] If the caller, the calling parameter or the called returned value of a certain method call (including a sub-method call thereof) in InvokeTree do not exist in the previous data pool, this method call will be deleted.
[0097] Second portion: the common sub-sequence of InvokeTree is obtained 12 through the algorithm shown in FIG. 6:
[0098] the common sub-sequence of InvokeTree is obtained through three steps, the algorithm being shown in FIG. 6:
[0099] S1: InvokeTree is converted into a character string sequence (lines 2-5).
[00100] One InvokeTree is constituted by multiple invoke trees. Here, preorder traversal is performed on each tree. When nodes of the tree are traversed, a type name of the caller and a method name of the method and a type name corresponding to the parameter in the method are extracted, they are spliced to one character string, and the obtained character strings are spliced to a new character string according to a preorder traversal sequence. Thus, after traversal is completed, the character string represents the invoke tree. Then each invoke tree in InvokeTree is converted into one character string according to the method, so as to obtain the corresponding character string sequence of
InvokeTree.
[00101] S2: the common sub-sequence (6-17) of n character string calling sequences is obtained.
[00102] Multiple [nvokeTree instances are converted into character string sequences according to the method in S1 so as to obtain n character string calling sequences. The shortest character string sequence is found out first, and whether character strings in the same positions in other character string sequences are identical is sequentially checked based on the character string sequence, and if all the character strings in the same positions are identical, the character string is added into a final result till the character strings in all positions of the shortest character string sequence are completely checked so as to obtain a final character string form of the public sub-sequence.
[00103] S3: the sequence is reversely parsed into one InvokeTree (line 18).
[00104] After the maximum common sub-sequence is obtained, the sequence is reversely parsed into one InvokeTree, and the InvokeTree is the maximum common 13 sub-sequence of the multiple InvokeTree instances. Therefore, InvokeTree of Event is obtained.
[00105] Thus, the service template of the corresponding micro-service is obtained according to the above-mentioned steps.
[00106] In the embodiment, the user operation is simulated to execute the corresponding service. Each user operation started from opening the application is recorded as one Event; in the service, so that what we have to do is to execute these
Event; sequentially. The micro-service is executed through the following algorithm: the service 1s executed in two portions. The algorithm is as shown in FIG. 7:
[00107] SI: Events (line 2-18) of the service are instantiated by using user input.
[00108] A specific value of Paramters is determined according to a mapping relation between Input in the previously obtained API service template and Paramters in Event; With respect to a specific user input Input’, when method in Event; is setText, if a certain parameter in Paramters is <T;, j>, V; ofthe jth datain Input’ is assigned to it, namely, the parameter in Paramters becomes a specific value <T;, V;>; and when method in Event; is dispatchTouchEvent, it is stipulated that there is only one parameter in Paramters, and a MotiontEvent object is generated according to the position of a view component on the page corresponding to componentld and a value is assigned to the parameter in Paramters.
[00109] S2: Events (line 10 and 17) of the service are executed.
[00110] Itis stipulated that Event; of each service is started from the first page of the application, namely, the page indicated by activityld of Event, is the first page of the application, and then Events is sequentially executed.
[00111] With respect to execution of each Event;, first execution is performed in the page indicated by activityld. An object View for simulating the user operation in the interface is then determined according to componentld and path, and the user 14 operation is simulated by means of the setText method or the dispatchTouchEvent method.
[00112] After the user operation 1s simulated, the method call performed next by the application is monitored to obtain an ExecutionInvokeTree, and it is compared with the method in InvokeTree of the currently executed Event;; and if the two formulae are completely identical, it is considered that execution of current has been finished and executing a next. If the two InvokeTree are completely identical, it is considered that execution of the current Event; has been finished, and a next Event;,; may be executed.
[00113] After all Events in the micro-service template are executed, wherein the page represented by the application is Output of the micro-service.
[00114] In the embodiment, it is divided into two portions: recording the user calling sequences and generating the micro-service based on development of java language, Android Studio and an Eclipse platform. When the user calling sequences are recorded, source codes of a recording related technique are imported into a working range of the Android Studio, corresponding modules are generated and activated on the Android platform installed with xposed, then the first page of the application needed to record the micro-service is opened, a round button region on the bottom left side is clicked, and corresponding operations are executed according to function steps. After all operations are executed completely, the round button region is clicked again to finish the recording, thereby completing recording of one user calling sequence. A recording result is stored in a methodLog.txt file under storage/emulated/0. FIG. 8 is an interface of a micro-service of recording QQ music and searching for music in an embodiment of the present invention.
[00115] After the multiple user calling sequences are recorded successfully, the micro-service may be generated according to the calling sequences. The source codes of the related technique that analyzes the sequences are imported into a working range of 15
Eclipse, a position of txt that stores the user calling sequences is given after the 30th line of StartBuildModel java is found out, then a java file is run to enter an analyzing stage, and after a control console outputs the file, the obtained result is stored in the txt file and placed under storage/emulated/0 of a mobile phone; and then the source codes of the micro-service generating related technique are imported into the working range of the
Android Studio, the file name of txt filled with the stored result on the 45th line of
Method TrackPool java is found out, and the program is run to generate the corresponding micro-service.
[00116] In the embodiment, verification tests on generation of micro-services for totally 13 functions of 9 applications such as Douban Movie and QQ Music, wherein 11 of them are verified correct. A verification result is as shown in a table 1:
APP Verify the quantity of | Verify the quantity of
Te
DIANLAIKE business | 2 1
TT
Complete book of | 2 2 rT
[00117] Table 1 Verification result 16
[00118] It may be known from the above table that the available rate of the generated micro-services is about 84%. The reason why the generated micro-services are unavailable is that as execution of the micro-services is dependent on monitoring the methods in the APP, the generated micro-services are defective when there are no methods of the APP monitored, so that it makes mistakes in executing the micro-services.
[00119] The user calling sequences are analyzed and recorded, and each user operation Event is recorded, so that the micro-service template is generated. Each Event in the template is executed again to implement execution of the micro-service when the micro-service is executed, and therefore, when the recorded user calling sequence is intact, the Event in the micro-service template analyzed is called again to implement the corresponding micro-service. Micro-service input and output interfaces for searching function of QQ Music are shown in FIG. 9 and FIG. 10.
[00120] According to the above-mentioned verification result and the input and output interfaces, we may find that a result obtained a searching sparrow of a generated music searching micro-service is identical to the finally obtained page when we search for music normally. Meanwhile, under a majority of circumstances, we may generate correct micro-services by analyzing the multiple user sequences, indicating that the effectiveness and accuracy of the method may be met.
[00121] The above is merely the preferred embodiments of the present invention, and equivalent changes and modifications made within the scope of the patent applied by the present invention shall fall into the scope of the present invention. 17

Claims (9)

CONCLUSIESCONCLUSIONS 1. Applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie, met het kenmerk, dat de werkwijze de volgende S stappen bevat: stap SI: het reconstrueren van een runtime-softwarearchitectuur van de applicatie op basis van applicatie-interface informatie; stap S2: het meerdere malen uitvoeren van een doelfunctie en het vastleggen van werkwijze-aanroepsequenties van de doelfunctie om meerdere aanroepinginstanties van de doelfunctie te vormen op basis van een runtime-model; stap S3: het analyseren van de verkregen aanroepingsinstanties om een servicesjabloon van een microservice voor de doelfunctie te verkrijgen; en stap S4: op dit punt, het geven van een gebruikersinvoer en het uitvoeren van de servicesjabloon van de microservice, zodanig dat eenzelfde resultaat als de oorspronkelijke functie wordt verkregen.Claims 1. Application scenario-driven method for automatically generating a microservice for an Android application, characterized in that the method comprises the following S steps: step S1: reconstructing a runtime software architecture of the application on the basis of application interface information; step S2: executing a target function multiple times and recording method invocation sequences of the target function to form multiple invocation instances of the target function based on a runtime model; step S3: analyzing the retrieved callers to obtain a microservice service template for the target function; and step S4: at this point, giving a user input and executing the service template of the microservice such that a result similar to the original function is obtained. 2. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 1, met het kenmerk, dat de stap S2 specifiek als volgt is: stap S21: als de huidige werkwijze wordt geverifieerd als een dispatchTouchEvent werkwijze of setText werkwijze, het creëren van een event op basis van de huidige method informatie; stap S22: het toevoegen van werkwijze-aanroepen die door een huidige gebruikersactiviteit worden getriggerd aan een [nvokeTree van het Event; en stap S23: het toevoegen van het event aan Events. 18The application scenario-driven method for automatically generating a microservice for an Android application according to claim 1, characterized in that step S2 is specifically as follows: step S21: if the current method is verified as a dispatchTouchEvent method or setText method, creating an event based on the current method information; step S22: adding method calls triggered by a current user activity to an [nvokeTree of the Event; and step S23: adding the event to Events. 18 3. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 2, met het kenmerk, dat het genoemde creéren van een event op basis van de huidige method informatie in stap S21 specifiek als volgt is: stap S211: het aanroepen van een caller-objectwerkwijze van method om componentld en path te verkrijgen; en stap S212: het vullen van activityld, methodName en methodParameters van het method in respectievelijk activityld, method en paramter van event.The application scenario-driven method for automatically generating a microservice for an Android application according to claim 2, characterized in that said creating an event based on the current method information in step S21 is specifically as follows: step S21 S211: calling a caller object method of method to obtain componentld and path; and step S212: populating activityld, methodName and methodParameters of the method into activityld, method and parameter of event, respectively. 4. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 1, met het kenmerk, dat de stap S3 specifiek als volgt is: stap S31: het genereren van een sectie van activityld, componentld en path, waarbij activityld een pagina specificeert waar de gebruiker zich bevindt, componentld en path een component op een pagina specificeren, en de gegenereerde sectie specificeert welke component op welke pagina een gebruikersactiviteit zal simuleren; stap S32: het genereren van een I[nvokeTree, en het oplossen van een gemeenschappelijke subsequentie van de InvokeTree, om een reeks werkwijzen te verkrijgen die de applicatie zal aanroepen wanneer de gesimuleerde gebruikersactiviteit is voltooid; en stap S33: het genereren van een sectie van method en Paramters, die specificeert welke gebruikersactiviteit moet worden gesimuleerd om een servicesjabloon voor de corresponderende microservice te verkrijgen.The application scenario-driven method for automatically generating a microservice for an Android application according to claim 1, characterized in that step S3 is specifically as follows: step S31: generating a section of activityld, componentld and path , where activityld specifies a page the user is on, componentld and path specify a component on a page, and the generated section specifies which component on which page will simulate a user activity; step S32: generating an I[nvokeTree, and resolving a common subsequence of the InvokeTree, to obtain a set of methods that the application will invoke when the simulated user activity is completed; and step S33: generating a section of method and parameters specifying which user activity to simulate to obtain a service template for the corresponding microservice. 5. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een 19 microservice voor een Android applicatie volgens conclusie 4, met het kenmerk, dat de stap S32 de volgende stappen specifiek omvat: stap S321: het vullen van een datapool met gegevens van een specifieke werkwijze in de InvokeTree, waarbij de specifieke werkwijze een werkwijze en een subwerkwijze daarvan is waarvan de aanroeper een component op de pagina is; en de gevulde gegevens zijn de aanroeper, aanroepargumenten en een retourwaarde van de aanroeping van de specifieke werkwijze en de subwerkwijze daarvan; stap S322: het opruimen van de werkwijze-aanroepen uit de InvokeTree op basis van de verzamelde gegevens; stap S323: het omzetten van de InvokeTree in een stringsequentie om # stringsequenties van de aanroepingen te verkrijgen; stap S324: het vinden van de kortste stringsequentie en deze als referentie gebruiken om sequentieel te verifiëren of een string op dezelfde positie in andere stringsequenties dezelfde 1s; als alle stringsequenties op dezelfde positie dezelfde zijn, het toevoegen van deze string aan het eindresultaat, zodat wanneer de strings op alle posities van de kortste stringsequentie worden geverifieerd, een uiteindelijke gemeenschappelijke subsequentie in een stringvorm wordt verkregen; en stap S325: omgekeerd ontleden van de laatste gemeenschappelijke subsequentie in de stringvorm tot een InvokeTree.The application scenario-driven method for automatically generating a 19 microservice for an Android application according to claim 4, characterized in that the step S32 specifically comprises the following steps: step S321: filling a data pool with data from an specific method in the InvokeTree, wherein the specific method is a method and a sub-method thereof whose caller is a component on the page; and the filled data is the caller, call arguments, and a return value of the invocation of the specific method and its sub-method; step S322: clearing the method calls from the InvokeTree based on the collected data; step S323: converting the InvokeTree into a string sequence to obtain # string sequences of the calls; step S324: find the shortest string sequence and use it as a reference to sequentially verify whether a string at the same position in other string sequences has the same 1s; if all string sequences at the same position are the same, adding this string to the final result so that when the strings at all positions of the shortest string sequence are verified, a final common subsequence in string form is obtained; and step S325: reverse parse the last common subsequence in the string form into an InvokeTree. 6. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 4, met het kenmerk, dat de stap S33 specifiek als volgt is: stap S331: activiteiten worden ingedeeld in tekstactiviteiten en klikactiviteiten; stap S332: voor een klikactiviteit wordt de method ingesteld als dispatchTouchEvent; Paramters vertegenwoordigen een huidige positie van een 20 componen op een scherm, en de waarde daarvan hoeft niet uit Input te worden verkregen, maar kan rechtstreeks worden verkregen door de werkwijze van een componentobject MotionEvent zelf aan te roepen; stap S333: voor een tekstactiviteit wordt de method ingesteld als setZext,; S Paramters vertegenwoordigen de tekstgegevens van de gebruiker, en een bron van Parameter 1s tekstinvoer, waarbij de volgorde waarin een gebruiker parameters invoert dezelfde 1s aan de volgorde waarin de sef7ext werkwijzen verschijnen; en stap S334: vervolgens doorloopt een algoritme voor het invoertype parameter de sequenties in de sjabloon, en in het geval van de werkwijze setlext wordt de <T;, V;> in Paramters vervangen door <T;, j>, d.w.z. de parameter van de werkwijze zijn de gegevens die door de jde gebruiker zijn ingevoerd om een data mapping van Input en Paramters aan te geven.The application scenario-driven method for automatically generating a microservice for an Android application according to claim 4, characterized in that the step S33 is specifically as follows: step S331: activities are classified into text activities and click activities; step S332: For a click activity, the method is set as dispatchTouchEvent; Paramters represent a current position of a component on a screen, and its value need not be obtained from Input, but can be obtained directly by calling the method of a component object MotionEvent itself; step S333: For a text activity, the method is set as setZext,; S Paramters represent the user's text data, and a source of Parameter 1s text input, where the order in which a user enters parameters is the same 1s to the order in which the sef7ext methods appear; and step S334: Next, an algorithm for the input type parameter goes through the sequences in the template, and in the case of the setlext method, the <T;, V;> in Paramters is replaced with <T;, j>, i.e., the parameter of the method is the data entered by the jth user to indicate a data mapping of Input and Paramters. 7. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 1, met het kenmerk, dat de stap S4 specifiek als volgt is: stap S41: het instantiëren van de Events van de service op basis van de gebruikersinvoer; en stap S42: het uitvoeren van de Events van de servicesjabloon van de microservice, en nadat de uitvoering van alle Events van de servicesjabloon van de microservice is voltooid, het renderen van een pagina als de Uitvoer van de microservice.The application scenario-driven method for automatically generating a microservice for an Android application according to claim 1, characterized in that the step S4 is specifically as follows: step S41: instantiating the Events of the service based on the user input; and step S42: executing the Events of the service template of the microservice, and after executing all the Events of the service template of the microservice is completed, rendering a page as the Output of the microservice. 8. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 7, met het kenmerk, dat de stap S41 specifiek als volgt is: stap S411: het bepalen van een specifieke waarde van Paramters op basis van de 21 eerder verkregen mapping relatie tussen de Input en Paramters in Event; van het API-servicesjabloon; en stap S412: voor een specifieke gebruikersinvoer Input’, in het geval van setText als de method van Event, als een parameter in Paramters <Tj, j> is, het toewijzen V; van het jde gegeven in Input’ aan de parameter, d.w.z. de parameter in Paramters wordt een specifieke waarde <T;,V;>; in het geval van dispatchTouchEvent als de method van Event; het aantal parameters in Paramters te beperken tot één, een MotionEvent object te genereren op basis van de positie van de view component op een pagina die overeenkomt met de componentld, en het toewijzen aan de parameter in IO Paramters.The application scenario-driven method for automatically generating a microservice for an Android application according to claim 7, characterized in that the step S41 is specifically as follows: step S411: determining a specific value of Paramters based on the 21 previously obtained mapping relationship between the Input and Paramters in Event; of the API service template; and step S412: for a specific user input Input', in the case of setText as the method of Event, if a parameter in Paramters is <Tj, j>, assign it V; of the jth data in Input' to the parameter, i.e. the parameter in Paramters becomes a specific value <T;,V;>; in the case of dispatchTouchEvent as the method of Event; limit the number of parameters in Paramters to one, generate a MotionEvent object based on the position of the view component on a page that matches the component ld, and assign it to the parameter in IO Paramters. 9. De applicatie scenario-gestuurde werkwijze voor het automatisch genereren van een microservice voor een Android applicatie volgens conclusie 7, met het kenmerk, dat de stap S42 specifiek als volgt is: stap S421: de Event; van elke service wordt ingesteld om te starten vanaf een startpagina van de applicatie, d.w.z. de pagina gespecificeerd door activityld van Event, is de startpagina van de applicatie, en dan worden Events sequentieel uitgevoerd, stap S422: elke Event; wordt eerst uitgevoerd op een pagina gespecificeerd door de activityld, vervolgens wordt het object view dat in de interface wordt gebruikt om de gebruikersactiviteit te simuleren bepaald op basis van de componentid en path, en de gebruikersactiviteit wordt gesimuleerd door middel van de setText werkwijze of de dispatchTouchEvent werkwijze; stap S423: na de simulatie van de gebruikersactiviteit worden de volgende werkwijze-aanroepen door de applicatie bewaakt om een ExecutionInvokeTree te verkrijgen, en vergeleken met de werkwijzen in de InvokeTree van het momenteel 22 uitgevoerde Event;; als de twee InvokeTrees identiek zijn, wordt de uitvoering van het huidige Event; als voltooid beschouwd, en kan het volgende event Event; worden uitgevoerd, en stap S424: na het voltooien van de uitvoering van alle Events van de jabloon van de microservice, is de pagina die door de applicatie wordt weergegeven de Uitvoer van de microservice. 23The application scenario-driven method for automatically generating a microservice for an Android application according to claim 7, characterized in that step S42 is specifically as follows: step S421: the Event; of each service is set to start from a home page of the application, i.e., the page specified by activityld of Event is the home page of the application, and then Events are executed sequentially, step S422: each Event; is first executed on a page specified by the activityld, then the view object used in the interface to simulate the user activity is determined based on the componentid and path, and the user activity is simulated using the setText method or the dispatchTouchEvent method; step S423: After the user activity simulation, the following method calls are monitored by the application to obtain an ExecutionInvokeTree, and compared with the methods in the InvokeTree of the currently executing Event; if the two InvokeTrees are identical, the execution of the current Event; considered complete, and the next event Event; are executed, and step S424: After completing the execution of all Events of the microservice template, the page displayed by the application is the output of the microservice. 23
NL2032297A 2022-06-27 2022-06-27 Automatic generation method for android application micro-service driven by application scenario NL2032297B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
NL2032297A NL2032297B1 (en) 2022-06-27 2022-06-27 Automatic generation method for android application micro-service driven by application scenario

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
NL2032297A NL2032297B1 (en) 2022-06-27 2022-06-27 Automatic generation method for android application micro-service driven by application scenario

Publications (1)

Publication Number Publication Date
NL2032297B1 true NL2032297B1 (en) 2023-03-31

Family

ID=85779585

Family Applications (1)

Application Number Title Priority Date Filing Date
NL2032297A NL2032297B1 (en) 2022-06-27 2022-06-27 Automatic generation method for android application micro-service driven by application scenario

Country Status (1)

Country Link
NL (1) NL2032297B1 (en)

Similar Documents

Publication Publication Date Title
US7222265B1 (en) Automated software testing
US6067639A (en) Method for integrating automated software testing with software development
US20030212924A1 (en) Software development test case analyzer and optimizer
CN110008113B (en) Test method and device and electronic equipment
US8024422B2 (en) Web-based speech recognition with scripting and semantic objects
CN111124919A (en) User interface testing method, device, equipment and storage medium
WO2001073755A1 (en) Web-based speech recognition with scripting and semantic objects
Matthijssen et al. Connecting traces: Understanding client-server interactions in ajax applications
CN111190827A (en) Interface automation test method and device, storage medium and electronic equipment
CN116661756B (en) Object analysis method and device based on low-code DSL
CN111338618B (en) Application scene driven Android application micro-service automatic generation method
CN109669851A (en) Performance test script method for recording based on Selenium automation
US20060005079A1 (en) Methods and apparatus for translating application tests for execution with simulation software tools
JP5363589B2 (en) Method and system for generating voice user interface code from a data metamodel
Michael et al. Retico: An open-source framework for modeling real-time conversations in spoken dialogue systems
Hue et al. USLTG: test case automatic generation by transforming use cases
Businge et al. How stable are eclipse application framework internal interfaces?
NL2032297B1 (en) Automatic generation method for android application micro-service driven by application scenario
WO2002077973A1 (en) Web-based speech recognition with scripting and semantic objects
Eler et al. JaBUTiService: a web service for structural testing of java programs
CN112597037B (en) Java and Python combined automatic script development method and device
Rodriguez et al. Testing Requirements via User and System Stories in Agent Systems
Schulz Integrating performance tests in a generative software development platform
Hicks et al. Automated testing as an aid to systems integration
CN115221064A (en) Locust performance test method and device, electronic equipment and storage medium