Contextual test code generation

By generating specification files related to the current unit and automated test template updates, the painful problems of unit testing steps in software development are solved, development efficiency and code quality are improved, and testing coverage is achieved.

CN119731639APending Publication Date: 2025-03-28SNAP INC
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202380059856.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-08-18
Filing Date
2023-08-09
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

During software development, writing unit tests is a painful step in the development cycle, traditional methods are outdated and difficult to share with other developers, portable unit test methods. Copying and pasting code can cause problems with the test description or name not being updated and unnecessary code not being removed.

Method used

Generate specification files with code related to the current unit in the test to increase productivity, increase code consistency, and encourage better test coverage. Through the unit test development system, including code analysis, metadata extraction, feature classification and template modification modules, the test template files are automatically generated and updated.

Benefits of technology

Improve the quality of software projects, reduce the introduction of errors, improve development efficiency and code consistency, and promote better test coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119731639A_ABST
    Figure CN119731639A_ABST
Patent Text Reader

Abstract

At least one unit of a software application is identified. The at least one unit includes source code. Source code of the at least one unit is analyzed to determine a style of the source code. Metadata is extracted from the at least one unit based on source code analysis. One or more features of the extracted metadata are classified. The template file is modified based on the extracted metadata and the classified features to create a modified template file.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Priority declaration

[0002] This application claims the benefit of priority to U.S. application Serial No. 17 / 820,691, filed on August 18, 2022, the entire contents of which are incorporated herein by reference. Background Art

[0003] With the increase in the use of digital images, the affordability of portable computing devices, the availability of increased capacity of digital storage media, and the increased bandwidth and accessibility of network connections, digital images and videos have become part of the daily lives of more and more people. Furthermore, the expectation of device users is that the experience of using applications on portable computing devices will continue to become more advanced and media-rich. BRIEF DESCRIPTION OF THE DRAWINGS

[0004] In the drawings, which are not necessarily drawn to scale, similar reference numerals may describe similar components in different views. To easily identify the discussion of any particular element or action, the highest digit or digits in the reference numeral refer to the figure number in which the element is first introduced. Some non-limiting examples are shown in the accompanying drawings, in which:

[0005] Figure 1 is a diagrammatic representation of a networking environment in which the present disclosure may be deployed, according to some examples.

[0006] Figure 2 is a block diagram showing the various modules of the unit test development system.

[0007] Figure 3A A process for generating and modifying template files for performing unit testing on source code is shown.

[0008] Figure 3B An image of an example modified template file is shown.

[0009] Figure 4 is a diagrammatic representation of a machine in the form of a computer system according to some examples within which a set of instructions may be executed for causing the machine to perform any one or more of the methodologies discussed herein.

[0010] Figure 5 is a block diagram illustrating a software architecture in which examples may be implemented. DETAILED DESCRIPTION

[0011] Developers of software code tend to run out of time during the development cycle, and writing unit tests for software code projects is one of the last and arguably painful and repetitive steps before checking the code into the final repository to update the software product. In addition, as the traditional way of writing unit tests becomes obsolete, it is difficult to share new ways of portable unit tests with other developers. In addition, when developing code, software developers can copy and paste parts of code from different units or applications. Copying and pasting code may cause various problems. For example, software developers may forget to update the test description or name, or software developers may forget to remove unnecessary code of the current unit being developed. In addition, software developers may have to determine the most recent or most relevant test code convention to be followed. In some cases, software developers or testers may forget how to simulate a certain section of code. Simulation code can include creating a false representation of a dependency. For example, when testing an application using an application programming interface (API) from a server, the API server can be simulated, so the test is more like a unit test rather than an integration or end-to-end test.

[0012] Embodiments described herein relate to generating a specification file with code associated with the current unit under test. The specification file can be used to improve productivity, increase code consistency, and / or encourage better test coverage. The ease of using the generated specification file will also motivate users to write tests, which will improve the quality of the software project by reducing the chance of errors being introduced into the software project.

[0013] Figure 1 is a block diagram illustrating an example unit test development system 100 for exchanging data over a network. The unit test development system 100 includes at least one developer device 102 that hosts a plurality of software development applications, including a unit test system 104. The developer device 102 is communicatively coupled to any other instances of the developer device 102, a developer database 126, and a software development server system 106 via a network 108 (e.g., the Internet). The developer device 102 may also be able to utilize the locally hosted unit test system 104 using one or more application program interfaces (APIs).

[0014] The software development server system 106 provides server-side functionality to a particular developer device 102 via a network 108. Although certain functionality of the unit test development system 100 is described herein as being performed by either the developer device 102 or the software development server system 106, whether certain functionality is located within the developer device 102 or within the software development server system 106 may be a design choice. For example, it may be technically preferable to initially deploy certain technologies and functionality within the software development server system 106, but later migrate the technologies and functionality to the developer device 102, where the developer device 102 has sufficient processing power.

[0015] The software development server system 106 supports various services and operations provided to the developer device 102. Such operations include sending data to the developer device 102, receiving data from the developer device 102, and processing data generated by the developer device 102. The data may include code structure data, code syntax data, metadata, feature data, and test template data. The data exchange within the unit test development system 100 is stimulated and controlled by functions available via the user interface (UI) of the developer device 102.

[0016] Turning now specifically to the software development server system 106, an application program interface (API) server 112 is coupled to and provides a programming interface to the application server 110. The application server 110 is communicatively coupled to a database server 116, which facilitates access to a database 122 that stores data associated with messages processed by the application server 110. Similarly, a web server 124 is coupled to the application server 110 and provides a web-based interface to the application server 110. To this end, the web server 124 processes incoming network requests via, for example, the Hypertext Transfer Protocol (HTTP) and / or several other related protocols.

[0017] The application program interface (API) server 112 receives and sends data between the developer device 102 and the application server 110. Specifically, the application program interface (API) server 112 provides a set of interfaces (e.g., routines and protocols) that can be called or queried by the developer device 102 to activate the functions of the application server 110.

[0018] The application server 110 hosts a plurality of server applications and subsystems, including, for example, a code analysis server 114, a metadata extraction and feature classification system 118, and a template modification system 120. The code analysis server 114 implements a plurality of source code processing techniques and functions. In addition, given the hardware requirements of such processing, processor and memory intensive data processing may be performed by the code analysis server 114 on the server side.

[0019] The metadata extraction and feature classification 118 is configured to perform the extraction of metadata and / or features from source code, typically regarding information sent from or received at the code analysis server 114. The template modification system 120 supports modification of unit test templates based on the code analysis by the code analysis server 114, the extracted metadata, and the features classified from the metadata extraction and feature classification 118 process.

[0020] Returning to the developer device 102, the features and functions of the external resources (e.g., the unit test system 104 or the applet) are available to the user via the interface of the developer device 102. In this context, "external" refers to the fact that the unit test system 104 or the applet is outside the developer device 102. External resources are usually provided by a third party, but can also be provided by the creator or provider of the developer device 102. The developer device 102 receives a user selection of an option to launch or access the features of such external resources. For example, the external resource can be accessed by the unit test system 104 (e.g., "native application") installed on the developer device 102, or by a small-scale version (e.g., "applet") of the application hosted on the developer device 102 or away from the developer device 102. The small-scale version of the application includes a subset of the features and functions of the application (e.g., the full-scale, native version of the application), and is implemented using a markup language document. In addition to using a markup language document (e.g., *ml file), the applet can also include a scripting language (e.g., *js file or .json file) and a style sheet (e.g., *ss file).

[0021] Figure 2 is a block diagram illustrating various modules of the unit testing system 104 according to certain illustrative examples. The unit testing system 104 is shown to include a code analysis module 202, a metadata extraction module 204, a feature classification module 206, and a template modification module 208. The various modules of the unit testing system 104 are configured to communicate with each other (e.g., via a bus, shared memory, or switch). Any one or more of these modules can be implemented using one or more computer processors 412 (e.g., a set of processors provided by the developer device 102).

[0022] Any one or more of the described modules may be implemented using hardware alone (e.g., one or more of the computer processors 404 of a machine (e.g., machine 400)) or a combination of hardware and software. For example, any described module of the unit testing system 104 may physically include an arrangement of one or more computer processors 210 (e.g., a subset of one or more computer processors of a machine (e.g., machine 400) or one or more of the computer processors therein) configured to perform the operations described herein for the module. As another example, any module of the unit testing system 104 may include software, hardware, or both, which configures an arrangement of one or more computer processors 210 (e.g., in one or more computer processors of a machine (e.g., machine 400)) to perform the operations described herein for the module. Thus, different modules of the unit testing system 104 may include and configure different arrangements of such computer processors 210 or a single arrangement of such computer processors 210 at different points in time. Furthermore, any two or more modules of the unit testing system 104 may be combined into a single module, and the functionality described herein for a single module may be subdivided between multiple modules. Furthermore, according to various examples, modules described herein as being implemented within a single machine, database, or device may be distributed across multiple machines, databases, or devices.

[0023] In one example, the code analysis module 202 receives the source code and analyzes specific information about the source code. For example, the code analysis module 202 determines the specific style of the received source code. This is achieved by determining the grammatical pattern in the source code. It should be understood that one or both of the code analysis module 202 and the analysis server 114 can be configured to analyze specific information about the source code. In some cases, the code analysis module 202 performs some code analysis functions locally, and the code analysis server 114 is configured to analyze other specific information. According to various configurations, the code analysis module 202 queries the abstract syntax tree (AST) to determine the style of the source code. In one example, the cascading style sheet (CSS) style selector system is used to query the TypeScript AST to determine the grammatical pattern. The code analysis module 202 generates an output including, for example, an HTML style used by the metadata extraction module 202.

[0024] The metadata extraction module 204 is configured to extract relevant metadata for the source code based on the output from the code analysis module 202. The extracted metadata may include information about the project associated with the source code, any imported code, component definitions, component features (e.g., how functions are triggered internally within the component code), component dependencies, and component properties. It should be appreciated that one or both of the metadata extraction module 204 and the metadata extraction and feature classification system 118 may be configured to extract relevant metadata. In some cases, the metadata extraction module 204 performs some metadata extraction functions locally, while the metadata extraction and feature classification system 118 is configured to extract other relevant metadata.

[0025] The feature classification module 206 uses the metadata extracted from the metadata extraction module 204 to classify the features of the source code. For example, the feature classification module 206 uses component definitions and / or component attributes to classify the source code into alignments with various features. It should be understood that one or both of the feature classification module 206 and the metadata extraction and feature classification system 118 can be configured to extract relevant metadata. In some cases, the metadata extraction module 204 performs some feature classification functions locally, while the metadata extraction and feature classification system 118 is configured to classify other features. The metadata is broken down into different categories (e.g., component definitions and component dependencies), and the classification code analyzes the information from the appropriate categories and assigns classes to the source code. For example, based on the component definitions, the system can identify and distinguish between components, hooks, and / or utility functions.

[0026] The template modification module 208 uses the information collected from the code analysis module 202, the metadata extraction module 204, and the feature classification module 206 to update the template file to align with the current source code under test. It should be understood that one or both of the template modification module 208 and the template modification system 120 can be configured to modify the template file. In some cases, the template modification module 208 performs some template modification functions locally, while the template modification system 120 is configured to modify other parts of the template.

[0027] In one example, the template file is a static file, and the collected information is used to modify a separate instance of the template file for the current code under test. In some cases, the modified version of the template file is stored for future unit testing. According to various configurations, JsCodeShift is used to rewrite TypeScript and / or JavaScript code in static template files. For example, the template file is a template for a specification file and / or for a unit test script.

[0028] The template file may include code for running one or more unit tests. The template file may be modified by adding information related to the current unit under test. For example, the template file may be updated by adding relevant component definitions and relevant classification features in the style of the determined source code. It should be understood that the template file may be updated based on any relevant information related to the source code. The relevant information may vary between units and / or may be customized by one or more users of the template.

[0029] According to various configurations, the template modification process is customizable. For example, the process is defined by an instruction set that defines what code to insert, the specific time to insert the code, and / or where to insert the code based on the extracted metadata and feature classification process. According to various configurations, the template file can be configured to annotate the source code based on the function usage comments and / or descriptions contained in the source code. In some cases, the template can include generated code to perform test verification and / or test assertions.

[0030] Figure 3A A process for generating and modifying a template file according to embodiments described herein is shown. In block 302, the routine 300 identifies at least one unit of a software application. According to various embodiments, the at least one unit includes source code.

[0031] In block 304, routine 300 analyzes the source code to determine a particular style of source coding, as described above. In block 306, routine 300 extracts metadata from at least one unit based on the analyzed source code, also as described above. In one example, the metadata includes one or more imports of one or more software modules, component definitions, and features used by at least one unit. According to various configurations, the imports described herein may include modules that the source code depends on and / or additional test helper and / or utility modules to aid in testing.

[0032] In block 308, the routine 300 classifies one or more features of the extracted metadata. For example, classifying the features may include classifying one or more functions of at least one unit based on the extracted metadata, as described above.

[0033] In block 310, the routine 300 modifies the template file based on the extracted metadata and the classified features, as described above.One or more unit tests of the source code may be performed based on the modified template file.

[0034] According to various configurations, at least one grammatical pattern is determined in the source code. In this case, modifying the template file includes modifying the template file based on the at least one grammatical pattern. For example, when analyzing components, the components can be classified as non-attribute components and components with attributes. Another example is to analyze the definition of a function to identify whether it is a functional component compared to a general utility function.

[0035] The template file can be modified using a customizable process based on the extracted metadata. For example, the customizable process includes modifying source code at a predefined time period and / or at a predefined location within the template file. The predefined time period and / or predefined location can be customized by a user (e.g., a software developer and / or a tester). Figure 3B is an image of a sample modified template file.

[0036] Machine Architecture

[0037] Figure 4400 within which instructions 410 (e.g., software, programs, applications, applet, app, or other executable code) may be executed for causing the machine 400 to perform any one or more of the methods discussed herein. For example, the instructions 410 may cause the machine 400 to perform any one or more of the methods described herein. The instructions 410 convert a general purpose, unprogrammed machine 400 into a specific machine 400 that is programmed to perform the functions described and illustrated in the manner described. The machine 400 may operate as a standalone device or may be coupled (e.g., networked) to other machines. In a network deployment, the machine 400 may operate as a server machine or a client machine in a server-client network environment, or as a peer machine in a peer-to-peer (or distributed) network environment. The machine 400 may include, but is not limited to, a server computer, a client computer, a personal computer (PC), a tablet computer, a laptop computer, a netbook, a set-top box (STB), a personal digital assistant (PDA), an entertainment media system, a cellular phone, a smart phone, a mobile device, a wearable device (e.g., a smart watch), a smart home device (e.g., a smart appliance), other smart devices, a web appliance, a network router, a network switch, a network bridge, or any machine capable of sequentially or otherwise executing instructions 410 specifying actions to be taken by the machine 400. In addition, although only a single machine 400 is shown, the term "machine" should also be taken to include a collection of machines that individually or jointly execute instructions 410 to perform any one or more of the methods discussed herein. For example, the machine 400 may include any of the developer device 102 or a number of server devices that form part of the software development server system 106. In some examples, the machine 400 may also include both a client system and a server system, wherein certain operations of a particular method or algorithm are performed on the server side, and certain operations of the particular method or algorithm are performed on the client side.

[0038] The machine 400 may include a processor 404, a memory 406, and an input / output I / O component 402, which may be configured to communicate with each other via a bus 440. In an example, the processor 404 (e.g., a central processing unit (CPU), a reduced instruction set computing (RISC) processor, a complex instruction set computing (CISC) processor, a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a radio frequency integrated circuit (RFIC), another processor, or any suitable combination thereof) may include, for example, a processor 408 and a processor 412 that execute instructions 410. The term "processor" is intended to include multi-core processors, which may include two or more independent processors (sometimes referred to as "cores") that may execute instructions simultaneously. Although Figure 4 Multiple processors 404 are shown, but machine 400 may include a single processor with a single core, a single processor with multiple cores (e.g., a multi-core processor), multiple processors with a single core, multiple processors with multiple cores, or any combination thereof.

[0039] The memory 406 includes a main memory 414, a static memory 416, and a storage unit 418, which are all accessible by the processor 404 via the bus 440. The main memory 406, the static memory 416, and the storage unit 418 store instructions 410 that implement any one or more of the methods or functions described herein. The instructions 410 may also reside, completely or partially, within the main memory 414, within the static memory 416, within the machine-readable medium 420 within the storage unit 418, within at least one of the processors 404 (e.g., within a cache memory of a processor), or within any suitable combination thereof during execution thereof by the machine 400.

[0040] I / O components 402 may include various components that receive input, provide output, generate output, send information, exchange information, capture measurements, etc. The specific I / O components 402 included in a particular machine will depend on the type of machine. For example, a portable machine such as a mobile phone may include a touch input device or other such input mechanism, while a headless server machine will be less likely to include such a touch input device. It should be understood that I / O components 402 may include Figure 44. In various examples, the I / O components 402 may include a user output component 426 and a user input component 428. The user output component 426 may include a visual component (e.g., a display such as a plasma display panel (PDP), a light emitting diode (LED) display, a liquid crystal display (LCD), a projector, or a cathode ray tube (CRT)), an acoustic component (e.g., a speaker), a tactile component (e.g., a vibration motor, a resistance mechanism), other signal generators, etc. The user input component 428 may include an alphanumeric input component (e.g., a keyboard, a touch screen configured to receive alphanumeric input, an optical keyboard, or other alphanumeric input component), a point-based input component (e.g., a mouse, a touch pad, a trackball, a joystick, a motion sensor, or other pointing instrument), a tactile input component (e.g., a physical button, a touch screen or other tactile input component that provides location and force of a touch or touch gesture), an audio input component (e.g., a microphone), etc.

[0041] In other examples, the I / O component 402 may include a biometric component 430, a motion component 432, an environmental component 434, or a position component 436, as well as a wide range of other components. For example, the biometric component 430 includes components for detecting expressions (e.g., hand expressions, facial expressions, voice expressions, body postures, or eye tracking), measuring biosignals (e.g., blood pressure, heart rate, body temperature, sweat, or brain waves), identifying people (e.g., voice recognition, retinal recognition, facial recognition, fingerprint recognition, or EEG-based recognition), etc. The motion component 432 includes an acceleration sensor component (e.g., an accelerometer), a gravity sensor component, and a rotation sensor component (e.g., a gyroscope).

[0042] Environmental components 434 include, for example, one or more cameras (with still image / photo and video capabilities), lighting sensor components (e.g., a photometer), temperature sensor components (e.g., one or more thermometers that detect ambient temperature), humidity sensor components, pressure sensor components (e.g., a barometer), acoustic sensor components (e.g., one or more microphones that detect background noise), proximity sensor components (e.g., an infrared sensor that detects nearby objects), gas sensors (e.g., a gas detection sensor for detecting concentrations of hazardous gases for safety purposes or for measuring pollutants in the atmosphere), or other components that can provide indications, measurements, or signals corresponding to the surrounding physical environment.

[0043] With respect to cameras, the developer device 102 can have a camera system including, for example, a front-facing camera on a front surface of the developer device 102 and a rear-facing camera on a rear surface of the developer device 102. The front-facing camera can, for example, be used to capture still images and videos of a user of the developer device 102 (e.g., a "selfie"), which can then be enhanced with the enhancement data (e.g., filters) described above. The rear-facing camera can, for example, be used to capture still images and videos in a more traditional camera mode, where the images are similarly enhanced using the enhancement data. In addition to the front-facing camera and the rear-facing camera, the developer device 102 can also include a 360° camera for capturing 360° photos and videos.

[0044] Additionally, the camera system of the developer device 102 may include dual rear cameras (e.g., a main camera and a depth sensing camera), or even triple, quad, or quintuple rear camera configurations on the front and back sides of the developer device 102. For example, these multi-camera systems may include a wide-angle camera, an ultra-wide-angle camera, a telephoto camera, a macro camera, and a depth sensor.

[0045] The location component 436 includes a positioning sensor component (e.g., a GPS receiver component), an altitude sensor component (e.g., an altimeter or barometer that detects air pressure, from which the altitude can be obtained), an orientation sensor component (e.g., a magnetometer), etc.

[0046] A variety of technologies may be used to achieve communication. I / O components 402 also include communication components 438 that are operable to couple machine 400 to network 422 or device 424 via corresponding couplings or connections. For example, communication components 438 may include a network interface component or another suitable device that interfaces with network 422. In other examples, communication components 438 may include wired communication components, wireless communication components, cellular communication components, near field communication (NFC) components, Parts (e.g. Low energy consumption), Device 424 may be another machine or any of a variety of peripheral devices (eg, a peripheral device coupled via USB).

[0047] In addition, the communication component 438 can detect the identifier or include a component operable to detect the identifier. For example, the communication component 438 can include a radio frequency identification (RFID) tag reader component, an NFC smart tag detection component, an optical reader component (e.g., an optical sensor for detecting one-dimensional bar codes such as universal product codes (UPC) bar codes, multi-dimensional bar codes such as quick response (QR) codes, Aztec codes, data matrix, data symbols (Dataglyph), MaxiCode, PDF417, UltraCode, UCC RSS-2D bar codes, and other optical codes) or an acoustic detection component (e.g., a microphone for identifying an audio signal of a tag). In addition, various information can be obtained via the communication component 438, such as positioning obtained via Internet Protocol (IP) geolocation, Positioning derived from signal triangulation, positioning derived via detection of NFC beacon signals that can indicate a specific position, etc.

[0048] Various memories (e.g., main memory 414, static memory 416, and memory of processor 404) and storage unit 418 may store one or more sets of instructions and data structures (e.g., software) used by or implementing any one or more of the methods or functions described herein. When executed by processor 404, these instructions (e.g., instructions 410) cause various operations to implement the disclosed examples.

[0049] Instructions 410 may be sent or received via a network interface device (e.g., a network interface component included in communications component 438) using a transmission medium and using any of several well-known transmission protocols (e.g., Hypertext Transfer Protocol (HTTP)) over network 422. Similarly, instructions 410 may be sent or received via a coupling (e.g., a peer-to-peer coupling) to device 424 using a transmission medium.

[0050] Software Construction

[0051] Figure 5 500 is a block diagram illustrating a software architecture 504 that may be installed on any one or more of the devices described herein. The software architecture 504 is supported by hardware such as a machine 502 including a processor 520, a memory 526, and an I / O component 538. In this example, the software architecture 504 may be conceptualized as a stack of layers, where each layer provides specific functionality. The software architecture 504 includes layers such as an operating system 512, a library 510, a framework 508, and an application 506. In operation, the application 506 invokes an API call 550 through the software stack and receives a message 552 in response to the API call 550.

[0052] The operating system 512 manages hardware resources and provides public services. The operating system 512 includes, for example, a kernel 514, a service 516, and a driver 522. The kernel 514 serves as an abstraction layer between the hardware and other software layers. For example, the kernel 514 provides functions such as memory management, processor management (e.g., scheduling), component management, networking, and security settings. The service 516 can provide other public services to other software layers. The driver 522 is responsible for controlling the underlying hardware or interfacing with the underlying hardware. For example, the driver 522 may include a display driver, a camera driver, or Low-power drivers, Flash drivers, Serial communication drivers (e.g., USB drivers), Drivers, audio drivers, power management drivers, etc.

[0053] The library 510 provides a common low-level infrastructure used by the application 506. The library 510 may include a system library 518 (e.g., a C standard library) that provides functions such as memory allocation functions, string manipulation functions, mathematical functions, etc. In addition, the library 510 may include an API library 524, such as a media library (e.g., a library for supporting the presentation and manipulation of various media formats, such as Moving Picture Experts Group-4 (MPEG4), Advanced Video Coding (H.264 or AVC), Moving Picture Experts Group Layer-3 (MP3), Advanced Audio Coding (AAC), Adaptive Multi-Rate (AMR) audio codec, Joint Photographic Experts Group (JPEG or JPG), or Portable Network Graphics (PNG)), a graphics library (e.g., an OpenGL framework for presenting in two dimensions (2D) and three dimensions (3D) in graphical content on a display), a database library (e.g., SQLite providing various relational database functions), a web library (e.g., WebKit providing web browsing functions), etc. The library 510 may also include various other libraries 528 to provide many other APIs to the application 506.

[0054] The framework 508 provides a common high-level infrastructure used by the applications 506. For example, the framework 508 provides various graphical user interface (GUI) functions, high-level resource management, and high-level positioning services. The framework 508 can provide a wide range of other APIs that can be used by the applications 506, some of which can be specific to a particular operating system or platform.

[0055] In an example, applications 506 may include home applications 536, contact applications 530, browser applications 532, book reader applications 534, location applications 542, media applications 544, messaging applications 546, game applications 548, and a variety of other applications such as third-party applications 540. Applications 506 are programs that execute functions defined in the program. Various programming languages ​​may be used to create one or more of the applications 506 constructed in various ways, such as object-oriented programming languages ​​(e.g., Objective-C, Java, or C++) or procedural programming languages ​​(e.g., C or assembly language). In a specific example, third-party applications 540 (e.g., applications created by entities other than the vendor of a particular platform using ANDROID TM or IOS TM Software Development Kit (SDK) can be used for mobile operating systems, such as IOS TM ANDROID TM , Phone, or other mobile operating system running on the mobile software. In this example, the third party application 540 can activate the API call 550 provided by the operating system 512 to facilitate the functions described in this article.

[0056] Glossary

[0057] "Carrier signal" refers to any intangible medium that can store, encode or carry instructions for execution by a machine and includes digital or analog communications signals or other intangible media that facilitates communication of such instructions. Instructions may be sent or received over a network using a transmission medium via a network interface device.

[0058] "Client Device" refers to any machine that interfaces with a communications network to obtain resources from one or more server systems or other client devices. A client device may be, but is not limited to, a mobile phone, a desktop computer, a laptop computer, a portable digital assistant (PDA), a smart phone, a tablet computer, an ultrabook, a netbook, a laptop computer, a multiprocessor system, a microprocessor-based or programmable consumer electronics product, a game console, a set-top box, or any other communications device that a user may use to access a network.

[0059] "Communications network" means one or more parts of a network, which may be an ad hoc network, an intranet, an extranet, a virtual private network (VPN), a local area network (LAN), a wireless LAN (WLAN), a wide area network (WAN), a wireless WAN (WWAN), a metropolitan area network (MAN), the Internet, a part of the Internet, a part of the public switched telephone network (PSTN), a plain old telephone service (POTS) network, a cellular telephone network, a wireless network, A network, other type of network, or a combination of two or more such networks. For example, the network or a portion of the network may include a wireless network or a cellular network, and the coupling may be a code division multiple access (CDMA) connection, a global system for mobile communications (GSM) connection, or other type of cellular or wireless coupling. In this example, the coupling may implement any of various types of data transmission technologies, such as single carrier radio transmission technology (1xRTT), evolution data optimized (EVDO) technology, general packet radio service (GPRS) technology, enhanced data rate for GSM evolution (EDGE) technology, the third generation partnership project (3GPP) including 3G, fourth generation wireless (4G) network, universal mobile telecommunications system (UMTS), high speed packet access (HSPA), world wide interoperability for microwave access (WiMAX), long term evolution (LTE) standards, other data transmission technologies defined by various standard setting organizations, other long distance protocols, or other data transmission technologies.

[0060] "Component" refers to a device, a physical entity, or logic with boundaries defined by function or subroutine calls, branch points, APIs, or other techniques that provide partitioning or modularization for specific processing or control functions. Components can be combined with other components via their interfaces to perform machine processing. Components can be packaged functional hardware units designed for use with other components and can be part of a program that generally performs specific functions in related functions. Components can constitute software components (e.g., codes implemented on machine-readable media) or hardware components. "Hardware components" are tangible units that can perform certain operations and can be configured or arranged in a certain physical manner. In various examples, one or more computer systems (e.g., independent computer systems, client computer systems, or server computer systems) or one or more hardware components (e.g., processors or processor groups) of a computer system can be configured by software (e.g., applications or application parts) to perform hardware components that operate to perform certain operations described herein. Hardware components can also be implemented mechanically, electronically, or any suitable combination thereof. For example, a hardware component may include a dedicated circuit or logic that is permanently configured to perform certain operations. The hardware component may be a dedicated processor, such as a field programmable gate array (FPGA) or an application specific integrated circuit (ASIC). The hardware component may also include a programmable logic or circuit system that is temporarily configured to perform certain operations by software. For example, the hardware component may include software executed by a general-purpose processor or other programmable processor. Once configured by such software, the hardware component becomes a specific machine (or a specific component of a machine) that is uniquely customized to perform the configured function, and is no longer a general-purpose processor. It should be understood that it can be decided whether to mechanically implement the hardware component in a dedicated and permanently configured circuit or in a circuit temporarily configured (for example, configured by software) for cost and time considerations. Therefore, the phrase "hardware component" (or "hardware-implemented component") should be understood to include a tangible entity, that is, an entity that is physically constructed, permanently configured (for example, hardwired) or temporarily configured (for example, programmed) to operate in some way or perform certain operations described herein. Considering an example in which a hardware component is temporarily configured (for example, programmed), it is not necessary to configure or instantiate each of the hardware components at any time. For example, in the case where a hardware component includes a general-purpose processor that is configured by software to become a special-purpose processor, the general-purpose processor can be respectively configured as different special-purpose processors (e.g., including different hardware components) at different times. Software accordingly configures one or more specific processors to, for example, constitute a specific hardware component at one time, and to constitute different hardware components at different times. Hardware components can provide information to other hardware components and receive information from other hardware components. Accordingly, the described hardware components can be considered to be coupled in communication.In the case of multiple hardware components being present at the same time, communication can be achieved by signal transmission (e.g., by appropriate circuits and buses) between or among two or more hardware components. In examples where multiple hardware components are configured or instantiated at different times, communication between such hardware components can be achieved, for example, by storing information in a memory structure accessible to multiple hardware components and retrieving information in the memory structure. For example, a hardware component can perform an operation, and the output of the operation is stored in a memory device coupled to it in communication. Then, another hardware component can access the memory device at a subsequent time to retrieve the stored output and process it. The hardware component can also initiate communication with an input device or an output device, and can operate on resources (e.g., a collection of information). The various operations of the example methods described herein can be performed at least in part by one or more processors that are temporarily configured (e.g., by software) or permanently configured to perform related operations. Whether it is temporarily configured or permanently configured, such a processor can constitute a processor-implemented component that operates to perform one or more operations or functions described herein. As used herein, "processor-implemented components" refer to hardware components implemented using one or more processors. Similarly, the method described in this article can be implemented at least in part by a processor, wherein one or more specific processors are examples of hardware. For example, at least some of the operation of the method can be performed by one or more processors or the components implemented by the processor. In addition, one or more processors can also operate to support the execution of related operations in a "cloud computing" environment or as a "software as a service" (SaaS) operation. For example, at least some of the operations in the operation can be performed by a group of computers (as an example of a machine including a processor), wherein these operations can be accessed via a network (e.g., the Internet) and via one or more appropriate interfaces (e.g., API). The execution of some operations in the operation can be distributed between processors, can not only reside in a single machine, but also can be deployed across several machines. In some examples, a processor or a component implemented by a processor can be located in a single geographic location (e.g., in a home environment, an office environment, or a server cluster). In other examples, a processor or a component implemented by a processor can be distributed across several geographic locations.

[0061] "Computer-readable storage media" refers to both machine storage media and transmission media. Therefore, these terms include storage devices / media and carrier / modulated data signals. The terms "machine-readable medium", "computer-readable medium" and "device-readable medium" mean the same thing and can be used interchangeably in this disclosure.

[0062] "Transient messages" are messages that are accessible for a limited duration. Transient messages can be text, images, videos, etc. The access time for transient messages can be set by the sender of the message. Alternatively, the access time can be a default setting or a setting specified by the recipient. Regardless of the setting technique, the message is transient.

[0063] "Machine storage media" refers to a single or multiple storage devices and media (e.g., centralized or distributed databases, and associated caches and servers) that store executable instructions, routines, and data. Thus, the term should be considered to include, but is not limited to, solid-state memory and optical and magnetic media, including memory internal or external to the processor. Specific examples of machine storage media, computer storage media, and device storage media include: non-volatile memory, including, for example, semiconductor memory devices such as erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), FPGA, and flash memory devices; magnetic disks, such as internal hard disks and removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The terms "machine storage media", "device storage media", and "computer storage media" mean the same thing and may be used interchangeably in this disclosure. The terms "machine storage media", "computer storage media", and "device storage media" expressly exclude carrier waves, modulated data signals, and other such media (at least some of which are encompassed by the term "signal media").

[0064] “Non-transitory computer-readable storage medium” refers to tangible media capable of storing, encoding, or carrying instructions to be executed by a machine.

[0065] "Signal medium" refers to any intangible medium that is capable of storing, encoding or carrying instructions executed by a machine and includes digital or analog communication signals or other intangible media that facilitate the communication of software or data. The term "signal medium" should be deemed to include any form of modulated data signals, carrier waves, etc. The term "modulated data signal" refers to a signal that has one or more of its various characteristics set or changed in such a manner as to encode information in the signal. The terms "transmission medium" and "signal medium" mean the same thing and may be used interchangeably in this disclosure.

Claims

1. A method performed by a computing device, the method comprising: identifying at least one unit of a software application, the at least one unit comprising source code; analyzing source code of the at least one unit to determine a pattern of the source code; extracting metadata from the at least one unit based on analysis of the source code; classifying one or more characteristics of the extracted metadata; as well as The template file is modified based on the extracted metadata and the classified features to create a modified template file. 2 . The method of claim 1 , further comprising performing unit testing of the at least one unit based on the modified template file.

3. The method according to claim 1, wherein: The metadata includes one or more imports of one or more software modules, component definitions, and features used by the at least one unit.

4. The method of claim 1 , further comprising determining at least one grammatical pattern in the source code, and wherein: Modifying the template file includes modifying the template file based on the at least one grammatical pattern.

5. The method according to claim 1, wherein: Modifying the template file includes modifying the template file using a customizable process based on the metadata.

6. The method according to claim 1, wherein: Modifying the template file includes modifying the template file at one or more of a predefined time and a predefined location within the template file.

7. The method according to claim 6, wherein: One or both of the predefined time and the predefined location within the source code can be customized by a user.

8. The method according to claim 1, wherein: Classifying the one or more features of the extracted metadata includes classifying one or more functions of the at least one unit based on the extracted metadata.

9. A computing device, comprising: processor, and a memory storing instructions that, when executed by the processor, configure the apparatus to: identifying at least one unit of a software application, the at least one unit comprising source code; analyzing the source code of the at least one unit to determine a pattern of the source code; extracting metadata from the at least one unit based on analysis of the source code; classifying one or more characteristics of the extracted metadata; as well as The template file is modified based on the extracted metadata and the classified features to create a modified template file.

10. The computing device of claim 9, further comprising performing unit testing of the at least one unit based on the modified template file.

11. The computing device according to claim 9, wherein: The metadata includes one or more imports of one or more software modules, component definitions, and features used by the at least one unit.

12. The computing device of claim 9, further comprising determining at least one grammatical pattern in the source code, and wherein, Modifying the template file includes modifying the template file based on the at least one grammatical pattern.

13. The computing device of claim 9, wherein: Modifying the template file includes modifying the template file using a customizable process based on the extracted metadata.

14. The computing device of claim 9, wherein: Modifying the template file includes modifying the template file at one or more of a predefined time and a predefined location within the template file.

15. The computing device of claim 14, wherein: One or both of the predefined time and the predefined location within the source code may be customized by a user.

16. The computing device of claim 9, wherein: Classifying the one or more features of the extracted metadata includes classifying one or more functions of the at least one unit based on the extracted metadata.

17. A non-transitory computer-readable storage medium comprising instructions which, when processed by a computer, configure the computer to perform: identifying at least one unit of a software application, the at least one unit comprising source code; analyzing source code of the at least one unit to determine a pattern of the source code; extracting metadata from the at least one unit based on analysis of the source code; classifying one or more characteristics of the extracted metadata; as well as The template file is modified based on the extracted metadata and the classified features to create a modified template file.

18. The non-transitory computer-readable storage medium of claim 17, further comprising performing unit testing of the at least one unit based on the modified template file.

19. The non-transitory computer-readable storage medium of claim 17, wherein: The metadata includes one or more imports of one or more software modules, component definitions, and features used by the at least one unit.

20. The non-transitory computer-readable storage medium of claim 17, wherein: Classifying the one or more features of the extracted metadata includes classifying one or more functions of the at least one unit based on the extracted metadata.

Citation Information

Cited By

  • Contextual test code generation

    US12579053B2