CN107305527B - Code file processing method and device - Google Patents

Code file processing method and device Download PDF

Info

Publication number
CN107305527B
CN107305527B CN201610259565.0A CN201610259565A CN107305527B CN 107305527 B CN107305527 B CN 107305527B CN 201610259565 A CN201610259565 A CN 201610259565A CN 107305527 B CN107305527 B CN 107305527B
Authority
CN
China
Prior art keywords
code file
code
file
annotation information
modules
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610259565.0A
Other languages
Chinese (zh)
Other versions
CN107305527A (en
Inventor
陆瑶瑶
钟书成
邝野
曹开环
罗淑文
郭子风
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610259565.0A priority Critical patent/CN107305527B/en
Publication of CN107305527A publication Critical patent/CN107305527A/en
Application granted granted Critical
Publication of CN107305527B publication Critical patent/CN107305527B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

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)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for processing a code file. The processing method of the code file comprises the following steps: acquiring a code file of a test case; acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file; according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules; selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed; and generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file. The invention solves the technical problem that the code file cannot take the functional code module as the most basic processing element in the related technology.

Description

Code file processing method and device
Technical Field
The invention relates to the field of testing, in particular to a method and a device for processing a code file.
Background
Currently, test cases generally exist in the form of code files. The existing use case management tool is used for managing the automatic test use case, and when the code file is faced, the code file is usually taken as an integral whole. When the code file is checked, only the most basic text style of the code file can be checked, and the code files of different types are displayed only through the text style of one style, so that the code file is not very beneficial to checking the code file. When the test case needs to be edited, the code file needs to be downloaded integrally, edited and uploaded again.
In most cases, it is likely that a plurality of function code modules of different functions are contained in one code file. Therefore, when a certain function code module is viewed, it is necessary to clearly know in which code file the function code module exists, and after the specific code file in which the function code module exists is determined, the corresponding function code module can be searched from the code file, so that the whole code file is taken as a whole, the code file cannot use the function code module as the most basic processing element, and the test case cannot be effectively combined and sorted.
In order to solve the problem that the code file in the related art cannot take a functional code module as the most basic processing element, no effective solution is provided at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for processing a code file, which are used for at least solving the technical problem that the code file cannot take a functional code module as the most basic processing element in the related technology.
According to an aspect of an embodiment of the present invention, a method for processing a code file is provided. The processing method of the code file comprises the following steps: acquiring a code file of a test case; acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file; according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules; selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed; and generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file.
According to another aspect of the embodiment of the invention, a device for processing the code file is also provided. The processing device of the code file comprises: the first acquisition unit is used for acquiring a code file of a test case; a second obtaining unit, configured to obtain annotation information of the code file, where the annotation information is information for annotating a code in the code file; the first processing unit is used for executing blocking processing on codes in the code file according to functions according to the annotation information to obtain a plurality of functional code modules; the selecting unit is used for selecting a plurality of target code modules from the plurality of function code modules, and the target code modules are function code modules to be executed; and the second processing unit is used for generating use case execution statements for each target code module and combining the use case execution statements into a test command of the code file.
In the embodiment of the invention, a code file for acquiring a test case is adopted; acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file; according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules; selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed; and generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file, thereby achieving the purpose of processing the code file, realizing the technical effect that the code file takes the functional code module as the most basic processing element, and further solving the technical problem that the code file cannot take the functional code module as the most basic processing element in the related technology.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a computer terminal of a code file processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method of processing a code file according to a first embodiment of the present invention;
FIG. 3 is a flowchart of a method of performing a blocking process of code in a code file by function according to annotation information according to an embodiment of the present invention;
FIG. 4 is a flow diagram of a method for generating use case execution statements for each target code module and assembling the test commands into a code file in accordance with an embodiment of the present invention;
FIG. 5 is a flowchart of a method of processing a code file according to a second embodiment of the present invention;
FIG. 6 is a flowchart of a method of processing a code file according to a third embodiment of the present invention;
FIG. 7 is a flowchart of a method of processing a code file according to a fourth embodiment of the present invention;
FIG. 8 is a schematic diagram of a code presentation of a code file according to an embodiment of the invention;
FIG. 9 is a schematic diagram of a code file displayed in terms of functional code modules, according to an embodiment of the present invention;
FIG. 10 is a block diagram of an automated test case management system according to an embodiment of the present invention;
FIG. 11 is a flow diagram of a method of test case viewing according to an embodiment of the invention;
FIG. 12 is a flow diagram of a method of test case editing according to an embodiment of the invention;
FIG. 13 is a flow diagram of a method for use case execution command generation in accordance with an embodiment of the present invention;
FIG. 14 is a schematic diagram of a code file processing apparatus according to a first embodiment of the present invention;
FIG. 15 is a schematic diagram of a code file processing apparatus according to a second embodiment of the present invention;
FIG. 16 is a schematic diagram of a code file processing apparatus according to a third embodiment of the present invention;
FIG. 17 is a schematic diagram of a code file processing apparatus according to a fourth embodiment of the present invention;
FIG. 18 is a schematic diagram of a code file processing apparatus according to a fifth embodiment of the present invention;
FIG. 19 is a schematic diagram of a code file processing apparatus according to a sixth embodiment of the present invention;
FIG. 20 is a schematic diagram of a code file processing apparatus according to a seventh embodiment of the present invention; and
fig. 21 is a block diagram of a structure of a computer terminal according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided a method of processing a code file, it should be noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of the computer terminal of the code file processing method according to the embodiment of the present invention. As shown in fig. 1, the computer terminal 1 may comprise one or more (only one shown in the figure) processors 102 (the processors 102 may comprise, but are not limited to, a processing means such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission means 106 for communication functions. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 1 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the code file processing method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the code file processing method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 1 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 1. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Under the operating environment, the application provides a method for processing the code file as shown in fig. 2. The method can be applied to intelligent terminal equipment, and is executed by a processor in the intelligent terminal equipment, and the intelligent terminal equipment can be an intelligent mobile phone, a tablet personal computer and the like. The intelligent terminal device is provided with at least one application program, and the embodiment of the invention does not limit the types of the application programs, and can be a system application program or a software application program.
Fig. 2 is a flowchart of a processing method of a code file according to a first embodiment of the present invention. As shown in fig. 2, an alternative of the processing method of the code file includes the following steps:
step S202, a code file of the test case is obtained.
In the solution provided in the above step S202, the use case is an abstract description of a set of action sequences, and the system executes the action sequences to generate corresponding results. In the test case, a group of test input, execution conditions and expected results are compiled for a special target, a program path is tested or codes for determining whether a special requirement is met are determined, and the test is specifically quantized, so that the result of the software is used as a scientific organization to summarize, and the purpose of converting the test behavior of the software into a manageable mode is achieved.
Test cases typically exist in the form of code files that include code for implementing different functions of the test case, such as testing inputs, execution conditions, and expected results, testing a certain program path, or determining whether a particular requirement is met. And acquiring the code file of the test case.
In step S204, the comment information of the code file is acquired.
In the solution provided in the foregoing step S204 of the present application, the codes in the code file have different types, functions, presentation styles, and the like, and the codes in the code file are described or identified by annotation information, where the annotation information is information for annotating the codes in the code file and is stored in the code file in the form of an annotation template, so as to obtain annotations to the codes and clarify the types, functions, presentation styles, and the like of the codes. Optionally, the code in the code file is described by a comment statement having a format, which is completed by a comment structure.
Optionally, the language type of the code in the code file may be parsed from the annotation information of the code file, for example, the code in the code file is parsed into the language types of php, python, C #, java, shell, C language, C + +, perl, ruby, nodejs, Objective-C, and the like.
And step S206, executing blocking processing on the codes in the code file according to the functions according to the annotation information to obtain a plurality of functional code modules.
In the solution provided in the foregoing step S206 of the present application, after obtaining the comment information of the code file, the code in the code file is subjected to block processing according to the function according to the comment information, so as to obtain a plurality of function code modules. The code in the code file has different functions, and the annotation information can identify the functions of the code. The annotation template comprises module classification information of codes of the code file, the annotation information in the annotation template identifies a function code module of each section of codes, the codes are divided into a plurality of different modules, the plurality of different modules have different functions and are the function code module with the smallest code file, and therefore the code file is prevented from being taken as an integral body, and the code file can be processed according to the plurality of function code modules in the code file.
Step S208, a plurality of target code modules are selected from the plurality of function code modules.
In the solution provided in the above step S208, a plurality of object code modules are selected from the plurality of function code modules, and the object code module is a function code module to be executed.
Step S210, generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of a code file.
In the solution provided in the foregoing step S210 of the present application, after a plurality of target code modules are selected from a plurality of function code modules, a use case execution statement is generated for each target code module. The test command is a test command executed by the code file in the whole test process. The plurality of functional code modules of the code file have various text styles, so that the code file can be displayed according to one functional code module, the code file can be displayed in different text styles, only one text style and one text style are avoided when the code file is taken as an integral body, and the effect of facilitating code checking is achieved.
The code file can be checked, edited and the like according to different functional code modules according to the plurality of functional code modules, so that the code file is prevented from being integrally downloaded, edited and uploaded again when the code file is taken as an integral body, and the code file can be edited on line.
Through the steps S202 to S210, the scheme provided by the invention can realize the test case code file acquisition; acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file; according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules; selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed; and generating a use case execution statement for each target code module and combining the use case execution statements into a test command of the code file, so that the effect of taking the function code module as the most basic processing element for the code file is achieved, and the technical problem that the code file cannot take the function code module as the most basic processing element in the related technology is further solved.
As an alternative implementation manner, in step S206 of the present application, the code in the code file is subjected to the blocking processing according to the function according to the comment information, so as to obtain a plurality of functional code modules. Fig. 3 is a flowchart of a method of performing a blocking process of code in a code file by function according to annotation information according to an embodiment of the present invention. As shown in fig. 3, the method for performing blocking processing on codes in a code file according to functions according to annotation information includes the following steps:
in step S301, a plurality of functions indicated by comment information are determined.
In the scheme provided in the above step S301 of the present application, a plurality of functions indicated by the comment information are determined. The codes in the code file have different functions, the annotation information can annotate the different functions for the codes of the code file through the annotation sentences with corresponding formats, and the functions of each section of codes in the code file are identified, so that the annotation of the codes is perfected through the annotation information, a plurality of functions of the code file are represented, and the functions of the code file are clarified.
Step S302, respectively inquiring codes in the code file according to a plurality of functions indicated by the annotation information to obtain a plurality of function code modules.
In the solution provided in the above step S302 of the present application, after determining the plurality of functions indicated by the comment information, the code in the code file is queried according to the plurality of functions indicated by the comment information, and the code in the code file is divided into a plurality of code modules according to the functions, where each code module is the smallest function code module, and the plurality of function code modules indicate different functions of the code file. And obtaining the classification information of the plurality of functional code modules through the annotation information of the code file.
Step S304, displaying the codes of the plurality of function code modules corresponding to the functions represented by the inquired comment information on a code display interface according to the functions.
In the scheme provided in step S304 of the present application, after obtaining a plurality of function code modules, the codes of the plurality of function code modules corresponding to the function indicated by the queried annotation information are displayed on a code display interface according to the function, where the code display interface is an interface for displaying the codes of the code file, and the function code modules are used as the most basic display units to realize display of the codes of the code file, so that the code display effects of different code language styles can be provided. The plurality of functional code modules are sequentially arranged on the code display interface, can be arranged in a list form, and can display information such as the numbers, names, attributes, viewing entries and the like of the plurality of functional code modules, so that the user terminal can conveniently view the information. After a specific function code module receives a query instruction, use case display of the function code module can be viewed, for example, description of the use case and display effect of the use case can be viewed.
The method and the device identify the functions of each section of code in the code file through determining a plurality of functions represented by the annotation information; the codes in the code file are respectively inquired according to the functions represented by the annotation information to obtain a plurality of function code modules, and the codes of the function code modules corresponding to the inquired functions represented by the annotation information are displayed on a code display interface according to the functions, so that the display effect of the code file is improved, the codes of the code file can be conveniently checked, and the effect that the function code modules are used as the most basic processing elements in the code file is achieved.
As an alternative embodiment, step S208 of the present application generates a test command of the code file according to the annotation information and a plurality of target code modules in the plurality of function code modules. FIG. 4 is a flowchart of a method for generating use case execution statements for each target code module and assembling the test commands into a code file according to an embodiment of the present invention. As shown in fig. 4, the method for generating a test command of a code file according to comment information and a plurality of object code modules among a plurality of function code modules includes the steps of:
step S401, respectively obtaining use case execution commands corresponding to the multiple target code modules.
In the solution provided in step S401 of the present application, a plurality of code function modules in a code file respectively represent different functions of the code file, and different code function modules may generate different use case execution commands of the code file, where a use case execution command is an execution command of each function code module. After obtaining the plurality of function code modules of the code file, selecting partial function code modules in the plurality of function code modules, screening partial functions of the code file, and further generating different use case execution commands.
And selecting a plurality of target code modules in the plurality of functional code modules to obtain a plurality of use case execution commands. The selection of the plurality of function code modules may be to check the plurality of object code modules, and the checking sequence of the plurality of object code modules is the sequence of the selection of the plurality of object code modules. Optionally, after the target code module is selected, an instruction for generating a use case execution command is generated, and a use case execution command corresponding to the target code module is generated according to the instruction.
Step S402, generating use case execution statements for use case execution commands corresponding to the target code modules respectively according to the comment information.
In the solution provided in the foregoing step S402 of the present application, the object code modules correspond to different parts of the annotation information, and each object code module has a specific use case execution command. After obtaining the plurality of object code modules, generating use case execution statements for use case execution commands corresponding to the plurality of object code modules according to the annotation information, and generating use case execution statements for each object code module according to a specific annotation expression in the annotation information.
Step S403, combining the use case execution commands corresponding to the multiple target code modules according to the order of the multiple target code modules and the use case execution statements, to obtain a test command of the code file.
In the solution provided in step S403 of the present application, a plurality of object code modules in a plurality of function code modules are selected according to a sequence. And combining the use case execution commands corresponding to the target code modules according to the sequence selected by the target code modules and the use case execution statements to obtain the test command of the code file.
And step S404, displaying the test command on a command display interface.
In the solution provided in step S404 of the present application, after the use case execution commands corresponding to the multiple object code modules are combined according to the sequence selected by the multiple object code modules and the use case execution statements to obtain the test command of the code file, the test command is displayed on the command display interface, which is an interface for displaying the test command and can be displayed on a specific page, so that the use case execution commands of the test case are effectively combined, the display effect of the code file is improved, the code of the code file is convenient to view, and the effect that the function code modules are used as the most basic processing elements for the code file is achieved.
The method and the device have the advantages that a plurality of case execution commands are obtained by selecting a plurality of target code modules in a plurality of functional code modules, the target code modules are the functional code modules used for generating the test commands of the code files, then case execution statements are respectively generated for the case execution commands corresponding to the plurality of target code modules according to the comment information, then the case execution commands corresponding to the plurality of target code modules are combined according to the sequence selected by the plurality of target code modules and the case execution statements to obtain the test commands of the code files, and finally the test commands are displayed on the command display interface, so that the purposes of generating the case execution statements for each target code module and combining the test commands of the code files are achieved, and the effect that the functional code modules are used as the most basic processing elements for the code files is achieved.
As an optional implementation manner, the obtaining, in step S202, a code file of the test case includes sending an obtaining request command to the server, and the server searches a source code file of the code file from the database according to the obtaining request command, reads content of the source code file and a name of the source code file, and sends the content of the source code file and the name of the source code file. The method comprises the steps of sending an acquisition request command to a server, sending the acquisition request command to a Web page (Web) background server for a browser, searching a source code file of a code file from a database according to the acquisition request command by the server, wherein the source code file comprises a code of the most original program for writing the code file, optionally sending request data to a data server by the server, and searching the source code file of the code file meeting conditions from the database by the data server. After the data server searches a source code file of the code file from the database, the database server reads the content of the source code file and the name of the source code file in the database to obtain a read result, and returns the read result to the server, the server reads the content of the source code file and the name of the source code file, and the content of the source code file and the name of the source code file can be returned to the browser in a form of HyperText Markup Language (html).
Fig. 5 is a flowchart of a processing method of a code file according to a second embodiment of the present invention. As shown in fig. 5, the processing method of the code file includes the following steps:
in step S501, after the code file is acquired, it is determined whether the type of the code file can be determined from the suffix name of the source code file.
In the solution provided in step S501 of the present application, after the code file is acquired, the source code file of the code file is acquired, including acquiring the name of the source code file, and whether the type of the code file can be determined according to the suffix name of the source code file is determined. The suffix name of the file is an extension name of the code file, the file is metadata of the type of the code file, the type of the code file can be analyzed through the suffix name of the code file, and the type of the code file can be the type of a code language, such as php, python, C #, java, shell, C language, C + +, perl, ruby, nodejs, Object-C and the like.
Step S502, determining the style of the code file according to the type of the code file, and displaying the code file according to the style of the code file and the classification information of the plurality of functional code modules.
In the solution provided in the foregoing step S502 of the present application, the types of the different code files correspond to the styles of the different code files, and the styles of the code files may be set according to the types of the code files. After judging whether the type of the code file can be determined according to the suffix name of the source code file or not, if the type of the code file can be determined according to the suffix name of the source code file, the type of the code file is determined according to the type of the code file, and the phenomenon that when the code file is taken as an integral body, the code of the code file can be displayed only in the most basic type and in a text style is avoided, so that the code of the code file can be checked favorably.
After the style of the code file is determined according to the type of the code file, the code is displayed according to the style of the code, and the source code styles displayed by different code languages are different, so that the user terminal can conveniently check the code of the code file. The code of the code file is displayed according to the style of the code file and the classification information of the plurality of functional code modules, so that the code file is displayed according to the style of the code file and the classification information of the plurality of functional code modules, the display effect of the code file is improved, the code of the code file is convenient to check, and the effect that the functional code modules are used as the most basic processing elements for the code file is achieved.
The method comprises the steps that an acquisition request command is sent to a server, the server searches a source code file of a code file from a database according to the acquisition request command, reads the content of the source code file and the name of the source code file, sends the content of the source code file and the name of the source code file, and judges whether the type of the code file can be determined according to the suffix name of the source code file after the code file is acquired; if the type of the code file can be determined according to the suffix name of the source code file, determining the style of the code file according to the type of the code file; the code file is displayed according to the style of the code file and the classification information of the plurality of functional code modules, and the effect that the code file takes the functional code modules as the most basic processing elements is achieved.
As an alternative embodiment, after determining whether the type of the code file can be determined according to the suffix name of the source code file in step S501 of the present application, the style of the code file is determined according to the comment information of the code file. Fig. 6 is a flowchart of a processing method of a code file according to a third embodiment of the present invention. As shown in fig. 6, the processing method of the code file includes the following steps:
step S601, determining whether the type of the code file can be determined according to the comment information of the code file.
In the solution provided in the above step S601 of the present application, after determining whether the type of the code file can be determined according to the suffix of the name of the source code file, if the type of the code file cannot be determined according to the suffix of the name of the source code file, by determining whether the type of the code file can be determined according to the comment information of the code file after acquiring the comment information of the code file, it is possible to determine whether the type of the code file can be determined according to the comment statement of the code file, analyze the type of the code language through the comment statement, and then determine the type of the code file. If it is judged that the type of the code file can be determined from the comment information of the code file, step S602 is performed, and if it is judged that the type of the code file cannot be determined from the comment information of the code file, step S603 is performed.
Step S602, determining the style of the code file according to the type of the code file.
In the solution provided in the above step S602 of the present application, if it is determined that the type of the code file can be determined according to the comment information of the code file, the style of the code file is determined according to the type of the code file.
Step S603, determine the default code style as the style of the code file.
In the scheme provided in the foregoing step S603 of the present application, if it is determined that the type of the code file cannot be determined according to the comment information of the code file, a default code style is obtained, the default code style is determined as the style of the code file, and the code of the code file is displayed in the default code style.
Step S604, displaying the code file according to the style of the code file and the classification information of the plurality of functional code modules.
In the scheme provided in the above step S604 of the present application, after determining the style of the code file according to the type of the code file, the code file is presented according to the style of the code file and the classification information of the plurality of functional code modules. After determining the default code pattern as a pattern of the code file, the code file is presented according to the default code pattern and classification information of the plurality of functional code modules.
After judging whether the type of the code file can be determined according to the suffix name of the source code file or not, if the type of the code file cannot be determined according to the suffix name of the source code file, judging whether the type of the code file can be determined according to the annotation information of the code file or not after acquiring the annotation information of the code file; if the type of the code file can be determined according to the annotation information of the code file, determining the style of the code file according to the type of the code file; if the type of the code file cannot be determined according to the annotation information of the code file, determining a default code style as the style of the code file; the code file is displayed according to the style of the code file and the classification information of the plurality of functional code modules, and the effect that the code file takes the functional code modules as the most basic processing elements is achieved.
As an alternative implementation manner, after the annotation information of the code file is acquired in step S204 of the present application, the code in the code file is edited to obtain an edited code file, and the edited code file is uploaded to the database. Fig. 7 is a flowchart of a processing method of a code file according to a fourth embodiment of the present invention. As shown in fig. 7, the processing method of the code file includes the following steps:
step S701, performing editing processing on the code in the code file to obtain an editing code file, and saving the editing code file.
In the scheme provided in the foregoing step S701 of the present application, after obtaining the comment information of the code file, the editing process is performed on the code in the code file to obtain an edited code file, and the performing of the editing process on the code in the code file may be performing processes such as online addition, modification, deletion, and the like on the code in the code file to obtain an edited code file, and the edited code file is saved.
Step S702, compiling annotation information in the annotation information is inquired.
In the solution provided in the above step S702 of the present application, the annotation information of the code file includes compilation annotation information, and the compilation annotation information is information for describing a parameter for compiling the code in the code file, for example, the compilation annotation information is information describing a compilation option. And after the code in the code file is edited to obtain an edited code file and the edited code file is saved, inquiring compiling annotation information in the annotation information so as to determine whether the code in the edited code file is compiled or not according to the compiling annotation information.
Step S703, determining whether to execute compilation on the code in the edited code file according to the compilation comment information.
In the scheme provided in step S703 above, the compiling annotation information includes information of a parameter for compiling the code in the code file, and after querying the compiling annotation information in the compiling annotation information, it is determined whether to perform compiling on the code in the edited code file according to the compiling annotation information. Optionally, when the code file is transferred to the server, the server determines whether to perform compilation on the code in the edited code file according to the compilation annotation information. If it is judged according to the compilation comment information that the compilation is performed on the code in the edited code file, step S704 is performed, and if it is judged according to the compilation comment information that the compilation is not performed on the code in the edited code file, step S705 is performed.
Step S704, uploading the source code file corresponding to the editing code file and the annotation information and compiling the annotation information to a server.
In the solution provided in the above step S704 of the present application, if it is determined to perform compilation on a code in the edited code file according to the compilation annotation information, the edited code file, a source code file corresponding to the annotation information, and the compilation annotation information are uploaded to the server. And the server compiles the editing code file and the source code file according to the compiling annotation information to obtain a compiled file, and stores the compiled file and the source code file in a database. Compilation annotation information describing the contents of compilation options in annotation information may be viewed in a Web page. If the compiling is determined to be needed according to the compiling annotation information, the editing code file and all related source code files and compiling options described in the code annotation are transmitted to the server, the server can compile according to the editing code file and all related source codes, and store the compiled executable file and the source codes in the database for storage.
The embodiment of the invention obtains an edited code file by editing codes in the code file after obtaining annotation information of the code file, saves the edited code file, inquires compiling annotation information in the annotation information, wherein the compiling annotation information is information for describing parameters for compiling the codes in the code file, judges whether to compile the codes in the edited code file according to the compiling annotation information, if the compiling of the codes in the edited code file is judged according to the compiling annotation information, uploads a source code file and the compiling annotation information corresponding to the edited code file and the annotation information to a server, the server compiles the edited code file and the source code file according to the compiling annotation information to obtain a compiled file, stores the compiled file and the source code file to a database, and if the compiling of the codes in the edited code file is judged not to be compiled according to the compiling annotation information, the editing code file is uploaded to the server, and the server stores the editing code file in the database, so that the inconvenience that the code file needs to be downloaded, edited and uploaded again when the code file needs to be edited when the code file is taken as an integral inseparable body is avoided, and the online editing processing of the code file is realized.
As an optional implementation manner, after determining whether to perform compilation on the code in the edited code file according to the compilation comment information, the method for processing the code file further includes: if the codes in the editing code file are judged not to be compiled according to the compiling annotation information, the editing code file is uploaded to the server, and the server stores the editing code file in the database, namely, the server receives the editing code file and directly transmits the editing code file to the database for storage, so that the editing code file is stored.
The technical solution of the present invention will be described below with reference to preferred embodiments.
FIG. 8 is a schematic diagram of a code presentation of a code file according to an embodiment of the invention. As shown in fig. 8, a code file of a test case named "test _01_ voice _ BVT" is exposed, the code file has a number of 1 and an attribute of "BVT", and contents displayed by case viewing are displayed by "case description" and "case exposure". The code of the test case is automatically identified, the code language type is analyzed through the suffix name of the code file or the annotation information in the code file, the type of the code file is further determined, and the code display effect of the code language style is provided on a code display interface. The codes of the code file can be displayed in a rolling mode through the horizontal sliding strip and the vertical sliding strip, and the code file can be conveniently checked by a user terminal.
FIG. 9 is a schematic diagram of a code file according to functional code module display according to an embodiment of the present invention. As shown in fig. 9, on the code display interface, the function of each section of code of the code file is identified by the annotation information, and the code is divided into blocks according to the annotations in the code, wherein each block is the smallest functional code module. The code file is divided into 10 functional code modules according to the annotation information, and the 10 functional code modules are displayed through numbers, use case names, use case attributes and use case viewing. The 10 function code modules have different functions, the function of each section of code in the code file is identified through the annotation information, the change of the 10 function code modules is identified through Arabic numbers from top to bottom, the use case attributes are all 'BVT', and the use case viewing can be determined through an unfolding instruction or a folding instruction or not. The use case view of each functional code module determines the view or not view of the functional code module through an icon. When the icon corresponding to the use case view of the function code module is "+", the code of the function code module is in a retracted state, the code of the function code module can be viewed, and when the icon corresponding to the use case view of the function code module is "-", the code of the function code module is in an expanded state, the code of the function code module can be retracted without being viewed, so that the limitation that the code file is used as an integral structure which cannot be divided is broken, and the technical effect that the code file uses the function code module as the most basic processing element is realized.
FIG. 10 is a block diagram of an automated test case management system according to an embodiment of the present invention. As shown in fig. 10, the structural schematic diagram of the automated test case management system includes: browser A1, Server A2, data Server A3, and database A4. The program structure of this embodiment may be a Browser/Server (B/S) structure, including a foreground presentation part and a background Server part. The browser A1 is a foreground display part of the automated test case management system, and the server A2, the data server A3 and the database A4 are background server parts of the automated test case management system. The user terminal sends a command of acquiring a use case from the browser A1, the server A2 receives the use case request command and sends a command of requesting data to the data server A3, and the data server A3 is a Web background server. The data server A3 searches the database A4 for the source code file of the qualified test case after receiving the request data command, the data server A3 returns the content of the source code file in the database A4 and the name of the source code file to the server A2, the server A2 can return the content of the source code file and the name of the source code file to the browser A1 in the form of Html, and the code file is processed by the browser A1 according to the content of the source code file and the name of the source code file, so that functions of viewing a use case, editing a use case and generating a use case execution command are realized.
FIG. 11 is a flowchart of a method for test case viewing according to an embodiment of the present invention. As shown in fig. 11, the method for checking the test case includes the following steps:
step 1101, sending a request for obtaining a test case.
And the user sends a request for acquiring the test case from the browser to the server. A use case is an abstract description of a set of action sequences that the system executes to produce a corresponding result. In the test case, a group of test input, execution conditions and expected results are compiled for a special target, a program path is tested or codes for determining whether a special requirement is met are determined, and the test is specifically quantized, so that the result of the software is used as a scientific organization to summarize, and the purpose of converting the test behavior of the software into a manageable mode is achieved.
Step S1102, the server searches for a code file of the test case, and returns the code file to the browser.
After a request for obtaining the test case is sent to the server from the browser, the server searches a source code file of the test case meeting the conditions from the database, reads the content of the source code file, and returns the content of the source code file and the name of the source code file to the browser.
In step S1103, it is determined whether the type of the code file can be determined from the suffix name of the source code file.
After the server searches the code file of the test case and returns the code file to the browser, whether the type of the code file can be determined according to the suffix name of the source code file is judged. If it is judged that the type of the code file can be determined from the suffix name of the source code file, step S1104 is performed, and if it is judged that the type of the code file cannot be determined from the suffix name of the source code file, step S1105 is performed.
And step S1104, determining a style of the code file according to the type of the code file.
And if the type of the code file can be determined according to the suffix name of the source code file, determining the style of the code file according to the type of the code file.
Step S1105 determines whether the type of the code file can be determined from the comment information of the code file.
If it is judged that the type of the code file cannot be determined from the suffix name of the source code file, it is judged whether the type of the code file can be determined from the comment information of the code file. Reading the code type description in the annotation template in the code, and judging the code type. If it is judged that the type of the code file can be determined from the comment information of the code file, step S1104 is performed, and if it is judged that the type of the code file cannot be determined from the comment information of the code file, step S1106 is performed.
In step S1106, the default code style is determined as the style of the code file.
And if the type of the code file cannot be determined according to the annotation information of the code file, determining the default code style as the style of the code file.
Step S1107, the code file is displayed.
And displaying the code according to the style of the code file. Different code languages exhibit different styles of source code files. And displaying the code file according to the style of the code file and the classification information of the plurality of functional code modules, and dividing the codes of the code file into one functional code module for displaying, so that a user terminal can conveniently check the codes of the code file.
The embodiment of the invention determines whether the type of the code file can be determined according to the suffix name of the source code file or not by sending a request for obtaining the test case, searching the code file of the test case after receiving the request for the test case by the server and returning the code file to the browser, determining the type of the code file according to the suffix name of the source code file if the type of the code file can be determined according to the suffix name of the source code file is determined, determining the type of the code file according to the comment information of the code file if the type of the code file can be determined according to the comment information of the name of the source code file is determined, determining the type of the code file according to the type of the code file if the type of the code file is determined to be not according to the comment information of the code file, and determining the default code style as the style of the code file, and finally displaying the code file, so that the code file is displayed according to the functional code module according to the annotation information, and the technical effect that the code file takes the functional code module as the most basic processing element is realized.
FIG. 12 is a flow diagram of a method of test case editing according to an embodiment of the present invention. As shown in fig. 12, the method for editing test cases includes the following steps:
step S1201, performing editing processing on the code in the code file to obtain an editing code file, and saving the editing code file.
The method comprises the steps of obtaining a code file, executing editing processing on codes in the code file, for example, performing editing processing operations such as online addition, modification and deletion on the code file to obtain an editing code file, and storing the editing code file.
Step S1202, the editing code file is transferred to the server.
And after the editing code file is obtained, uploading the editing code file to a server.
In step S1203, it is determined whether to perform compilation on the code in the editing code file.
Inquiring compiling annotation information in the annotation information, wherein the compiling annotation information is information for describing parameters for compiling the codes in the code file, and optionally, viewing the contents describing compiling options in the annotation information in a Web page; judging whether to execute compiling on codes in the edited code file or not according to the compiling annotation information; if it is judged that the compilation has been performed on the code in the edited code file based on the compilation comment information, step S1204 is performed, and if it is judged that the compilation has not been performed on the code in the edited code file based on the compilation comment information, step S1205 is performed.
In step S1204, the server performs compilation on the editing code file and the source code file to obtain a compiled file.
If the codes in the editing code file are judged to be compiled, the server compiles the editing code file and the source code file to obtain a compiled file, the compiled file and the source code file are stored in the database, optionally, all related source code files and compiling options described in the editing code file and the annotation information are transmitted to the background server, and the server compiles the editing code file and the source code file to obtain a compiled file.
In step S1205, the server directly stores the editing code file in the database.
And if the codes in the editing code file are judged not to be compiled, the server directly stores the editing code file into the database.
Optionally, the user terminal acquires the code file, edits the code file to obtain an edited code file, and stores the edited code file. In a Web page, the contents of the compilation options are described in code annotations. If compiling is needed, all relevant source code files and compiling options described in the editing code file and the code annotation are transmitted to the background server, the background server compiles all relevant source codes, and stores the compiled executable file and the source codes into the database for storage. If the code file does not need to be compiled, the background server receives the changed code and directly transmits the changed code to the database for storage, thereby realizing the online editing of the code file.
The method and the device have the advantages that the editing processing is performed on the codes in the code files to obtain the editing code files, the editing code files are stored, the editing code files are transmitted to the server, whether the codes in the editing code files are compiled or not is judged, if the codes in the editing code files are judged to be compiled, the server compiles the editing code files and the source code files to obtain the compiling files, and if the codes in the editing code files are not compiled, the server directly stores the editing code files in the database, so that the online editing of the code files is realized.
Fig. 13 is a flowchart of a method for generating a use case execution command according to an embodiment of the present invention. As shown in fig. 13, the method for generating a use case execution command includes the following steps:
step S1301, selecting a plurality of target code modules from the plurality of function code modules to obtain a plurality of use case execution commands.
And selecting a plurality of object code modules in the plurality of function code modules to obtain a plurality of use case execution commands, wherein the user terminal can check the object code modules in the plurality of function code modules to be executed, and generate the use case execution command corresponding to each function code module.
Step S1302, generating use case execution statements for use case execution commands corresponding to the target code modules according to the annotation information.
After a plurality of target code modules in the plurality of functional code modules are selected to obtain a plurality of use case execution commands, use case execution statements are respectively generated for the use case execution commands corresponding to the plurality of target code modules according to the comment information, that is, the use case execution statements are generated for each target code module according to the comment expression in the comment information.
Step S1303, combining the use case execution commands corresponding to the multiple target code modules according to the selected sequence of the multiple target code modules and the use case execution statements to obtain the test command of the code file.
Combining the use case execution commands corresponding to the target code modules according to the sequence selected by the target code modules and the use case execution statements to obtain the test commands of the code file, namely combining the use case execution commands corresponding to the target code modules according to the sequence selected by the target code modules in the function code modules and the use case execution statements corresponding to the target code modules to finally form the test commands of the whole test.
In step S1304, the test command is displayed on the command display interface.
After the use case execution commands corresponding to the target code modules are combined according to the sequence selected by the target code modules and the use case execution statements to obtain the test command of the code file, the test command is displayed in the command display interface, so that the display of the test command of the code file is realized, and the technical effect that the code file takes the function code modules as the most basic processing elements is further realized.
Optionally, the user terminal checks the functional code modules to be executed to obtain a plurality of object code modules, and generates a plurality of use case execution commands corresponding to the object code modules. According to the comment expression in the comment information, generating a use case execution statement for each target code module, then combining use case execution commands corresponding to the target code modules according to the sequence of the target code modules selected in the plurality of functional code modules, finally forming a test command of the whole test, and displaying the test command in a page, thereby effectively combining the use case execution commands of the test use cases.
The embodiment of the invention selects a plurality of target code modules in a plurality of functional code modules to obtain a plurality of case execution commands, respectively generates case execution statements for the case execution commands corresponding to the plurality of target code modules according to the comment information, combines the case execution commands corresponding to the plurality of target code modules according to the sequence selected by the plurality of target code modules and the case execution statements to obtain the test command of the code file, and displays the test command on the command display interface, thereby effectively combining the case execution commands of the test case and achieving the technical effect that the function code modules are used as the most basic processing elements in the code file.
The embodiment of the invention can edit the test cases in the code form on line; according to the suffix name of the code file or in the code of the test case, identifying the code language in the code file through annotation information in a certain format, and providing the code display effect of the language style on a code display interface; in the code of the test case, the function of each section of code is identified through annotation information in a certain format, and the code is displayed in a code display interface in a functional mode according to the annotation information in the code file; describing a compiling mode of the code file in the code file of the test case through annotation information with a certain format, and automatically compiling the test case according to the code describing mode after the test case is edited on line; in the code of the test case, the execution command of the section of code is described through an annotation statement with a certain format, and the test command executed by the multi-purpose case combination can be generated according to the description, wherein the type of the code file supports the types of languages such as php, python, C #, java, shell, C language, C + +, perl, ruby, nodejs, Objective-C and the like.
It is noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present invention is not limited by the illustrated ordering of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as (Read-Only Memory, abbreviated as ROM)/(Random Access Memory, abbreviated as RAM), a magnetic disk, and an optical disk, and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods according to the embodiments of the present invention.
According to the embodiment of the invention, the device for implementing the processing method of the code file is also provided. Fig. 14 is a schematic diagram of a code file processing apparatus according to a first embodiment of the present invention. As shown in fig. 14, the processing apparatus of the code file includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50.
In the processing of the code file in this embodiment, the first obtaining unit 10 may be configured to execute step S202 in the embodiment of the present invention, the second obtaining unit 20 may be configured to execute step S204 in the embodiment of the present invention, the first processing unit 30 may be configured to execute step S206 in the embodiment of the present invention, the selecting unit 40 is configured to execute step S208 in the embodiment of the present invention, and the second processing unit 50 is configured to execute step S210 in the embodiment of the present invention.
The first obtaining unit 10 is configured to obtain a code file of a test case.
A second obtaining unit 20, configured to obtain annotation information of the code file, where the annotation information is information for annotating codes in the code file.
And the first processing unit 30 is used for performing blocking processing on the codes in the code file according to the functions according to the annotation information to obtain a plurality of functional code modules.
The selecting unit 40 is configured to select a plurality of target code modules from the plurality of function code modules, where a target code module is a function code module to be executed.
And the second processing unit 50 is used for generating use case execution statements for each target code module and combining the use case execution statements into a test command of a code file.
Fig. 15 is a schematic diagram of a code file processing apparatus according to a second embodiment of the present invention. As shown in fig. 15, the code file processing apparatus includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50. Wherein the first processing unit 30 includes: a determination module 31, a query module 32 and a first presentation module 33.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30 and the second processing unit 40 of this embodiment have the same functions as those of the processing apparatus of the code file of the first embodiment of the present invention, and are not described herein again.
A determining module 31, configured to determine a plurality of functions represented by annotation information, where the annotation information identifies a function of each piece of code in the code file.
And the query module 32 is configured to query codes in the code file according to the plurality of functions indicated by the annotation information, so as to obtain a plurality of function code modules.
The first display module 33 is configured to display codes of a plurality of function code modules corresponding to the functions indicated by the queried annotation information on the code display interface according to the functions.
Fig. 16 is a schematic diagram of a code file processing apparatus according to a third embodiment of the present invention. As shown in fig. 16, the code file processing apparatus includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50. Wherein the second processing unit 50 includes: an acquisition module 51, a generation module 52, a combination module 53 and a second presentation module 54.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30, the selecting unit 40 and the second processing unit 50 of this embodiment have the same functions as those of the processing apparatus for the code file of the first embodiment of the present invention, and are not described herein again.
An obtaining module 51, configured to obtain the use case execution commands corresponding to the multiple target code modules respectively.
And the generating module 52 is configured to generate use case execution statements for the use case execution commands corresponding to the multiple target code modules according to the annotation information.
And the combining module 53 is configured to combine the use case execution commands corresponding to the multiple target code modules according to the sequence of the multiple target code modules and the use case execution statement, so as to obtain the test command.
And a second display module 54, configured to display the test command on a command display interface.
Fig. 17 is a schematic diagram of a code file processing apparatus according to a fourth embodiment of the present invention. As shown in fig. 17, the code file processing apparatus includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50. The first obtaining unit 10 includes a sending module 11 and a processing module 12.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30, the selecting unit 40 and the second processing unit 50 of this embodiment have the same functions as those of the processing apparatus for the code file of the first embodiment of the present invention, and are not described herein again.
And the sending module 11 is configured to send the obtaining request command to the server, where the server searches for the source code file of the code file from the database according to the obtaining request command.
And the processing module 12 is configured to read the content of the source code file and the name of the source code file, and send the content of the source code file and the name of the source code file.
Fig. 18 is a schematic diagram of a code file processing apparatus according to a fifth embodiment of the present invention. As shown in fig. 18, the code file processing apparatus includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50. Wherein, the first obtaining unit 10 includes: a sending module 11 and a processing module 12. The processing device of the code file further comprises: a first judging unit 60 and a first determining unit 70.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30, the selecting unit 40, the second processing unit 50, the sending module 11 and the processing module 12 in this embodiment have the same functions as those in the processing apparatus for code files in the fourth embodiment of the present invention, and are not described herein again.
A first judgment unit 60 for judging whether the type of the code file can be determined from the suffix name of the source code file after the code file is acquired.
A first determining unit 70 for determining a style of the code file according to the type of the code file when the type of the code file can be determined according to the suffix name of the source code file, and presenting the code file according to the style of the code file and the classification information of the plurality of functional code modules.
Fig. 19 is a schematic diagram of a code file processing apparatus according to a sixth embodiment of the present invention. As shown in fig. 19, the code file processing apparatus includes: the first acquiring unit 10, the second acquiring unit 20, the first processing unit 30, the selecting unit 40, the second processing unit 50, the first judging unit 60 and the first determining unit 70, wherein the first acquiring unit 10 comprises: a sending module 11 and a processing module 12. The processing device of the code file further comprises: a second judging unit 80, a second determining unit 90, a third determining unit 100 and a displaying unit 110.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30, the selecting unit 40, the second processing unit 50, the first determining unit 60, the first determining unit 70, the sending module 11, and the processing module 12 in this embodiment have the same functions as those of the processing apparatus for a code file in the fifth embodiment of the present invention, and are not described herein again.
A second judging unit 80 for judging whether the type of the code file can be determined from the comment information of the code file after acquiring the comment information of the code file if the type of the code file cannot be determined from the suffix of the name of the source code file after judging whether the type of the code file can be determined from the suffix of the name of the source code file.
And a second determining unit 90 for determining a type of the code file according to the type of the code file when it is judged that the type of the code file can be determined according to the comment information of the code file.
A third determining unit 100 for determining a default code pattern as a pattern of the code file upon judging that the type of the code file cannot be determined from the comment information of the code file.
The display unit 110 is configured to display the code file according to the style of the code file and the classification information of the plurality of functional code modules.
Fig. 20 is a schematic diagram of a code file processing apparatus according to a seventh embodiment of the present invention. As shown in fig. 20, the code file processing apparatus includes: a first acquiring unit 10, a second acquiring unit 20, a first processing unit 30, a selecting unit 40 and a second processing unit 50, wherein the first acquiring unit 10 includes: a sending module 11 and a processing module 12, wherein the processing device of the code file further comprises: the system comprises an editing unit 120, a query unit 130, a third judgment unit 140, a first uploading unit 150 and a second uploading unit 160.
The first obtaining unit 10, the second obtaining unit 20, the first processing unit 30, the selecting unit 40, the second processing unit 50, the sending module 11 and the processing module 12 in this embodiment have the same functions as those in the processing apparatus for code files in the fourth embodiment of the present invention, and are not described herein again.
An editing unit 120, configured to, after obtaining the comment information of the code file, perform editing processing on the code in the code file to obtain an editing code file, and save the editing code file.
And a querying unit 130, configured to query compiled annotation information in the annotation information, where the compiled annotation information is information describing a parameter for compiling the code in the code file.
A third judging unit 140, configured to judge whether to perform compilation on the code in the edited code file according to the compilation comment information.
The first uploading unit 150 is configured to judge whether to perform compilation on a code in the edited code file according to the compilation annotation information, and upload the edited code file, a source code file corresponding to the annotation information, and the compilation annotation information to the server, where the server performs compilation on the edited code file and the source code file according to the compilation annotation information to obtain a compiled file, and stores the compiled file and the source code file in the database.
And a second uploading unit 160, configured to upload the editing code file to the server when it is determined that the compiling of the code in the editing code file is not performed according to the compiling annotation information, and the server stores the editing code file in the database.
The embodiment of the invention acquires the code file of the test case through the first acquiring unit 10, acquires the annotation information of the code file through the second acquiring unit 20, wherein, the annotation information is used for annotating the code in the code file, the first processing unit 30 executes the blocking processing of the code in the code file according to the function according to the annotation information to obtain a plurality of functional code modules, a plurality of object code modules are selected from the plurality of function code modules by the selecting unit 40, the object code modules being function code modules to be executed, the second processing unit 50 generates a use case execution statement for each target code module and combines the use case execution statements into a test command of a code file, so that the effect that the code file takes the functional code module as the most basic processing element is achieved, and the technical problem that the code file cannot take the functional code module as the most basic processing element in the related technology is solved.
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the code file processing method according to the above embodiment.
Optionally, in this embodiment, the storage medium may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
acquiring a code file of a test case;
acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file;
according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules;
selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed;
and generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file.
Optionally, the storage medium is further arranged to store program code for performing the steps of: determining a plurality of functions represented by annotation information, wherein the annotation information identifies the function of each piece of code in the code file; respectively inquiring codes in the code file according to a plurality of functions indicated by the annotation information to obtain a plurality of function code modules; and displaying the codes of the plurality of function code modules corresponding to the functions represented by the inquired annotation information on a code display interface according to the functions.
Optionally, the storage medium is further arranged to store program code for performing the steps of: respectively acquiring use case execution commands corresponding to a plurality of target code modules; generating use case execution statements for use case execution commands corresponding to the target code modules respectively according to the annotation information; combining the use case execution commands corresponding to the target code modules according to the sequence of the target code modules and the use case execution statements to obtain a test command of the code file; and displaying the test command on a command display interface.
Optionally, the storage medium is further arranged to store program code for performing the steps of: and sending an acquisition request command to a server, wherein the server searches a source code file of the code file from a database according to the acquisition request command, reads the content of the source code file and the name of the source code file, and sends the content of the source code file and the name of the source code file.
Optionally, the storage medium is further arranged to store program code for performing the steps of: judging whether the type of the code file can be determined according to the suffix name of the source code file; if the type of the code file can be determined according to the suffix name of the source code file, determining the style of the code file according to the type of the code file; and displaying the code file according to the style of the code file and the classification information of the plurality of functional code modules.
Optionally, the storage medium is further arranged to store program code for performing the steps of: after judging whether the type of the code file can be determined according to the suffix name of the source code file, if the type of the code file cannot be determined according to the suffix name of the source code file, after acquiring the annotation information of the code file, judging whether the type of the code file can be determined according to the annotation information of the code file; if the type of the code file can be determined according to the annotation information of the code file, determining the style of the code file according to the type of the code file; if the type of the code file cannot be determined according to the annotation information of the code file, acquiring a default code style; and displaying the code file according to the default code style and the classification information of the plurality of functional code modules.
Optionally, the storage medium is further arranged to store program code for performing the steps of: after obtaining the annotation information of the code file, executing editing processing on the code in the code file to obtain an editing code file, and storing the editing code file; inquiring compiling annotation information in the annotation information, wherein the compiling annotation information is information for describing parameters for compiling the codes in the code file; judging whether to execute compiling on codes in the edited code file or not according to the compiling annotation information; and if the compiling of the codes in the edited code file is judged according to the compiling annotation information, uploading the edited code file, the source code file corresponding to the annotation information and the compiling annotation information to a server, wherein the server compiles the edited code file and the source code file according to the compiling annotation information to obtain a compiled file, and stores the compiled file and the source code file in a database.
Optionally, the storage medium is further arranged to store program code for performing the steps of: after judging whether to execute compiling on the codes in the edited code file according to the compiling annotation information, if judging not to execute compiling on the codes in the edited code file according to the compiling annotation information, uploading the edited code file to a server, and storing the edited code file in a database by the server.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a read only memory ROM, a random access memory RAM, a removable hard disk, a magnetic disk, or an optical disk.
The embodiment of the invention also provides a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computer terminal may be located in at least one network device of a plurality of network devices of a computer network.
Alternatively, fig. 21 is a block diagram of a structure of a computer terminal according to an embodiment of the present invention. As shown in fig. 21, the computer terminal a may include: one or more processors 211 (only one shown), a memory 213, and a transmission device 215.
The memory 213 may be used to store software programs and modules, such as the processing method of the code file and corresponding program instructions/modules in the embodiment of the present invention, and the processor 211 executes various functional applications and data processing by running the software programs and modules stored in the memory 213, that is, implements the processing method of the code file. The memory 213 may include high speed random access memory, and may also include non-volatile memory, such as one or more of magnetic storage, flash memory, or other non-volatile solid-state memory. In some examples, the memory 213 may further include memory located remotely from the processor 211, which may be connected to the computer terminal a via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 215 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 215 includes a network adapter NIC that can be connected to a router via a network cable to communicate with the internet or a local area network. In one example, the transmission device 215 is a radio frequency RF module that is used to communicate with the Internet by wireless means.
Among them, the memory 213 is used to store, in particular, preset action conditions and information of a preset authorized user, and an application program.
The processor 211 may call the information and application stored in the memory 213 by transmission to perform the following steps:
acquiring a code file of a test case;
acquiring annotation information of the code file, wherein the annotation information is information for annotating codes in the code file;
according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules;
selecting a plurality of target code modules from the plurality of function code modules, wherein the target code modules are function code modules to be executed;
and generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when the actual implementation is performed, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (13)

1. A method for processing a code file, comprising:
acquiring a code file of a test case;
obtaining annotation information of the code file, wherein the annotation information is information for annotating codes in the code file;
according to the annotation information, executing blocking processing on the codes in the code file according to functions to obtain a plurality of functional code modules;
selecting a plurality of target code modules from the plurality of functional code modules, wherein the plurality of target code modules are to-be-executed functional code modules; and
generating a use case execution statement for each target code module, and combining the use case execution statements into a test command of the code file; wherein the generating of the use case execution statement for each target code module and the combining of the test commands into the code file comprises: respectively acquiring use case execution commands corresponding to the target code modules; generating use case execution statements for use case execution commands corresponding to the target code modules according to the annotation information; combining the use case execution commands corresponding to the target code modules according to the sequence of the target code modules and the use case execution statements to obtain a test command of the code file; and displaying the test command on a command display interface.
2. The method of claim 1, wherein performing block processing on the code in the code file according to the annotation information to obtain the plurality of functional code modules comprises:
determining a plurality of functions represented by the annotation information, wherein the annotation information identifies the function of each piece of code in the code file;
inquiring codes in the code file according to a plurality of functions represented by the annotation information to obtain a plurality of function code modules; and
and displaying the codes of the plurality of functional code modules on a code display interface according to functions.
3. The method of claim 1, wherein obtaining the code file of the test case comprises:
sending an acquisition request command to a server, wherein the server searches a source code file of the code file from a database according to the acquisition request command; and
and reading the content of the source code file and the name of the source code file, and sending the content of the source code file and the name of the source code file.
4. The method of claim 3, wherein after obtaining the code file of the test case, the method further comprises:
judging whether the type of the code file can be determined according to the suffix name of the source code file; and
if the type of the code file can be determined according to the suffix name of the source code file, the style of the code file is determined according to the type of the code file, and the code file is displayed according to the style of the code file and the classification information of the plurality of functional code modules.
5. The method of claim 4, after determining whether the type of the code file can be determined from a suffix name of the source code file, the method further comprising:
if the type of the code file cannot be determined according to the suffix name of the source code file, after obtaining the annotation information of the code file, judging whether the type of the code file can be determined according to the annotation information of the code file;
if the type of the code file can be determined according to the annotation information of the code file, determining the style of the code file according to the type of the code file;
if the type of the code file cannot be determined according to the annotation information of the code file, determining a default code style as the style of the code file; and
and displaying the code file according to the style of the code file and the classification information of the plurality of functional code modules.
6. The method of claim 3, wherein after obtaining annotation information for the code file, the method further comprises:
executing editing processing on codes in the code file to obtain an editing code file, and storing the editing code file;
inquiring compiling annotation information in the annotation information, wherein the compiling annotation information is information used for describing parameters for compiling the codes in the code file;
judging whether to execute compiling on codes in the editing code file according to the compiling annotation information; and
and if the compiling of the codes in the edited code file is judged according to the compiling annotation information, uploading the edited code file, the source code file corresponding to the annotation information and the compiling annotation information to the server, wherein the server compiles the edited code file and the source code file according to the compiling annotation information to obtain a compiled file, and stores the compiled file and the source code file to the database.
7. The method according to claim 6, wherein after determining whether to perform compilation on the code in the edited code file according to the compilation annotation information, the method further comprises: and if the codes in the editing code file are judged not to be compiled according to the compiling annotation information, uploading the editing code file to the server, and storing the editing code file to the database by the server.
8. An apparatus for processing a code file, comprising:
the first acquisition unit is used for acquiring a code file of a test case;
a second obtaining unit, configured to obtain annotation information of the code file, where the annotation information is information for annotating a code in the code file;
the first processing unit is used for executing blocking processing on codes in the code file according to functions according to the annotation information to obtain a plurality of functional code modules; and
a selecting unit, configured to select a plurality of target code modules from the plurality of function code modules, where the target code modules are function code modules to be executed; and
the second processing unit is used for generating case execution statements for each target code module and combining the case execution statements into a test command of the code file;
wherein the second processing unit comprises: the acquisition module is used for respectively acquiring the use case execution commands corresponding to the target code modules; the generating module is used for respectively generating use case execution statements for the use case execution commands corresponding to the target code modules according to the annotation information; the combination module is used for combining the use case execution commands corresponding to the target code modules according to the sequence of the target code modules and the use case execution statements to obtain the test command of the code file; and the second display module is used for displaying the test command on a command display interface.
9. The apparatus of claim 8, wherein the first processing unit comprises:
a determining module for determining a plurality of functions represented by the annotation information, wherein the annotation information identifies the function of each piece of code in the code file;
a query module for querying the codes in the code file according to the functions indicated by the annotation information to obtain the function code modules,
and the first display module is used for displaying the codes of the plurality of functional code modules corresponding to the inquired functions represented by the annotation information on a code display interface according to the functions.
10. The apparatus of claim 8, wherein the first obtaining unit comprises:
the sending module is used for sending an acquisition request command to a server, wherein the server searches a source code file of the code file from a database according to the acquisition request command; and
and the processing module is used for reading the content of the source code file and the name of the source code file and sending the content of the source code file and the name of the source code file.
11. The apparatus of claim 10, further comprising:
a first judgment unit configured to judge whether the type of the code file can be determined from a suffix name of the source code file after the code file is acquired; and
a first determining unit, configured to determine a style of the code file according to the type of the code file when the type of the code file can be determined according to a suffix name of the source code file, and display the code file according to the style of the code file and the classification information of the plurality of functional code modules.
12. A computer-readable storage medium comprising a stored program, wherein the program when executed performs the method of any of claims 1 to 7.
13. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN201610259565.0A 2016-04-22 2016-04-22 Code file processing method and device Active CN107305527B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610259565.0A CN107305527B (en) 2016-04-22 2016-04-22 Code file processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610259565.0A CN107305527B (en) 2016-04-22 2016-04-22 Code file processing method and device

Publications (2)

Publication Number Publication Date
CN107305527A CN107305527A (en) 2017-10-31
CN107305527B true CN107305527B (en) 2020-05-19

Family

ID=60150487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610259565.0A Active CN107305527B (en) 2016-04-22 2016-04-22 Code file processing method and device

Country Status (1)

Country Link
CN (1) CN107305527B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825376B (en) * 2018-08-07 2024-03-12 深圳Tcl数字技术有限公司 Method, storage medium and device for analyzing annotated JSON file
CN109714470B (en) * 2018-10-23 2020-08-04 北京理工大学 Method and system for realizing mobile phone application modularization based on nodejs
CN111488140B (en) * 2019-01-29 2023-10-27 杭州海康威视数字技术股份有限公司 Method, device and computer equipment for supporting multiple programming libraries in multiple programming languages
CN110716798B (en) * 2019-09-29 2021-11-19 微梦创科网络科技(中国)有限公司 PHP (hypertext preprocessor) timing task management method and system
CN110990137B (en) * 2019-11-28 2022-08-26 北京字节跳动网络技术有限公司 Application program function module scheduling method, scheduling information processing method and device
CN111309615A (en) * 2020-02-18 2020-06-19 深圳市随手金服信息科技有限公司 Pycharm-based code selection execution method, device, equipment and storage medium
CN111459817B (en) * 2020-03-31 2024-02-02 中国银行股份有限公司 Method and device for checking program execution code
CN113434128A (en) * 2021-05-20 2021-09-24 深圳震有科技股份有限公司 Vue code editing method based on web side, editor and terminal equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101799760A (en) * 2009-02-10 2010-08-11 国际商业机器公司 Generate the system and method for the parallel simd code of arbitrary target architecture
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
AU2011100465A4 (en) * 2011-04-25 2011-06-02 Nitin Parashari Method and system for universal test scripting software
CN103699481A (en) * 2013-12-03 2014-04-02 华为技术有限公司 Code debugging method and code debugging system
CN105204994A (en) * 2015-09-18 2015-12-30 上海斐讯数据通信技术有限公司 Automation test method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101799760A (en) * 2009-02-10 2010-08-11 国际商业机器公司 Generate the system and method for the parallel simd code of arbitrary target architecture
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
AU2011100465A4 (en) * 2011-04-25 2011-06-02 Nitin Parashari Method and system for universal test scripting software
CN103699481A (en) * 2013-12-03 2014-04-02 华为技术有限公司 Code debugging method and code debugging system
CN105204994A (en) * 2015-09-18 2015-12-30 上海斐讯数据通信技术有限公司 Automation test method and system

Also Published As

Publication number Publication date
CN107305527A (en) 2017-10-31

Similar Documents

Publication Publication Date Title
CN107305527B (en) Code file processing method and device
US11216453B2 (en) Data visualization in a dashboard display using panel templates
CN106682219B (en) Associated document acquisition method and device
CN109597976B (en) Document editing method and device
US11989244B2 (en) Shared user driven clipping of multiple web pages
CN109308254B (en) Test method, test device and test equipment
US20210326310A1 (en) System for tracking and displaying changes in a set of related electronic documents
CN111666740A (en) Flow chart generation method and device, computer equipment and storage medium
CN110580189A (en) method and device for generating front-end page, computer equipment and storage medium
CN114610963A (en) Customized data display method, system, computer equipment and storage medium
CN114691132A (en) ARXML file generation method, device, equipment and storage medium
CN110765552B (en) Attribute information display method and device of three-dimensional geological model
CN105550179A (en) Webpage collection method and browser plug-in
CN106446055B (en) Webpage generation method and system
CN110929058B (en) Trademark picture retrieval method and device, storage medium and electronic device
CN112825038A (en) Visual page making method based on general component language specification and related product
JP2006065467A (en) Device for creating data extraction definition information and method for creating data extraction definition information
US8856152B2 (en) Apparatus and method for visualizing data
CN108874856A (en) A kind of page generates system, method and server
CN115033436A (en) Page testing method and device, electronic equipment and storage medium
CN111001157B (en) Method and device for generating reference information, storage medium and electronic device
CN114003329A (en) Data display component creating method and device, storage medium and electronic device
CN112988300A (en) Method and device for displaying text in page, storage medium and electronic equipment
CN112860725A (en) SQL automatic generation method and device, storage medium and electronic equipment
KR101755160B1 (en) The system guidance and method that allow you to create various documents

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