Configuration file processing method, electronic equipment and readable storage medium

By comparing the differences in the configuration files of the test environment, the test environment configuration was optimized, which solved the problems of low testing efficiency and accuracy caused by the rapid pace of software and application updates, and enabled efficient parallel testing.

CN120803902AActive Publication Date: 2025-10-17HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410878653.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2025-10-17
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

With the rapid pace of software and application updates, existing technologies struggle to efficiently test different versions of target objects in parallel, resulting in low testing efficiency and inaccurate results.

Method used

By comparing the differences in configuration files between the two test environments, the test environment configuration was optimized. The configuration files were converted using YAML and JSON formats, the differences in key-value pair information were identified, the modification items were determined, and the test environment was updated.

Benefits of technology

This approach improves testing efficiency while ensuring testing accuracy, and ensures the accuracy of parallel test results for different versions of the target object on the same initial test target.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803902A_ABST
    Figure CN120803902A_ABST
Patent Text Reader

Abstract

The invention discloses a configuration file processing method, electronic equipment and a readable storage medium, and belongs to the technical field of computers. The method comprises the steps of obtaining a target configuration file in a first language format; the target configuration file comprises a first configuration file of a first test environment and a second configuration file of a second test environment; the first test environment is used for testing a first to-be-tested target, and the second test environment is used for testing a second to-be-tested target; converting the target configuration file in the first language format into a to-be-processed file in a second language format; the to-be-processed file comprises a first to-be-processed file and a second to-be-processed file; the to-be-processed file in the second language format comprises extractable key value pair information; and comparing the key value pair information of the first to-be-processed file with the key value pair information of the second to-be-processed file to obtain difference data of the first configuration file and the second configuration file. According to the embodiment of the invention, the operation efficiency of the target object can be controlled by correctly setting the configuration file.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a configuration file processing method, electronic equipment and readable storage medium. BACKGROUND

[0002] With the development of computer technology, the update speed of computer related products is also getting faster and faster. The function implementation of computer products cannot be separated from the support of various applications and software. In order to realize new functions, applications and software with new functions need to be used. At the same time, the running of target objects such as applications and software can be adjusted and controlled through configuration files. For example, in the case of a test environment, when the application and software are updated, the new version of the application or software needs to be tested in an environment simulating the real use scenario to determine whether the application or software can run normally after being released. Because the software and application update at a fast speed, the testing efficiency of the new version of the software or application needs to be improved. The configuration file of the test environment can adjust the running of the software and application in the test environment, and reasonable setting of the configuration file of the test environment is helpful to efficient testing of the software and application. SUMMARY

[0003] The present application provides a configuration file processing method, electronic equipment and readable storage medium, which can help to control the running efficiency of target objects by correctly setting configuration files. The technical solutions are as follows:

[0004] In a first aspect, the present application provides a configuration file processing method, comprising: obtaining a target configuration file in a first language format; the target configuration file comprises a first configuration file of a first target object and a second configuration file of a second target object; converting the target configuration file in the first language format into a to-be-processed file in a second language format; the to-be-processed file comprises a first to-be-processed file converted from the first configuration file and a second to-be-processed file converted from the second configuration file; the to-be-processed file in the second language format comprises extractable key-value pair information; the key-value pair information in the to-be-processed file in the second language format corresponds to the key-value pair information in the target configuration file; the key-value pair information is used to record configuration items in a test environment and the configuration of the configuration items; comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file to obtain difference data of the first configuration file and the second configuration file; the difference data is used to determine the configuration setting mode of the first target object and the second target object.

[0005] In the embodiments of the present application, the configuration file can be used to configure various target objects. The target object can be, for example, a program, a software system, an application, an interface, a server, a database, or a system containing an information receiving device and an information sending device. Through the configuration file, the running process of the target object can be controlled and modified. For example, the configuration file for an application can modify the network address of the application, the mode of automatic joining, the network speed, the applicable file format, the supported network type, and the permission, etc. There can be a large number of configuration items in the configuration file, and a configuration item can also correspond to multiple parameters. For the configuration files of different target objects such as applications, determining the difference data therein helps to reasonably adjust the configuration setting mode of the target object, for example, the running of an online platform can be adjusted by modifying the configuration file. Further, the method provided in the embodiments of the present application helps the target object to better play its role.

[0006] The first target object is a first test environment, and the second target object is a second test environment; the first test environment is used to test a first to-be-tested target, and the second test environment is used to test a second to-be-tested target.

[0007] Since the to-be-tested targets can need to be tested simultaneously due to the fast version update speed and other reasons, two or more test environments can be used to test different versions of the to-be-tested targets in parallel when the to-be-tested targets are iteratively tested. When each test environment tests the to-be-tested target, the to-be-tested target can change in the testing process. After the first to-be-tested target and the second to-be-tested target are tested using two test environments, the configuration data in the two test environments changes. By comparing the configuration data in the two test environments, difference data is obtained, and at least one of the two test environments can be modified according to the difference data, and then the first to-be-tested target and the second to-be-tested target are re-evaluated using the modified test environment, thereby helping to consider more comprehensive factors, optimize the configuration environment, and obtain more accurate test results about the to-be-tested target. Thus, by using the method provided in the embodiments of the present application, different versions of the same initial to-be-tested target can be tested in parallel using different test environments, and accurate test results can also be obtained, thereby allowing different to-be-tested targets to be tested in parallel, and helping to improve the test efficiency while ensuring the accuracy of the test.

[0008] In an implementation, the comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file to obtain the difference data of the first configuration file and the second configuration file comprises: comparing the first to-be-processed file with the second to-be-processed file to determine first difference data of the first to-be-processed file relative to the second to-be-processed file; comparing the second to-be-processed file with the first to-be-processed file to determine second difference data of the second to-be-processed file relative to the first to-be-processed file; and converting the first difference data and the second difference data into the first language format to obtain the difference data of the first configuration file and the second configuration file.

[0009] The first to-be-processed file and the second to-be-processed file are taken as references respectively to obtain corresponding difference data, which is then integrated into the difference data of the first configuration file and the second configuration file, so that the difference points in the first configuration file and the second configuration file can be determined more comprehensively and completely, and the configuration of the target object can be optimized comprehensively according to the complete difference points. In the case where the target object is a test environment, the accuracy of a test result can be ensured.

[0010] In an implementation, the key-value pair information comprises keys and values; and the comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file comprises: determining a target file and a reference file, the target file being one of the first to-be-processed file and the second to-be-processed file, and the reference file being the other of the first to-be-processed file and the second to-be-processed file; comparing each target key with each reference key, the target key being a key in the target file, and the reference key being a key in the reference file corresponding to the target key in sequence; and recording the target key in the difference data in the case where the target key does not exist in the reference key.

[0011] In some common language format conversion of configuration files, a key has uniqueness, and a value corresponding to the key can exist in multiple. In the embodiment of the present application, the keys in the to-be-processed files are matched first, and in the case where the keys are different, it is not necessary to determine whether the values are the same, which simplifies the amount of information to be compared and improves the comparison efficiency.

[0012] In an implementation, the configuration file processing method further comprises: in the case where the target key exists in the reference key, comparing the type of the value of the target key with the type of the value of a matching key, the matching key being the same reference key as the target key; and recording the target key in the difference data in the case where the types are different.

[0013] Since in some common data exchange formats of configuration files, there can be multiple values corresponding to a key, the number of comparison operations can be increased when comparing the value of the target key with the value of the reference key one by one or comparing the value of the target key with the value of the matching key one by one. By judging whether the types of the values are the same, the key-value pair information with the same matching key and different value types is filtered out, which can accurately find the inconsistent key-value pair information and reduce the data to be compared, thereby improving the comparison efficiency.

[0014] In an embodiment, the configuration file processing method further comprises: in the case that the types are the same and the types represent that the corresponding value includes at least one key, taking the at least one key included in the corresponding value as a new target key and taking the key included in the value corresponding to the matching key as a new reference key, returning to the step of comparing the target key with the reference key.

[0015] In the embodiment, the complex value is compared in a loop, which can sufficiently compare the content included in the value and obtain accurate difference data.

[0016] In an embodiment, the configuration file processing method further comprises: before recording the target key in the difference data, recording the target key in a current comparison list; after recording the target key in the difference data, removing the target key from the current comparison list; in the case that the target key is the last key included in the value corresponding to the other key, removing the last key in the current comparison list after removing the target key from the current comparison list.

[0017] In the embodiment, the current comparison list is equivalent to a temporary list and is used to record the key-value pair information being compared, when a key-value pair information is being matched with other key-value pair information, the corresponding key is recorded in the current comparison list, so that the comparison situation is updated in real time, and repeated comparison or omission of key-value pair information in the comparison process is avoided.

[0018] In an embodiment, in the case that the types represent that the corresponding value includes at least one key, the types are dictionary types, set types or list types.

[0019] The method provided in the embodiment can compare the values of the dictionary types, set types and list types by comparing the keys included in the values and then further comparing the values included in the values, thereby improving the comparison efficiency of the values of this type of complex types.

[0020] In an implementation, before the comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file to obtain the difference data of the first configuration file and the second configuration file, the method further includes: receiving an ordering comparison instruction; the ordering comparison instruction is used to indicate that the order of a list type value in the to-be-processed file is not compared; and the list type value is ordered according to a preset rule, and the ordered list type value is used to replace the list type value before ordering.

[0021] By the above method, when the list type value is compared, the order factor can be selected not to be considered, and flexible selection is provided for the comparison of the configuration file.

[0022] In an implementation, the ordering the value containing order information in the to-be-processed file according to the preset rule includes: classifying elements contained in the list type value to obtain multiple classifications of the value containing order information; ordering the value contained in each classification according to a preset first ordering rule; and ordering the ordered classifications according to a preset second ordering rule to obtain an ordered first to-be-processed file and an ordered second to-be-processed file.

[0023] By the above method, the elements contained in each classification can be ordered, so that the original order of the elements is disturbed, the order of the same elements is unified, and the original order factor between the elements is excluded when the elements are compared, and only the values contained in the elements are compared.

[0024] In an implementation, the second language format is a JSON format, and the multiple classifications include a string, an array, an integer, a dictionary type, and a list type.

[0025] In the JSON format, the key-value pair information can be recorded in a simple and clear manner. By dividing the values in the key-value pair information in the JSON format into multiple formats, the multiple values can be ordered under the classification, and the problem of inconsistent ordering rules caused by different ordering methods of the values in different classifications is avoided.

[0026] In an implementation, the configuration file processing method further includes: determining a modification item and corresponding modification content according to the difference data; modifying the modification item in the first configuration file and the second configuration file into the corresponding modification content to obtain an updated first configuration file and an updated second configuration file; and updating a first test environment according to the updated first configuration file and updating a second test environment according to the updated second configuration file.

[0027] In the embodiments of the present application, first, in the difference data, the configuration and the modification content for modifying the test environment are determined, then the configuration of the test environment is modified and updated, the efficiency of the test environment maintenance is improved, and the different configurations of the test environment are aligned, so as to be better applied to the parallel test of the different versions of the same initial version of the to-be-tested target.

[0028] In an implementation manner, the first language format is YAML format, and the second language format is JSON format.

[0029] The YAML record configuration file is adopted, which helps the operator to debug the operation of the target object by debugging the configuration file in the process of using the target object. The JSON format is adopted as the format of the to-be-processed file, which helps to comprehensively, fully and accurately compare the key-value pairs, so as to quickly determine the difference data between the target configuration files.

[0030] In an implementation manner, the target configuration file includes annotation data of the key-value pair information; the to-be-processed file includes the annotation information and a key path of the annotation information in the to-be-processed file; and the method further includes: supplementing the annotation information to the key-value pair information corresponding to the difference data according to the key path.

[0031] Since YAML is adopted as the first language format in the embodiments of the present application, the configuration can be explained by the annotation data, which further facilitates the deployment of the tester in the test process. After obtaining the difference data of the to-be-processed file, the difference data of the to-be-processed file is converted back to the YAML format, and the annotation data is supplemented in the difference data, so as to help the relevant operator to understand the difference data, and further more accurately determine how to change the configuration of the test environment.

[0032] In a second aspect, the embodiments of the present application provide an electronic device, which includes a processor and a memory.

[0033] The memory is used to store a program for the electronic device to execute the method provided in any embodiment of the present application, and store data involved in the method provided in any embodiment of the present application.

[0034] The processor is configured to execute the program stored in the memory.

[0035] Optionally, the processor is one or more, and the memory is one or more.

[0036] Optionally, the memory can be integrated with the processor, or the memory is arranged separately from the processor.

[0037] The processing device in the second aspect can be a chip, and the processor can be implemented by hardware or software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, or the like. When implemented by software, the processor can be a general-purpose processor, and the processor can be implemented by reading software code stored in a memory. The memory can be integrated in the processor or exist independently of the processor.

[0038] In the implementation process, the memory can be a non-transitory memory, for example, a read only memory (ROM), which can be integrated on the same chip as the processor or arranged on different chips. The type of the memory and the arrangement of the memory and the processor are not limited in the application.

[0039] In the third aspect, the embodiments of the application provide a computer readable storage medium, and the computer readable storage medium stores instructions. When the instructions stored in the computer readable storage medium are executed on a computer, the computer can execute the method in the first aspect.

[0040] In the fourth aspect, the embodiments of the application provide a computer program product. When the computer program product is executed on a computer, the computer can execute the method in any possible implementation manner of the first aspect.

[0041] In the fifth aspect, the embodiments of the application further provide a processor. The processor includes an input circuit, an output circuit, and a processing circuit. The processing circuit is configured to receive a signal through the input circuit and transmit a signal through the output circuit, so that the processor executes the method in any embodiment of the first aspect.

[0042] In the implementation process, the processor can be a chip, the input circuit can be an input pin, the output circuit can be an output pin, and the processing circuit can be a transistor, a gate circuit, a flip-flop, and various logic circuits. The input signal received by the input circuit can be received and input by, for example but not limited to, a receiver, the output signal output by the output circuit can be output to and transmitted by, for example but not limited to, a transmitter, and the input circuit and the output circuit can be the same circuit, which is used as the input circuit and the output circuit at different times. The specific implementation of the processor and various circuits is not limited in the application.

[0043] The technical effects obtained by the second aspect, the third aspect, the fourth aspect, and the fifth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and details are not repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1AAn application scenario of an embodiment of the present application;

[0045] Figure 1A A test environment of an embodiment of the present application;

[0046] Figure 2 Another application scenario of an embodiment of the present application;

[0047] Figure 3A A method flowchart provided by an embodiment of the present application;

[0048] Figure 3B A configuration file processing flowchart provided by another embodiment of the present application;

[0049] Figures 4A-4C Another application scenario of the present application;

[0050] Figure 5 A configuration file processing flowchart in an example of the present application;

[0051] Figure 6 A configuration file format conversion flowchart in an example of the present application;

[0052] Figure 7 A sorting method flowchart in an example of the present application;

[0053] Figure 8 A key-value pair information comparison flowchart in an example of the present application;

[0054] Figure 9 A process of supplementing annotations for difference data in an example of the present application;

[0055] Figure 10 A file processing flowchart in an example of the present application;

[0056] Figure 11 A configuration file processing flowchart in another example of the present application;

[0057] Figure 12 A configuration file processing device flowchart provided by an embodiment of the present application;

[0058] Figure 13 A system architecture that a test environment in an embodiment of the present application can include;

[0059] Figure 14 A structure of an electronic device that a test environment in an embodiment of the present application can include. DETAILED DESCRIPTION

[0060] In order to make the objects, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0061] It should be understood that the "multiple" mentioned in the present application refers to two or more than two. In the description of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" in the present application only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. In addition, in order to clearly describe the technical solutions of the present application, the same items or similar items with basically the same functions and effects are distinguished by using "first", "second", etc. The skilled in the art can understand that "first", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. also do not necessarily mean different.

[0062] In the present application, the description of "one embodiment", "an embodiment", "an implementation", "some implementations" or "some embodiments" and the like means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in additional some embodiments", "exemplary", "as an example" or "in a possible implementation" and the like appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "configured to", "have" and their variants mean "include but are not limited to", unless otherwise specifically emphasized.

[0063] The electronic device can include terminals and servers. The terminals can include mobile terminals and fixed terminals, and the mobile terminals can include laptops, tablets, mobile phones, palmtop computers, smart wearable devices, electronic calendars, and electronic readers, etc. The fixed terminals can include desktop computers, or smart furniture, etc. The electronic device has been combined with all aspects of people's daily life in today's life, and is called an integral part of people's life. Software, applications or operating systems are used to support the functions of electronic devices, process user instructions in combination with electronic devices, and provide users with the data they need, such as text, images, audio or video, etc. Most software, applications or operating systems are updated in a partial update manner when they are updated. After the initial software, application or operating system is launched, it will be modified based on the use of the software, application or operating system, new functions will be added on the basis of the original functions, patches in the initial version will be corrected, or the original functions will be improved, thereby generating a new version after the initial version. At the same time, the improvement of the hardware of the electronic device itself will also lead to the emergence of a new version of the software, application or operating system to adapt to the improved hardware structure of the electronic device.

[0064] Figure 1A is an application scenario of an embodiment of the present application. In the application scenario shown in Figure 1A In the application scenario shown in FIG. 1, the target object is a test environment, and the test environment is used to test the target to be tested. The target to be tested can include a new version of an operating system, a new version of an application, a new version of software, an initial version of a new operating system, an initial version of a new application, an initial version of a new software, a document or data, etc. Generally, the target to be tested may need to be tested frequently during the development process of the target to be tested. Before the target to be tested is publicly released to users, the production and development party of the target to be tested deploys the target to be tested in a test environment, and the test environment can be constructed by simulating an actual use environment. As shown in Figure 1A In the test environment of the target to be tested, the server 101, the network device 102, the client 103 and the storage device 104 can be included.

[0065] The server 101 can be provided with server-side data and tools for running the target to be tested, such as: a network response module for user operation, a module for building a specified network connection for a user, a module for providing service data to a user, a receiving module for data sent by a user, a storage module for data sent by a user, and a forwarding module for data sent by a user, etc. The server 101 can include a high-performance central processing unit (CPU), such as a multi-core, multi-thread processor, and can also include sufficient memory space for processing simulated multi-user requests when simulating high-concurrency user requests.

[0066] Taking an updated version of a social application as an example, the server 101 needs to configure a receiving module of user-sent data, for receiving the social interaction data sent by the user; a forwarding module of user-sent data, for forwarding the social interaction data sent by the user to the client where the other user is located; a module for building a specified network connection for the user, for establishing a network connection between the user and the social account of the other user after receiving the instant communication request sent by the user; a network response module for user operation, for sending the social interaction information to the client of the user after receiving the operation of the user receiving the social interaction information; and a module for providing service data to the user, for positioning and other operations according to the instructions of the user.

[0067] The network device 102 can be used to connect the server 101 and the client 103 through wired and / or wireless means. The network device 102 can include one or more of a switch, a router, a firewall, a bridge, a hub, a gateway, a network interface card, a wireless access point, a modem, and a fiber transceiver. The network device 102 can have a high maximum data bandwidth to simulate the network data transmission process in the actual multi-user concurrent scenario.

[0068] The client 103 can be any electronic device in the embodiments of the present application. The client 103 can use an electronic device as a client in an actual application, or can use a physical machine, a virtual machine, or a cloud host to simulate the operation of a client. The client 103 also includes software or hardware configurations compatible with the target to be tested. Or the client 103 includes a target configuration that is part of the target to be tested, and the compatibility of the target configuration with other parts of the target to be tested during the test is also part of the test target. At the same time, the client 103 can also include a quantity expansion module to simulate the operation information of at least one client, and when necessary, to simulate the operation information of multiple parallel clients.

[0069] The storage device 104 can have a large storage space and can be used to save historical test data, test data to be tested, or configuration files, etc. In addition, the storage device 104 can also have a corresponding interface to ensure the reliability and performance of data access and management. The storage device 104 can be connected with other network devices to obtain necessary data for testing from other network devices. For example, before testing, other network devices can be used to collect or generate test samples, and the obtained test samples can be input into the storage device 104 for simulation of the simulation running of the target to be tested.

[0070] Figure 1A The test environment shown can be built for the server side, and the client can call the target to be tested through a remote access manner Figure 1AThe test environment (i.e., an online test platform) shown tests a to-be-tested target, such as a code, software, application, or data, locally to the client.

[0071] New functions of electronic devices depend on systems, applications, or software to be implemented, and users can have different needs for functions of electronic devices at different time nodes, or even in a short time period, the needs of users for a function of an electronic device can change greatly. For example, during a holiday, due to promotion or temporary work, the needs of users for consumption, entertainment, interaction, or outing using an electronic device change greatly. For another example, due to the occurrence of some well-known or important events (such as a match), the attention of users to event-related information greatly increases. Therefore, a developer can need to release different new versions of to-be-tested targets in a short time. Meanwhile, for the same needs of users, the developer can generate two or more different new versions of to-be-tested targets, in which case, the developer needs to test more new versions of to-be-tested targets in a short time.

[0072] Therefore, in some embodiments of the present application, two or more test systems can be used to test two or more to-be-tested targets respectively. For example, Figure 1B As shown, when testing different new versions of to-be-tested targets, the developer can use two or more test systems that can be parallel, each of which has an independent test environment, such as the first test environment ENV1 and the second test environment ENV2 in Figure 1B . In this way, the overall test efficiency of to-be-tested targets can be improved. Assuming that the developer has two different new versions of to-be-tested targets and needs to determine a final release version from the two different new versions of to-be-tested targets, if the developer uses ENV1 to test one new version of to-be-tested targets and uses ENV2 to test the other new version of to-be-tested targets at the same time, theoretically, about half of the time can be saved compared with using one test system to test the two new versions of to-be-tested targets in sequence. Meanwhile, since the two different new versions of to-be-tested targets are new versions of the same application, software, or system to-be-tested target, the two test systems and the corresponding test environments should use the same configuration to accurately compare the test effects of the two different new versions of to-be-tested targets.

[0073] However, during the test process, if a to-be-tested target has a vulnerability or the like, the developer can adjust the to-be-tested target, and accordingly, the configuration in the test environment can be adjusted according to some conditions in the test process, so that the configurations of the two test environments used to test different versions of to-be-tested targets are different. For example, Figure 1BThe configuration files of ENV1 and ENV2 shown in the are the same when the target to be tested is not tested in the corresponding environment, and both are version V1. During the testing process, since the two different new versions of the target to be tested have changed, the configuration of the test environment may also be debugged to determine whether the target to be tested has a test failure due to a configuration problem in the test environment. After the test is completed, the configuration file of ENV1 becomes version V2, and the configuration file of ENV2 becomes version V1SP. Then, after completing the testing of the two different new versions of the target to be tested, there may be differences between the configuration files of ENV1 and ENV2. In order to continue using the two test environments to test other new versions of the target to be tested, the configuration differences in the two test environments can be determined to ensure that when the target to be tested is subsequently tested, the same initial test environment is provided for different or the same targets to be tested.

[0074] Figure 1B The scenario shown above of using two or more test environments for testing can be applied not only to different versions of the target under test, but also to testing different phases, modules, or patch versions of the same target under test. Generally, the configuration files in the test environments are likely written in the same language.

[0075] Figure 2 Another scenario diagram to which the embodiment of the present application can be applied is shown. The user uses the first test environment and the second test environment to test the first target to be tested and the second target to be tested, respectively. The initial configurations of the first test environment and the second test environment can be the same, or the difference between the initial configurations of the first test environment and the second test environment is known. After at least one test environment completes the test of the target to be tested, the configuration files of the first test environment and the second test environment are obtained. Among them, the first test environment and the second test environment can both adopt the following configurations: Figure 1A as shown, or including Figure 1A The user can access the corresponding interface provided by the server 202 through the terminal 201 to submit the obtained configuration file to the server 202. The server 202 determines the difference data between the two test environments based on the two configuration files and sends the difference data to the terminal 201.

[0076] Apart from Figure 2 In addition to the scenario shown, a processing module for comparing configuration files can also be configured on the user's terminal. After obtaining configuration files in different test environments via wired or wireless means, the user's terminal can run the processing module locally on the terminal to determine the difference data in the configuration files.

[0077] Apart from Figures 1A-2In addition to the above scenarios and similar related scenarios, the configuration file processing method provided by the embodiments of the present application can also be applied to other related scenarios, which are not listed one by one here.

[0078] In Figures 1A-2 Based on the above scenarios, the specific implementation of the configuration file processing method provided by the embodiments of the present application will be introduced next. Figure 3A FIG. 1 is a flow diagram of a configuration file processing method according to an example embodiment. The method can be implemented by a plurality of modules of an electronic device involved in the embodiments of the present application. The method can include at least a part or all of the contents related to the following steps S31-S34. Steps S31-S34 can be performed by a server or a user device.

[0079] Step S31: Obtain a target configuration file in a first language format; the target configuration file includes a first configuration file of a first target object and a second configuration file of a second target object.

[0080] Step S31 can further include: obtaining, by the server, the target configuration file in the first language format according to an instruction of user input data.

[0081] The target object can be an object that can be behaviorally controlled by a configuration file, which can be a software object or a hardware object, or a combination of a software object and a hardware object. For example, the target object can include various categories, such as: an operating system, an application, a software, an electronic device, a system composed of electronic devices, an application programming interface (API), a large language model, an online data processing platform, or a database of a computer product. Among them, the first target object and the second target object can be of the same category, such as the same program, the same application, the same system, or the same platform. The first target object and the second target object can also be target objects of different categories, such as the first target object being an application and the second target object being an electronic device.

[0082] The first language format is the original format of the configuration file of the first target object and the original format of the configuration file of the second target object.

[0083] In a possible implementation, the first target object is a first test environment, and the second target object is a second test environment. The first test environment is used to test a first to-be-tested target, and the second test environment is used to test a second to-be-tested target. Correspondingly, the first language format is a language format originally used by a configuration file in a test environment of a to-be-tested target. The target configuration file can include two or more configuration files that need to be processed. To determine a possible change of a configuration file of a test environment, at least two target configuration files can be compared to determine differences therebetween. Different files included in the target configuration files can correspond to different test environments. Meanwhile, to determine configuration differences between other target objects, such as two applications, two systems, two online platforms, or two software, different files included in the target configuration files correspond to different target objects. The target configuration files can be obtained in different manners, for example, one configuration file is obtained by transmitting an external device, and another configuration file is obtained by receiving network data.

[0084] The test environment can be a combination of software, hardware, and network used to test the to-be-tested target. For example, if the to-be-tested target is a camera application, the test environment can include a camera, a camera driver, an operating system running the camera driver, a server providing network data of the camera application, a network device simulating a communication network between the server and a client, or a network device simulating a wireless local area network between the server and the client, or an equivalent module capable of providing the foregoing functions.

[0085] For a test environment, a configuration file corresponding to the test environment contains various parameters and settings, which define specific behaviors and conditions of the test. The configuration file allows a developer to separate configuration information of the to-be-tested target during testing from the code itself of the to-be-tested target during running, so that the developer can change behaviors of the to-be-tested target or adapt to different environments by modifying the configuration file without modifying the code of the to-be-tested target. During testing, the configuration file can be used to define a test environment, test data, and test parameters, thereby providing a flexible way to change behaviors and parameters of the to-be-tested target during testing, such as function switches, performance adjustments, and log recording. In addition, the configuration file can be used to save some test information related to security (such as a secret key), and by appropriately managing the test information related to security and security, it is helpful to prevent the test information related to security from being leaked.

[0086] In the embodiments of the present application, in the case that the target object is a test environment, the to-be-tested target can also be referred to as a tested object, and the to-be-tested target can include programs, applications, software, operating systems, files, interfaces, databases, data, and the like. The first to-be-tested target and the second to-be-tested target can include at least one of the following implementation manners.

[0087] (1) Two completely different to-be-tested targets capable of being tested in the same configured test environment. For example, different software with the same function, software and operating systems, applications and programs, different files, or different software capable of running in the same system, and the like.

[0088] (2) Different versions formed after partial modification based on the same initial to-be-tested target. For example, the first to-be-tested target is obtained by modifying the first part of the initial software, and the second to-be-tested target is obtained by adding new functions to the initial software.

[0089] (3) An initial to-be-tested target and a version formed after partial modification of the initial to-be-tested target. For example, an initial version of an application and a version formed after partial modification of the initial version of the application.

[0090] (4) Any version of a to-be-tested target and a reference version of the to-be-tested target. For example, for a to-be-tested file, a reference version can be set as a first file, and other versions are all referenced to the first file, and the to-be-tested file of the other versions is a second to-be-tested target.

[0091] (5) Any two unrelated to-be-tested targets. The configuration file processing method provided in the embodiments of the present application can be used to compare any two configuration files in need of comparison, regardless of whether the test environments corresponding to the two configuration files are used to test the same series of to-be-tested targets.

[0092] (6) Versions formed after different test stages of the same to-be-tested target. In the process of testing, an operator can modify the to-be-tested target according to the progress of the test process. For example, the first to-be-tested target becomes the second to-be-tested target after being tested in ENV1. ENV2 does not test any to-be-tested target, and therefore, ENV2 does not change the first to-be-tested target, and the version corresponding to ENV2 is the first to-be-tested target.

[0093] (7) Different parts of the same to-be-tested target.

[0094] In a possible implementation, the first test environment is used for testing the first target to be tested, which can mean that the first test environment has tested the first target to be tested, or can mean that the first test environment plans to test the first target to be tested at a future time point, and when step S31 is performed, the test on the first target to be tested is not completed. Similarly, the second test environment used for testing the second target to be tested can include the case that the second test environment has not tested the second target to be tested, has completed the test on the second target to be tested, or has tested part of the second target to be tested.

[0095] In other possible implementations, the configuration file of the target object can include some optional items that define or limit the target object and the selection corresponding to the optional items. The optional items can also be referred to as configuration items, and the selection corresponding to the optional items can be a configuration or a parameter.

[0096] For example, for the case that the target object is a program, the configuration file can be used to configure the optional items of hardware or software in the environment running the program, which can specifically include: a called function library, a called processor model, a compiler type, and a default program language, and the like.

[0097] For example, for the case that the target object is an application, the configuration file can be used to configure the default audio and video data playing parameters of the application runtime, the default mode of the display interface, the way of online data acquisition, and the shortcut key support type, and the like.

[0098] For example, for the case that the target object is an office software, the configuration file can be used to configure whether the office software supports compression, the way of displaying pictures, the way of encryption, the supported language types, and the system type of application, and the like.

[0099] For example, for the case that the target object is a cloud computing service, the configuration file can be used to configure the network of cloud computing, the supported software version and type, the called resource pool, the data transmission speed, the load balancing mode, the parallel computing strategy, the maximum number of parallel computing, and backup, and the like.

[0100] In the embodiment of the application, when the server side performs step S31, at least one of the first configuration file and the second configuration file can be obtained according to the file transmitted by the user from the server locally or remotely.

[0101] In the embodiment of the application, the client side can perform step S31, and the client side obtains at least one of the first configuration file and the second configuration file locally, or receives the first configuration file or the second configuration file transmitted by the server side remotely.

[0102] Step S32: converting the target configuration file in the first language format into a to-be-processed file in a second language format; the to-be-processed file includes a first to-be-processed file converted from the first configuration file and a second to-be-processed file converted from the second configuration file; the to-be-processed file in the second language format includes extractable key-value pair information; the key-value pair information in the to-be-processed file in the second language format corresponds to the key-value pair information in the target configuration file; and the key-value pair information is used to record configuration items in a test environment and configurations of the configuration items.

[0103] Step S32 can be executed by a server side or a client side configured with an execution module, can be executed by other server sides called by the server side, or can be executed by server sides called by the client side.

[0104] In a possible implementation, the step of converting the target configuration file in the first language format into the to-be-processed file in the second language format can include converting the first configuration file into the first to-be-processed file and converting the second configuration file into the second to-be-processed file.

[0105] In step S32, the target configuration file is converted in language format to obtain the to-be-processed file, and the configuration items and specific parameters in the target configuration file do not change, but the recording manner of the configuration items and the specific parameters changes.

[0106] In the embodiment of the present application, the language format can also be referred to as a data exchange format, which is an information expression specification (or standard information expression manner) adopted for data transmission between different systems, different computer languages, different programs, different modules or different devices. The language format can be used to define the structure and representation manner of data in the transmission and exchange process, so as to make the data compatible and consistent between different systems or platforms.

[0107] The language formats can include extensible markup language (XML), JavaScript object notation (JSON), yaml ain't markup language (YAML), hyper text makeup language (HTML), specification and description language (SDL), and initialization file (INI). The first language format can be one of the aforementioned language formats, and the second language format can be another of the aforementioned language formats. The first language format and the second language format are different language formats.

[0108] In addition to converting the configuration file in the same language format into the second language format for comparison, the embodiments of the present application can also convert configuration files in different language formats into the second language format, and then compare the configurations.

[0109] The first language format used for the target configuration file, wherein the configuration item and the specific parameter can be represented by key value pair information, and the key value pair information includes a key and a value. The key can correspond to the configuration item, and the value can correspond to the specific parameter of the configuration item (also referred to as the configuration of the configuration item).

[0110] In the first language format, the difficulty of directly reading the key value pair information is higher than that in the second language format. The difficulty of directly reading the key value pair information can be determined according to empirical data or recorded according to the results in the test process. When converting the first language format into the second language format, the key value pair information in the target configuration file is retained.

[0111] In the embodiments of the present application, the configuration item can be a project configured in the test environment, and is a variable project in the test environment. For the test environment, the configuration item can include, for example, hardware configuration (such as selected hardware, hardware circuit switch, etc.), software configuration, network configuration, data source configuration, data transmission configuration, and data storage configuration. The configuration of the configuration item can also be referred to as the parameter or content of the configuration item, for example, the configuration item is a port number, and the configuration of the configuration item is “2390”. The configuration item is a host, and the configuration of the configuration item is “localhost”. For another example, the configuration item is a supported formula version in a document application, and the configuration of the configuration item is “formula 3.0”. For another example, the configuration item is whether the target application web version supports file transmission, and the configuration of the configuration item is “no”.

[0112] In the embodiments of the present application, the key-value pair information in the target configuration file is used to record the configuration items and the configurations of the configuration items in the test environment. For example, the key-value pair information in the first configuration file is used to record the configuration items and the configurations of the configuration items in the first test environment. The key-value pair information in the second configuration file is used to record the configuration items and the configurations of the configuration items in the second test environment. The key-value pair information included in the first to-be-processed file and the second to-be-processed file is respectively used to record the configuration items and the configurations of the configuration items in the first test environment and the second test environment. However, after the language format is converted from the first language format to the second language format, the recording manner of the key-value pair information and the extraction difficulty change.

[0113] Step S33: Comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file, difference data of the first configuration file and the second configuration file is obtained.

[0114] Step S33 can be executed by the server side, or by the client side configured to execute the module, can also be executed by the server side calling other server sides, or can also be executed by the client side calling the server side.

[0115] In a possible implementation, step S33 can be expressed as: comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file, determining the difference data of the key-value pair information of the first to-be-processed file and the second to-be-processed file as the difference data of the first configuration file and the second configuration file.

[0116] Alternatively, in another possible implementation, step S33 can also be expressed as: comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file, determining the difference data of the key-value pair information of the first to-be-processed file and the second to-be-processed file, and then performing format conversion to obtain the difference data of the first configuration file and the second configuration file.

[0117] The difference data of the first configuration file and the second configuration file can also be referred to as the difference points (that is, the difference data can also be referred to as the difference points) of the first configuration file and the second configuration file. The difference data of the first configuration file and the second configuration file can include the difference data of the first configuration file compared with the second configuration file, and / or the difference data of the second configuration file compared with the first configuration file.

[0118] In a possible implementation, the difference data of the first configuration file compared with the second configuration file can include at least one of the following multiple cases.

[0119] (1) The key-value pair information that exists in the first configuration file and does not exist in the second configuration file.

[0120] If the initial configuration of the first test environment is the same as the initial configuration of the second test environment, and one configuration item is deleted in the process of testing the second target to be tested by the second test environment, there can be difference data (1).

[0121] If the initial configuration of the first test environment is different from the initial configuration of the second test environment, and one configuration item of the first test environment does not exist in the second test environment, there can also be difference data (1).

[0122] If the initial configuration of the first test environment is the same, but the value of one configuration item in the first configuration file is deleted, there can be difference data (1).

[0123] (2) The same key exists in the first configuration file and the second configuration file, but the specific values in the key-value pair information are different.

[0124] If the initial configuration of the first test environment is the same as the initial configuration of the second test environment, and the specific configuration of one configuration item is modified to other content in the process of testing the second target to be tested by the second test environment, there can be difference data (2).

[0125] If the initial configuration of the first test environment is the same as the initial configuration of the second test environment, but the specific configurations are different, there can also be difference data (2).

[0126] (3) The key-value pair information exists in the first configuration file and the second configuration file, but the order is different.

[0127] (4) The key-value pair information exists in the first configuration file and the second configuration file, but the order of the contents contained in the values corresponding to the key-value pair information is different.

[0128] For example, in the case where the key of the key-value pair information further includes multiple keys and / or multiple values, the arrangement order of the multiple keys and / or multiple values is different.

[0129] In one possible implementation, when a configuration item in the target configuration file is deleted, the possible deletion manners include: (1) deleting the configuration corresponding to the configuration item, so that the configuration corresponding to the configuration item is empty; (2) modifying the configuration corresponding to the configuration item to an invalid value; (3) deleting the configuration item and the corresponding configuration and retaining the position of the configuration item; (4) deleting the configuration item, the corresponding configuration, and the position of the configuration item. The position of the configuration item can be represented by a symbol, or represented by a space, or represented by an empty line.

[0130] In a possible implementation, the comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file can include: sequentially comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the same sequence in the second to-be-processed file. For example, the key-value pair information of the first to-be-processed file sequentially includes key11-value11, key12-value12 and key13-value13 from the beginning, and the key-value pair information of the second to-be-processed file sequentially includes key21-value21, key22-value22 and key23-value23 from the beginning. Then, key11 and key21, key12 and key22, and key13 and key23 are sequentially compared, and value11 and value21, value12 and value22, and value13 and value23 are sequentially compared in sequence.

[0131] In another possible implementation, the comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file can include: comparing the key-value pair information of the first to-be-processed file with the key-value pair information of the corresponding sequence in the second to-be-processed file. The corresponding sequence can refer to a sequence that should be the same but is actually not the same. For example, in the process of testing the first to-be-tested target, after the configuration item, the configuration and the location of the configuration item in the first test environment are deleted, the subsequent configuration item moves one position forward. Then, starting from the deleted configuration item, the configuration item in the first to-be-processed file corresponds to the next sequence configuration item in the second to-be-processed file in the same sequence.

[0132] Step S34: determining a configuration setting mode of the first test environment and the second test environment according to the difference data.

[0133] Step S34 can be executed by the server side, or executed by the client side configured to execute the module, and can also be executed by the server side calling other server sides, or can also be executed by the client side calling the server side.

[0134] In steps S31-S34, each step can be executed by a different execution subject, or all steps can be executed by the same execution subject. For example, steps S31-S34 are all executed by the server side, or steps S31-S33 are executed by the server side and step S34 is executed by the client side.

[0135] When step S34 is executed by the server side, the method can further include: processing and calculating the difference data on the server side according to the difference data and a pre-set configuration setting rule, and determining to modify the configuration of at least one of the first test environment and the second test environment according to a calculation result.

[0136] The above process can be executed by the client, or the client can call the server to execute it.

[0137] Alternatively, step S34 includes: displaying the difference data; receiving a configuration setting instruction based on the difference data; and performing configuration settings on at least one of the first test environment and the second test environment based on the configuration setting instruction. The configuration setting instruction may be sent by an operator based on the difference data.

[0138] In an embodiment of the present application, determining the configuration setting method for the first test environment and the second test environment based on the difference data may include: determining to modify the configuration of the first test environment and / or the configuration of the second test environment based on the difference data.

[0139] Furthermore, modifying the configuration of the first test environment and / or the second test environment may include one of the following methods.

[0140] (1) Modify the configuration of the first test environment so that the configuration of the first test environment is the same as the configuration of the second test environment.

[0141] (2) Modify the configuration of the second test environment so that the configuration of the second test environment is the same as the configuration of the first test environment.

[0142] (3) Modify at least part of the difference data in the first test environment and / or the second test environment.

[0143] (4) Merge the mergeable items of the different data in the first test environment and the second test environment. For example, merge key-value pairs with the same key but different values. The obtained key is the key in the original key-value pair information, and the obtained value includes all the values ​​in the original key-value pair information.

[0144] Because the target to be tested may need to test multiple targets at the same time due to reasons such as the rapid version update speed, refer to Figure 3B As shown, more than two test environments (with the configuration files being the first configuration file and the second configuration file) can be used to test different versions of the target in parallel during the iteration test of the target. When each test environment tests the target, the target may change during the test. For example, the first target may have a patch version, i.e. Figure 3BThe second to-be-tested target is a V2 version in the illustrated V1SP version. After testing the first to-be-tested target and the second to-be-tested target using the two test environments ENV1 and ENV2, the configuration data in the two test environments changes. By comparing the configuration data in the two test environments, difference data is obtained. At least one of the two test environments can be modified according to the difference data, and then the first to-be-tested target and the second to-be-tested target are re-evaluated using the test environment after modification, thereby helping to consider more comprehensive factors, optimize the configuration environment, and obtain more accurate test results about the to-be-tested targets. Therefore, by using the method provided in the embodiments of the present application, different test environments are used to test different versions of the same initial to-be-tested target in parallel, and accurate test results can also be obtained, thereby allowing parallel testing of different to-be-tested targets, and helping to improve the test efficiency while ensuring the accuracy of the test.

[0145] It can be understood that in other possible implementations, more than two test environments can be used to test more to-be-tested targets in parallel, so that more target configuration files can be converted into to-be-processed files for comparison, difference data can be obtained, and the test results can be improved according to the difference data, thereby allowing more to-be-tested targets to be tested in parallel and further improving the test efficiency.

[0146] In an implementation, in Figure 3A On the basis of the embodiments illustrated, the step S33, that is, the comparison of the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file to obtain the difference data of the first configuration file and the second configuration file, can further include: comparing the first to-be-processed file with the second to-be-processed file to determine first difference data of the first to-be-processed file relative to the second to-be-processed file; comparing the second to-be-processed file with the first to-be-processed file to determine second difference data of the second to-be-processed file relative to the first to-be-processed file; and converting the first difference data and the second difference data into the first language format to obtain the difference data of the first configuration file and the second configuration file.

[0147] In a possible implementation, comparing the first to-be-processed file with the second to-be-processed file can mean comparing the second to-be-processed file as a reference. Similarly, comparing the second to-be-processed file with the first to-be-processed file can mean comparing the first to-be-processed file as a reference.

[0148] The first to-be-processed file and the second to-be-processed file are taken as references respectively to obtain corresponding difference data, and then the difference data of the first configuration file and the second configuration file is integrated, so that the difference points in the first configuration file and the second configuration file can be determined more comprehensively and completely, and the target object can be optimized comprehensively according to the complete difference points. In the case where the target object is a test environment, the accuracy of the test result can be improved.

[0149] For example, a user needs to test a program code by using an online test platform. The user determines which of the currently available test platforms is more suitable for the test requirement. Therefore, the user can access an interface provided by a server side through a client, open a network page for visually accessing the server side, input an acquisition address of a configuration file of the test platform in the network page, submit a comparison instruction, and enable the server side to acquire the configuration file from the acquisition address, execute Figure 3A and Figure 3A The method of the related embodiments compares configuration files.

[0150] In addition, the user can also access the configuration file acquisition address of the test platform through the client, acquire the configuration file, and store the configuration file locally on the client. Then, the user sends the configuration file to the server side through the client, so that the server side acquires the configuration file and executes Figure 3A and Figure 3A the method of the related embodiments.

[0151] In an implementation, the key-value pair information includes a key and a value; when the first configuration file is taken as a reference file and the second configuration file is taken as a reference file, the same steps are used for comparison. That is, in a possible implementation, the comparison of the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file includes: determining a target file and a reference file, the target file being one of the first to-be-processed file and the second to-be-processed file, and the reference file being the other of the first to-be-processed file and the second to-be-processed file; comparing each target key with each reference key, the target key being a key in the target file, and the reference key being a key in the reference file corresponding to the target key in sequence; and recording the target key in the difference data in a case where the target key does not exist in the reference file.

[0152] In the embodiments of the present application, the first to-be-processed file and the second to-be-processed file can be automatically taken as target files in sequence, and the other is taken as a reference file. The finally generated difference data includes both the difference data of the first to-be-processed file relative to the second to-be-processed file and the difference data of the second to-be-processed file relative to the first to-be-processed file.

[0153] Alternatively, one of the first to-be-processed file and the second to-be-processed file can be taken as a target file and the other can be taken as a reference file according to an instruction of the user. The finally generated difference data only includes difference data of the first to-be-processed file relative to the second to-be-processed file or only includes difference data of the second to-be-processed file relative to the first to-be-processed file.

[0154] For example, the user can access an interface provided by the server side, open a web page for visually accessing the server side, provide a configuration file or an address from which the configuration file is obtained to the server side through the visual page. When the configuration file is submitted, one-way comparison or two-way comparison can be selected for the configuration file. If the user selects to specify the first configuration file or the second configuration file as a reference file, a one-way comparison instruction is sent by the client side when the configuration file is submitted, and the server side performs one-way comparison on the first configuration file and the second configuration file based on the one-way comparison instruction. Otherwise, a two-way comparison instruction can be sent by the client side by default when the user submits the configuration file, and two-way comparison is performed by default.

[0155] For another example, when the user directly submits the first configuration file and the second configuration file to the server side, a one-way comparison or a two-way comparison instruction can also be sent.

[0156] In a possible implementation, the key corresponding to the target key sequence in the reference file can include: a key in the reference file that is consistent with the target key sequence, and / or a key in the reference file that is inconsistent with the target key sequence but can be corresponded by displacement.

[0157] In some common data exchange formats (such as JSON) of the configuration file, the key has uniqueness, and the value corresponding to the key can exist in multiple. In the embodiment of the present application, the keys in the to-be-processed file are matched first, and in the case of different keys, it is not necessary to determine whether the values are the same, which simplifies the amount of information that needs to be compared and can improve the comparison efficiency.

[0158] In an implementation, if it is determined that the target key is the same as the reference key (that is, one reference key is determined as the matching key of the target key) through comparison of the target key and the reference key, the corresponding values need to be further compared. Correspondingly, the configuration file processing method further includes: in the case that the target key exists in the reference key, comparing the type of the value of the target key with the type of the value of the matching key; the matching key is the reference key that is the same as the target key; in the case that the types are different, recording the target key in the difference data.

[0159] Since in some common data exchange formats of the configuration file, there can be multiple values corresponding to a key, the number of comparison operations can be increased when comparing the value of the target key with the value of the reference key one by one or comparing the value of the target key with the value of the matching key one by one. By judging whether the types of the values are the same, the key-value pair information with the same matching key and different value types is filtered out, which can accurately find the inconsistent key-value pair information and reduce the data to be compared, thereby improving the comparison efficiency.

[0160] In an embodiment, the types in which the values can exist can be defined, and for some complex types of values, a loop comparison sub-process is set. Correspondingly, the configuration file processing method further comprises: in the case where the types are the same and the corresponding value includes at least one key, taking the at least one key included in the corresponding value as a new target key and the key included in the value corresponding to the matching key as a new reference key, returning to the step of comparing the target key with the reference key.

[0161] For example, generally, the key-value pair information can be expressed in the form of key-value, wherein the value can further include at least one key-value pair information, that is, the key-value pair information can be expressed in the form of key1-key11-value11. In this case, key1 is a key, and “key11-value11” is a value. In another case, the value of a key can not include a key but include multiple values, that is, the key-value pair information can be expressed in the form of key1-value11-value12. For the former case, the key in the value can be taken as a reference key in turn, and the complex value of the former case can be compared.

[0162] On the client side or the server side, a module for comparing the key-value pair information in the to-be-processed file can be set, and the comparison rule can be executed by calling the module.

[0163] In an embodiment, the configuration file processing method further comprises: before recording the target key in the difference data, recording the target key in a current comparison list; after recording the target key in the difference data, removing the target key from the current comparison list; in the case where the target key is the last key included in the values corresponding to other keys, after removing the target key from the current comparison list, removing the last key in the current comparison list.

[0164] For example, the key-value pair information in a list includes: key1-(key2-value1, key3-value2), that is, the value corresponding to the key key1 is the two key-value pairs in the brackets. When comparing to key2, the recorded keys in the comparison list include key1-key2, and after the comparison of value1 is completed, the last key (key2) in the comparison list is deleted (or can be referred to as cleared), and the recorded keys in the comparison list include key1. Next, the key key3 is compared, and the recorded keys in the comparison list include: key1-key3. After the comparison of value2 is completed, the last key (key3) in the list is deleted, and since key3 is the last key of the value of the key-value pair information, key1 is deleted again.

[0165] In the embodiments of the present application, the current comparison list is equivalent to a temporary list, which is used to record the key-value pair information currently being compared. When a key-value pair information is being matched with other key-value pair information, the corresponding key is recorded in the current comparison list, so as to update the comparison in real time and avoid repeated comparison or missing key-value pair information in the comparison process.

[0166] In one case, the type represents a case where the corresponding value includes at least one key, and the type is a dictionary type (dict), a set type (set), or a list type (list).

[0167] In the embodiments of the present application, the dictionary type is a key-value type, which is equivalent to the key-value pair information included in the value of the key-value pair information.

[0168] The list type can include an ordered set of a series of elements. The elements can be keys or values of any type. It can be considered that each element is a value contained in the value of the list type.

[0169] The set type can include unordered elements. The elements can be keys or values of any type.

[0170] The method provided in the embodiments of the present application can compare the values of the dictionary type, the set type, and the list type by comparing the keys included in the comparison values and then further comparing the values included in the comparison values, thereby improving the comparison efficiency of this type of complex values.

[0171] In one embodiment, based on Figure 3AThe embodiment and related embodiments, before step S33, that is, before the comparing the key-value pair information corresponding to the first to-be-processed file with the key-value pair information corresponding to the second to-be-processed file to obtain the difference data of the first configuration file and the second configuration file, further includes: receiving a sorting comparison instruction; the sorting comparison instruction is used to indicate that the order of the list type value in the to-be-processed file is not compared; sorting the list type value according to a pre-set rule; and replacing the list type value before sorting with the list type value after sorting.

[0172] The sorting comparison instruction can be an instruction sent by the client to the server, and the server sorts the value of the set type according to the sorting comparison instruction sent by the client. Alternatively, the client or the server receives the sorting comparison instruction through a keyboard, a mouse or other external devices, and accordingly sorts the value of the set type according to the sorting comparison instruction in the local client or the local server.

[0173] When comparing the list type value by the above method, the operator can choose not to consider the order factor, thereby providing flexible selection for the comparison of the configuration file.

[0174] In an embodiment, the sorting the value containing order information in the to-be-processed file according to a pre-set rule includes: classifying the elements contained in the list type value to obtain a plurality of classifications of the value containing order information; sorting the value contained in each classification according to a pre-set first sorting rule; and sorting the sorted classifications according to a pre-set second sorting rule to obtain the list type value after sorting.

[0175] In the embodiment, the sorted value is compared with the target value and the reference value, and the order of the reference value corresponds to the order of the target value. By classifying the elements contained in the list type value, the list type value can be sorted according to the set rule, so that the list type value after re-sorting does not contain the original element order information, and the elements are sorted according to the pre-set rule such as numerical size or alphabetical order. If the elements contained in the list type value are the same but the order of the elements is different, the list type value can be identified as the same value when the elements contained in the list type value are compared in order according to the above method.

[0176] In an embodiment, the plurality of classifications include: a string, an array, an integer, a dictionary type and a list type.

[0177] In this way, the elements included in each category can be sorted, thereby breaking the original order of the elements, so that the order of the same elements can be unified, so that when comparing the elements, the original order between the elements is excluded, and only whether the elements contained in the values are the same is compared.

[0178] In an embodiment, the first language format is a YAML format, and the second language format is a JSON format.

[0179] The YAML format can be converted into the JSON format without loss. In the case where the first language format is the YAML format, the configuration file includes key-value pair information.

[0180] For example, the characteristics of the YAML format include: case-sensitive; using indentation to represent hierarchical relationship; supporting string (str), integer, float, bool, null, time and date data formats; using "#" to represent comments; the keys and values in the object can be separated by ":", and the colon must be followed by a space, and the indentation of the object hierarchical structure is used to represent; the elements in the array are prefixed with "-", and each line represents an array element, and the hierarchical structure of the array is also represented by indentation. Special symbols in YAML can include: ---, indicating the beginning of the file; … indicates the end of the file;!! indicates type conversion, etc.

[0181] In the embodiments of the application, the configuration file in the test environment is originally recorded in the YAML format language, the YAML language is simple and intuitive, and when used as the language format of the configuration file, the configuration file has higher readability, which helps the test personnel to operate the configuration file. In the JSON format, the expression of key-value pair information is more intuitive and easy to identify and extract. Therefore, using YAML to record the configuration file helps the test personnel to debug during the test. Using the JSON format as the format of the to-be-processed file helps to fully, sufficiently and accurately compare the key-value pairs, so as to quickly determine the difference data between the target configuration files.

[0182] In an embodiment, the target configuration file includes annotation data of the key-value pair information; the to-be-processed file includes the annotation information, and a key path of the annotation information in the to-be-processed file; the configuration file method of the test environment further includes: according to the key path, supplementing the annotation information to the key-value pair information corresponding to the difference data.

[0183] Since the YAML is used as the first language format in the embodiment of the present application, the configuration can be explained by the annotation data, which provides further convenience for the arrangement of the tester in the test process. After the difference data of the to-be-processed file is obtained, the difference data of the to-be-processed file is converted into the YAML format, and the annotation data is supplemented in the difference data, thereby helping the relevant operator to understand the difference data, and further more accurately determining how to change the configuration of the test environment.

[0184] In another possible implementation, the first language format is the XML format, and the second language format is the JSON format.

[0185] In another possible implementation, the first language format is the YAML format, and the second language format is the XML format.

[0186] In another possible implementation, the first language format is the HTML format, and the second language format is the XML format.

[0187] In another possible implementation, the first language format is the HTML format, and the second language format is the JSON format.

[0188] In an embodiment, the determining of the configuration setting mode of the first test environment and the second test environment according to the difference data comprises: determining a modification item and corresponding modification content according to the difference data; modifying the modification item in the first configuration file and the second configuration file into the corresponding modification content to obtain an updated first configuration file and an updated second configuration file; updating the first test environment according to the updated first configuration file, and updating the second test environment according to the updated second configuration file.

[0189] In another possible implementation, the first configuration file can be supplemented according to the difference data of the first configuration file relative to the second configuration file, and the second configuration file can be supplemented according to the difference of the second configuration file relative to the first configuration file. For example, it is assumed that the initial configuration of the first test environment and the second test environment includes A-a and B-b, wherein “-” represents the separation of the key and the value, and the front of “-” is the key and the rear of “-” is the value. It is determined through the comparison of the target configuration file that the configuration C-c is added in the first configuration file, and the configuration D-d is added in the second configuration file. Then, the configuration C-c can be supplemented in the second configuration file, and the configuration D-d can be supplemented in the first configuration file.

[0190] In the embodiments of the present application, firstly, in the difference data, the configuration for modifying the test environment and the modification content are determined, then the configuration of the test environment is modified and updated, the efficiency of the test environment maintenance is improved, and the different configurations of the test environment are aligned, so as to be better applied to the parallel test of the subsequent different versions of the same initial version of the to-be-tested target.

[0191] In Figure 3A On the basis of the embodiments shown, Figure 4A Another application scenario of the method provided in the embodiments of the present application is shown. The user can remotely access the interface provided by the server side through the client 401, and call the function of the server to realize the processing method of the configuration file. As shown in a of Figure 4A , the user can access the website (the website address can be, for example: XXX: / / XXXXX.XXXXXX.XX) provided by the server side through the browser of the client, and operate the configuration file upload control 403 in the page 402 of the website to upload the first configuration file and the second configuration file. The first configuration file and the second configuration file can be stored locally in the client 401, and after clicking the configuration file upload control 403, the user enters the local file selection interface, as shown in b of Figure 4A . The user can select the configuration file and click the comparison control 404 in the page 402 to upload the first configuration file and the second configuration file to the server side for comparison. The server side can perform the steps of the embodiments shown in Figure 3A or any related embodiments to compare the first configuration file and the second configuration file, and obtain the difference data. After obtaining the difference data on the server side, the user can be shown the difference data of the configuration file, as shown in a of Figure 4B and b of Figure 4B . The difference data of the first configuration file with respect to the second configuration file and the difference data of the second configuration file with respect to the first configuration file are respectively shown to the user through different cards.

[0192] In Figure 4CIn page 402 shown in a, you can also choose whether to sort the values ​​or key-value pairs of the set type. For example, the user can choose to sort the key-value pair information of the dict type, or choose to sort the values ​​of the list type, or sort the dict and list types at the same time. In addition, the user can also select the sorting range, which supports the user to enter the starting line number or starting line configuration items and parameters of the configuration file paragraph to be sorted, and enter the ending line number or ending line configuration items and parameters, so that the user-selected fragments can be sorted during comparison. If the user does not fill in the content in the input box corresponding to the sort, and selects the dict and / or list options in the sort, the entire configuration file range will be sorted by default. The user can enter the range for sorting the first configuration file in the input box corresponding to sort range 1, and enter the range for sorting the second configuration file in the input box corresponding to sort range 2.

[0193] After the user selects sorting, when the user clicks the configuration file upload control 403, a sorting instruction is sent at the same time, and the server performs sorting-related steps on the configuration file.

[0194] In one possible implementation, the user can choose to upload a configuration file as the first configuration file, and the server uses the default configuration file as the second configuration file. Alternatively, the user can select a configuration file provided by the server as the first configuration file, and can also select a configuration file provided by the server as the second configuration file.

[0195] In a possible implementation, the user can select the configuration file of the target application as the first configuration file and the configuration file of the target system as the second configuration file. Figure 4B a or Figure 4B b. Determine difference data between the first configuration file and the second configuration file, and determine the compatibility between the target application and the target system and incompatible configuration items according to the difference data, so as to select whether to use the target application in the target system.

[0196] exist Figure 3A Based on the embodiment shown, in another possible application scenario of the embodiment of the present application, the user needs to use platform 1 or platform 2 to achieve the purpose of code testing. In order to determine how to choose the platform to be used, the user can obtain the configuration files of platform 1 and platform 2 from the access interfaces provided by platform 1 and platform 2, and then send the configuration files to the server. The server compares the configuration files, obtains the difference data, and returns it to the user. The user views the difference data through the client and chooses to use platform 1 or platform 2. Figure 4BAs shown in the scenario, the user can select to upload the configuration file in the web page on the server side, and upload the obtained configuration file of platform 1 and platform 2 to the server side for comparison. The user can also fill in the address of obtaining the configuration file in the web page, and the server side obtains the configuration file according to the address for comparison. In Figure 4B the scenario shown, the user can still select to sort the configuration files.

[0197] In another possible implementation, the user can obtain the online or offline configuration file through the software tool installed on the client, and compare the online or offline configuration file through the software tool. For example, as shown in a of Figure 4C , in addition to selecting to upload the configuration file, the user can also select the online configuration file. After the user clicks to select the online configuration file, an instruction for selecting the configuration file is generated, and the instruction is sent to the server side. The server side returns a list of selectable configuration files, as shown in b of Figure 4C . The list of selectable configuration files includes multiple configuration file sources. The configuration file source can be that after the server side receives the instruction for selecting the configuration file, the server side sends request information to a verified source server, the source server sends the source of the latest configuration file to the server, and the server returns the information to the client.

[0198] Meanwhile, in the interface shown in b of Figure 4C , if the user selects a source, the user can also access the sub-path corresponding to the source to further determine the configuration file.

[0199] In a possible implementation, the user can also select to upload the first configuration file and select the second online configuration file. In addition to the online platform providing the configuration file, the online configuration file source can also include any device end capable of providing the online configuration file, such as a remotely connected server end with access permission limitation.

[0200] In another possible implementation, the user can also configure an application or software for executing the methods in Figure 3A and Figure 3A on the client or server side. By opening the application or software, the user can obtain the configuration file locally or remotely, and convert the language format of the configuration file from the first language format to the second language format locally or by calling a remote server. Then, the user obtains the local to-be-processed file or receives the second to-be-processed file sent remotely. The user runs the application or software on the client or server side to determine the difference data of the configuration file. In the embodiments, the user can use the application installed on the mobile phone to execute the methods in Figure 3A and the related embodiments.

[0201] Next, examples of the present application are introduced.

[0202] Example (One)

[0203] In the present example, the first language format adopts the YAML format, and the second language format adopts the JSON format. Referring to FIG. 1, in the present example, a configuration file comparison system is set up, which compares the first configuration file and the second configuration file corresponding to two test environments by using the method provided in the embodiments of the present application to obtain the difference data. As shown in FIG. 2, two configuration files in the YAML language format are simultaneously input into the configuration file comparison system, and the configuration file comparison system outputs and displays the data difference points of the two configuration files after data comparison. The operator of the test system can align the two sets of YAML format configurations according to the output difference point configuration content, so that the configurations of the two test environments are the same. Figures 5-10

[0204] In one example of the present application, the first language format adopts the YAML format, and the second language format adopts the JSON format. Referring to FIG. 1, in the present example, a configuration file comparison system is set up, which compares the first configuration file and the second configuration file corresponding to two test environments by using the method provided in the embodiments of the present application to obtain the difference data. As shown in FIG. 2, two configuration files in the YAML language format are simultaneously input into the configuration file comparison system, and the configuration file comparison system outputs and displays the data difference points of the two configuration files after data comparison. The operator of the test system can align the two sets of YAML format configurations according to the output difference point configuration content, so that the configurations of the two test environments are the same. Figure 5 Figure 5 Referring to FIG. 1 and FIG. 2, the configuration file comparison system supports simultaneously inputting two (or more than two) configuration files in the YAML language format (equivalent to the target configuration file in the foregoing embodiments), and simultaneously outputting two comparison results corresponding to the difference points between the two configuration files in the YAML language format.

[0205] Referring to FIG. 1 and FIG. 2, the configuration file comparison system supports simultaneously inputting two (or more than two) configuration files in the YAML language format (equivalent to the target configuration file in the foregoing embodiments), and simultaneously outputting two comparison results corresponding to the difference points between the two configuration files in the YAML language format. Figure 5 Figure 10 On the basis of FIG. 1 and FIG. 2, FIG. 3 shows the first operation performed after inputting the configuration file in the YAML format into the configuration file comparison system. After inputting the configuration file in the YAML language format into the configuration file comparison system, the configuration file comparison system reads the key-value pair information and the annotation data in the input configuration file respectively, converts the key-value pair information into the JSON format for storage, and obtains the key-value pair information in the JSON format. After supplementing the key information of the annotation data, the annotation data is stored in the JSON format. Referring to FIG. 4, the annotation data converted into the JSON format is used in the subsequent retrieval filtering sub-process (i.e., the sub-process shown in FIG. 5).

[0206] The key information supplemented for each piece of annotation data includes the path of the key corresponding to the annotation data, that is, the supplemented key information includes all the keys directly or indirectly corresponding to the annotation data. The key-value pair information in the JSON format includes the first to-be-processed file and the second to-be-processed file in the foregoing embodiments. Figure 5 Figure 6 Figure 10 Figure 9

[0207] Figure 5 Figure 7 ​​​​​​​​​The configuration file comparison system converts the configuration data in YMAL language format into JSON language format, and then sorts the data according to the received sorting instruction. Figure 7 The steps shown can be performed after the process shown Figure 6 The configuration file comparison system provides an optional item for selecting whether to sort, and receives the selection instruction through the optional item. If the user selects the optional item for sorting, the configuration file comparison system inputs is_sorted=1 as the sorting instruction, otherwise inputs is_sorted=0. When the configuration file system receives the selection of is_sorted=1, the values of the set type will be sorted. If is_sorted=0 is input, the values of the set type will not be sorted, and the order of the values is also one of the judgment conditions for whether they are the same.

[0208] In the embodiments of the present application, the values of the list type can be sorted in the manner shown Figure 7 The sorting process includes the steps shown in Figure 7

[0209] Step S71: Input the key-value pair information in JSON language format into the sorting module.

[0210] Step S72: Recursively traverse the key-value pair information in JSON language format, obtain the value data of the list type, and store it in the list array.

[0211] Step S73: For each list array, traverse the list array, and store the elements in the list array in the corresponding array according to the classification of the elements in the list array.

[0212] As an example, the classification basis can refer to Table 1 below.

[0213] none_list None list, stores None values int_list Integer list, stores int type data str_list String list, stores strings dict_list Object list, stores dictionary objects list_list Array list, stores arrays (lists within lists)

[0214] Table 1

[0215] In each type in Table 1, a pre-set rule can be used for sorting. For example, the general sorting rule for elements in the string list type can be: uppercase letters, lowercase letters, numbers, and Chinese characters in turn, multiple letters that are all uppercase or all lowercase are sorted in alphabetical order, multiple numbers are sorted in numerical order, and multiple Chinese characters are sorted in order of the first letter in the Chinese alphabet.

[0216] ​Step S74: In each sorted list, perform an in-list sorting, and then merge the sorted lists in the order of none_list, int_list, str_list, dict_list, list_list to obtain a sorted list.

[0217] Step S75: Replace the sorted value in the key-value pair information in the JSON language format with the unsorted value.

[0218] Referring to Figure 10 the process of comparing the key-value pair information in the JSON language format is shown. The key-value pair information set of one of the files to be processed is recorded as A, which is equivalent to the first file to be processed in the foregoing embodiment. The key-value pair information set of the other file to be processed is recorded as B, which is equivalent to the second file to be processed in the foregoing embodiment. The comparison of the two key-value pair information in the JSON language format can include steps S81-S810 shown in FIG. 8. Figure 7 The corresponding sub-process is used to sort the first file to be processed and the second file to be processed to obtain a sorted first file to be processed and a sorted second file to be processed.

[0219] In Figure 5 the foregoing examples and Figure 5 related examples, Figure 8 the process of comparing the key-value pair information in the JSON language format by the configuration file comparison system is shown. The key-value pair information set of one of the files to be processed is recorded as A, which is equivalent to the first file to be processed in the foregoing embodiment. The key-value pair information set of the other file to be processed is recorded as B, which is equivalent to the second file to be processed in the foregoing embodiment. The comparison of the two key-value pair information in the JSON language format can include steps S81-S810 shown in FIG. 8.

[0220] Step S81: Determine whether the key-value pair information of A and B is of the dictionary type, or whether the values are both array lists. If yes, proceed to the subsequent steps for comparison. Otherwise, determine that the texts are inconsistent, and directly output the input data as the comparison result.

[0221] Step S82: Recursively traverse A, record the keys traversed, and store them in a key list key_list. If an array is traversed, use the array index as the key record.

[0222] Step S83: Determine whether the key traversed exists in the corresponding order of the key-value pair information in A and B. If not, directly add the content of the current key_list to the result set, clear the key at the end of the key_list, and continue the traversal.

[0223] Step S84: For the key existing in A and B, determine whether the corresponding values are of the same data type. If not, add the key_list to the result set, clear the key at the end of the key_list, and continue to traverse the keys of A.

[0224] Step S85: If the value types are the same, determine whether the values ​​are the same based on the value types.

[0225] When executing step S85, steps S86 to S88 may be executed according to different situations of value.

[0226] Step S86: If the type of value is an array list or a dictionary object, continue traversing the array list or dictionary object.

[0227] Step S87: If the type of value is other types, compare the values ​​corresponding to the same key in A and B to see if they are equal. If not, add key_list to the result set. After the comparison is completed, clear the last key in key_list and continue traversing the next key.

[0228] Step S88: If the traversed key is the last key in the current array or object, after the traversal is completed, the traversal of the key corresponding to the current array or object will be completed and the traversal of the next key of the current data will continue. Therefore, it is necessary to clear the last key in the current key_list again after clearing the last key of the key_list.

[0229] Step S89: After the comparison is completed, an array list result set consisting of different key_lists is output as the preliminary comparison result of A.

[0230] A preliminary comparison result is equivalent to the first difference data in the above embodiment, such as Figure 10 shown.

[0231] Replace A with B, and repeat the above steps S82 to S89 to obtain the preliminary comparison result of B. The preliminary comparison result of B is equivalent to the second difference data in the above embodiment, such as Figure 10 shown.

[0232] exist Figure 8 Based on the initial comparison results of A and B, the initial comparison results are retrieved and filtered to finally obtain the difference data. Converting the initial comparison results into the final difference data includes Figure 9 Steps S91 to S93 are shown.

[0233] Step S91: traverse the key_list in the preliminary comparison result of A and the key_list in the preliminary comparison result of B, and add the value corresponding to the key.

[0234] Add the data with added value to the result set.

[0235] Step S92: convert the result set in the JSON language format of the search result into a result set in the YAML language format.

[0236] Step S93: traverse the result set in the YAML language format line by line, obtain a key path, obtain the annotation data corresponding to the key path from the annotation data in the JSON language format, and add the annotation data to the rear of the last key corresponding to the key path in the result set in the YAML language format, to obtain the difference data of the target configuration file.

[0237] In combination Figure 10 As shown in the figure, the difference data of the target configuration file includes first difference data in the YAML format and second difference data in the YAML format.

[0238] Example (two)

[0239] In the case where the first language format is YAML and the second language format is JSON, the configuration file processing method includes the steps shown in Figure 11 .

[0240] Step S1101: the client receives a first configuration file and a second configuration file in the YAML format uploaded by a user.

[0241] Step S1102: the client accesses a network interface for language format conversion and sends the configuration file to a first server end.

[0242] Step S1103: the first server end converts the configuration file into the second language format to obtain a to-be-processed file.

[0243] In the specific implementation mode, in order to ensure that information is not leaked, a default replacement rule can be used to replace the configuration corresponding to the configuration item, so as to hide the content of the configuration. Alternatively, a certain encryption mode can be used to hide at least part of the sensitive configuration.

[0244] Step S1104: the client receives the to-be-processed file returned by the first server end.

[0245] If the configuration file is encrypted or part of the content is hidden before format conversion, in step S1103, the client can restore the hidden content in the intermediate to-be-processed file to obtain the to-be-processed file.

[0246] Through steps S1101 to S1104, the client can convert the first configuration file in the YAML format into a first to-be-processed file in the JSON format, and convert the second configuration file in the YAML format into a second to-be-processed file in the JSON format.

[0247] As an example, the specific content of the first configuration file and the second configuration file in YAML format is shown in Table 2.

[0248]

[0249]

[0250] Table 2

[0251] Correspondingly, the first to-be-processed file in JSON format converted from the first configuration file shown in Table 2 is: { 'a': { 'a1': 'ha', 'aa': 1, 'ab': 'a', 'ac': [11, 'aa']}, 'b': { 'ba': 2, 'bb': 'b', 'bc': [22, 'bb']}, 'c': 'c', 'd': 1, 'e': 'e'}.

[0252] The second to-be-processed file in JSON format converted from the second configuration file shown in Table 2 is: { 'a': { 'a1': 'ha', 'aa': 2, 'ad': 'b', 'ac': [12, 'ab']}, 'b': { 'bd': 1, 'bb': 'a', 'bc': [21, 'ba']}, 'c': 'c1', 'd': 2, 'e': 'e'}.

[0253] Step S1105: The client accesses the comparison interface and sends the first to-be-processed file and the second to-be-processed file to the second server end.

[0254] When sending, the first to-be-processed file and the second to-be-processed file can also be processed in a certain hidden or encrypted manner to ensure that sensitive content therein is not leaked.

[0255] Step S1106: The second server end compares the first to-be-processed file and the second to-be-processed file to obtain first difference data and second difference data.

[0256] Step S1107: The client receives the first difference data and the second difference data returned by the second server end.

[0257] Step S1108: The client accesses the language format conversion interface and sends the first difference data and the second difference data to the first server end.

[0258] Step S1109: The first server end converts the first difference data into YAML format and converts the second difference data into YAML format.

[0259] Based on the data shown in Table 2, the first difference data is shown in Table 3.

[0260]

[0261] Table 3

[0262] Based on the data shown in Table 2, the second difference data is shown in Table 4 as follows.

[0263]

[0264]

[0265] Table 4

[0266] Step S1110: The client receives the YAML format difference data returned by the second server end, and displays the difference data.

[0267] The YAML format data shown in Table 3 and Table 4 can be used to generate the display result of the difference data after adding annotation data by the second server end or the client, or can be directly used as the display result.

[0268] Corresponding to the method provided in the embodiments of the present application, the embodiments of the present application also provide a configuration file processing device, as shown in Figure 12 The device includes a configuration file obtaining module 1201, a format conversion module 1202, and a comparison module 1203.

[0269] The configuration file obtaining module 1201 is configured to obtain a target configuration file in a first language format. The target configuration file can include a first configuration file of a first target object and a second configuration file of a second configuration object.

[0270] The target configuration file includes a first configuration file of a first test environment and a second configuration file of a second test environment. The first test environment is used to test a first target to be tested, and the second test environment is used to test a second target to be tested.

[0271] The format conversion module 1202 is configured to convert the target configuration file in the first language format into a to-be-processed file in a second language format. The to-be-processed file includes a first to-be-processed file converted from the first configuration file and a second to-be-processed file converted from the second configuration file. The to-be-processed file in the second language format includes extractable key-value pair information. The key-value pair information in the to-be-processed file in the second language format corresponds to the key-value pair information in the target configuration file. The key-value pair information is used to record configuration items in a test environment and configurations of the configuration items.

[0272] The comparison module 1203 is configured to compare the key-value pair information of the first to-be-processed file with the key-value pair information of the second to-be-processed file, and obtain difference data of the first configuration file and the second configuration file.

[0273] In other embodiments of the present application, the configuration file processing apparatus, each module is also used to perform the method implemented by the embodiments or examples related to Figure 3A .

[0274] Meanwhile, the configuration file processing apparatus of the test environment of the embodiments of the present application can also include other functional modules to implement any step and function in the configuration file processing method provided by any embodiment of the present application.

[0275] The functional units and modules in the above embodiments can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for mutual distinction, and do not limit the protection scope of the embodiments of the present application.

[0276] The embodiments of the present application also provide a chip including a processor. The processor is used to read and execute a computer program stored in a memory to execute the configuration file processing method provided by any embodiment of the present application.

[0277] Optionally, the chip further includes a memory, and the memory is connected with the processor through a circuit or a wire.

[0278] The embodiments of the present application also provide a chip system including a processor. The processor is used to read and execute a computer program stored in a memory to execute the method provided by any embodiment of the present application.

[0279] Optionally, the chip system further includes a memory, and the memory is connected with the processor through a circuit or a wire.

[0280] In an embodiment of the present application, the method of the embodiments of the present application can be applied to a client, and the client can be a mobile phone. The mobile phone can be a smart phone. Meanwhile, the method provided by the embodiments of the present application can also be applied to an Android system. The configured software architecture diagram is as shown in Figure 13 . Figure 13 The electronic device shown in runs an Android system. In other embodiments, the electronic device can assemble other types of operating systems.

[0281] Figure 13 Referring to , the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system includes multiple layers, from top to bottom, the application layer, the application framework layer, the Android runtime and the system layer, and the kernel layer.

[0282] Figure 13 is a block diagram of a software system of an electronic device to which the method provided in embodiments of the present application is applied. Referring to Figure 13 , the layered architecture divides the software into several layers, each of which has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system includes multiple layers, from top to bottom, the application layer, the application framework layer, the Android runtime and the system layer, and the kernel layer. When the instructions of the model are issued, the instructions are reported from the bottom layer to the application framework layer or the application layer layer by layer.

[0283] The application layer can include a series of application packages. As Figure 13 indicated, the application package can include desktop applications, cameras, galleries, calls, maps, navigation, Bluetooth, music, video, and the like.

[0284] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications of the application layer. The application framework layer includes some pre-defined functions. As Figure 13 indicated, the application framework layer can include window managers, content providers, interface layers, phone managers, resource managers, notification managers, and the like.

[0285] The system layer includes the Android runtime. The Android runtime includes core libraries and virtual machines. The Android runtime is responsible for scheduling and managing the Android system.

[0286] The kernel layer is the layer between hardware and software. The kernel layer at least contains display drivers, camera drivers, audio drivers, sensor drivers.

[0287] Under the above four-layer architecture, the receiving device is also provided with a hardware layer, which can include the aforementioned electronic device hardware components, such as display screens, keys, etc.

[0288] Meanwhile, the method of the present application can be applied to Figure 13 indicated, the electronic device can also include other functional modules for running the target to be tested in the test environment. At the same time, the test environment can simulate Figure 13 indicated, the configuration file can also be configured according to Figure 13 indicated architecture.

[0289] As an example of the present application, the electronic device or the test device for simulating the function of the electronic device can access the base station and also has the ability to access the wireless local area network, for example, the electronic device is a mobile phone, a tablet, a smart watch, a portable notebook, etc. Figure 14 , Figure 14 is a structural schematic diagram of an electronic device corresponding to the profile processing method of the embodiments of the present application. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0290] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than the illustration, or combine certain components, or split certain components, or different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0291] The processor 110 can include one or more processing units such as: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices, or can be integrated in one or more processors.

[0292] Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, complete the control of fetching instructions and executing instructions.

[0293] The processor 110 can include one or more processing units. Among them, different processing units can be independent devices, or can be integrated in one or more processors. The processor 110 can also be provided with a memory for storing instructions and data.

[0294] In some embodiments, the processor 110 can include one or more interfaces, such as: can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0295] The wireless communication function of the electronic device 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.

[0296] The terminal device realizes the display function through the GPU, the display screen 194 and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.

[0297] The display screen 194 is configured to display images, videos, and the like. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 can include one or N display screens 194, where N is an integer greater than one.

[0298] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to perform data storage functions.

[0299] The internal memory 121 can be configured to store computer-executable program codes including instructions. The processor 110 performs various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, and the like), and the like. The data storage area can store data (such as audio data, a phonebook, and the like) created during use of the electronic device 100, and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.

[0300] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. The touch sensor 180K, also referred to as a “touch panel”. The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 together form a touch screen, also referred to as a “touch screen”. The touch sensor 180K is configured to detect a touch operation acting on or near the touch sensor 180K. The touch sensor 180K can transmit the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation can be provided through the display screen 194. The bone conduction sensor 180M can acquire a vibration signal.

[0301] The keys 190 include a power key, a volume key, and the like. The keys 190 can be mechanical keys or touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0302] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (such as: coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as: infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium accessible by a computer, or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (such as: floppy disk, hard disk, magnetic tape), an optical medium (such as: Digital Versatile Disc (DVD)) or a semiconductor medium (such as: Solid State Disk (SSD)) and the like.

[0303] The above is an optional embodiment provided by the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the technical scope disclosed by the present application should be included in the protection scope of the present application.

Claims

1. A configuration file processing method, characterized in that: include: obtaining a target configuration file in a first language format; The target profile includes a first profile of a first target object and a second profile of a second target object; converting the target configuration file in the first language format into a to-be-processed file in the second language format; The to-be-processed file includes a first to-be-processed file converted from the first configuration file and a second to-be-processed file converted from the second configuration file; the to-be-processed file in the second language format includes extractable key-value pair information; the key-value pair information in the to-be-processed file in the second language format corresponds to the key-value pair information in the target configuration file; the key-value pair information is used to record configuration items of the target object and configurations of the configuration items; The key-value pair information of the first to-be-processed file and the key-value pair information of the second to-be-processed file are compared to obtain difference data between the first configuration file and the second configuration file; the difference data is used to determine the configuration setting method for the first target object and the second target object.

2. The method according to claim 1, characterized in that The first target object is a first test environment, and the second target object is a second test environment; the first test environment is used to test a first target to be tested, and the second test environment is used to test a second target to be tested.

3. The method according to claim 1 or 2, characterized in that The comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file to obtain difference data between the first configuration file and the second configuration file includes: Comparing the first file to be processed with the second file to be processed to determine first difference data between the first file to be processed and the second file to be processed; Comparing the second file to be processed with the first file to be processed to determine second difference data between the second file to be processed and the first file to be processed; The first difference data and the second difference data are converted into the first language format to obtain difference data between the first configuration file and the second configuration file.

4. The method according to any one of claims 1 to 3, characterized in that The key-value pair information includes a key and a value; and the comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file includes: Determine a target file and a reference file, wherein the target file is one of the first to-be-processed file and the second to-be-processed file, and the reference file is the other of the first to-be-processed file and the second to-be-processed file; Compare each target key with each reference key; the target key is a key in the target file, and the reference key is a key in the reference file that corresponds to the target key in sequence; In the case where the target key does not have the same key in the reference key, the target key is recorded in the difference data.

5. The method according to claim 4, characterized in that The method further comprises: If the target key has the same key in the reference key, compare the type of the target key value with the type of the matching key value; the matching key is the same reference key as the target key; In the case where the types are different, the target key is recorded in the difference data.

6. The method according to claim 4 or 5, characterized in that The method further comprises: When the types are the same and the type indicates that the corresponding value includes at least one key, the at least one key included in the corresponding value is used as the new target key, the corresponding key included in the value corresponding to the matching key is used as the new reference key, and the step of comparing the target key with the reference key is returned.

7. The method according to any one of claims 4 to 6, characterized in that The method further comprises: Before recording the target key in the difference data, recording the target key in a current comparison list; After recording the target key in the difference data, clearing the target key from the current comparison list; In the case that the target key is the last key included in the values ​​corresponding to other keys, after the target key is cleared from the current comparison list, the last key in the current comparison list is cleared.

8. The method according to claim 5 or 6, characterized in that When the type indicates that the corresponding value includes at least one key, the type is a dictionary type, a set type, or a list type.

9. The method according to any one of claims 1 to 8, characterized in that Before comparing the key-value pair information corresponding to the first to-be-processed file and the key-value pair information corresponding to the second to-be-processed file to obtain difference data between the first configuration file and the second configuration file, the method further includes: Receive a sorting and comparison instruction; the sorting and comparison instruction is used to indicate that the order of the list type values ​​in the to-be-processed file is not to be compared; Sort the values ​​of the list type according to pre-set rules; Use the value of the sorted list type to replace the value of the sorted list type.

10. The method according to claim 9, characterized in that The step of sorting the values ​​containing sequence information in the to-be-processed file according to a preset rule includes: Classifying the elements contained in the value of the list type to obtain multiple classifications of values ​​containing sequence information; Sort the values ​​contained in each of the categories according to a preset first sorting rule; The sorted categories are sorted according to a preset second sorting rule to obtain a sorted first file to be processed and a sorted second file to be processed.

11. The method according to claim 10, characterized in that The second language format is JSON format, and the multiple categories include: string, array, integer, dictionary type and list type.

12. The method according to claim 2, characterized in that The method further comprises: Determining the modification item and the corresponding modification content according to the difference data; Modify the modified items in the first configuration file and the second configuration file to corresponding modified contents, to obtain an updated first configuration file and an updated second configuration file; The first test environment is updated according to the updated first configuration file, and the second test environment is updated according to the updated second configuration file.

13. The method according to any one of claims 1 to 12, characterized in that The first language format is YAML format, and the second language format is JSON format.

14. The method according to claim 13, characterized in that The target configuration file includes annotation data of key-value pair information; the to-be-processed file includes the annotation information and the path of the key of the annotation information in the to-be-processed file; The method further comprises: According to the key path, the annotation information is added to the key-value pair information corresponding to the difference data.

15. An electronic device, characterized in that: The electronic device includes: a processor and a memory; The memory is used to store a program for the electronic device to execute the method according to any one of claims 1 to 14, and to store data involved in implementing the method according to any one of claims 1 to 14; The processor is configured to execute the program stored in the memory.

16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Configuration file difference verification method and device, equipment and storage medium

    CN112256577A

  • JSON file differentiation comparison method and device

    CN113190220A

  • Configuration parameter detection method and device, electronic equipment and storage medium

    CN117667704A

  • Unified application programming interface for transformation of structured data

    US20210133205A1