Host configuration method and device, storage medium and computer equipment
By obtaining application environment information and login user information in the Cypress framework, automatically determine and write the host configuration, and update the host file in real time, the problem of low host configuration efficiency in front-end tests by the Cypress framework is solved, and the efficiency of front-end tests is improved and Response efficiency of host configuration.
Patent Information
- Application Number
- CN202411736971.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-25
AI Technical Summary
The existing Cypress framework is less efficient in host configuration when conducting front-end testing, resulting in lower front-end testing efficiency.
Before using the Cypress framework for automated testing, obtain the application environment information of the target application and login user information, determine the target host configuration based on this information, and write it to the local host file. When performing automated tests, the switch state changes of the configuration switch in the page of the target application are detected in real time and the Host file is updated according to the changes.
By automatically determining and writing the host configuration, inefficiency and errors of manual modification are avoided, and third-party tools are not required to install, improving the efficiency of front-end testing. Detect changes in configuration switches in real time, and add or delete host configurations in time, improving the response efficiency of host configurations.
Smart Images

Figure CN119512653A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to a host configuration method, device, storage medium and computer equipment. Background Art
[0002] The Cypress framework is a front-end automated testing framework that provides a complete set of tools for writing and running automated tests. It has an easy-to-use interface and rich functions, making it the first choice for many front-end testers. During the front-end testing process, since front-end testing needs to be performed in different environments, such as development environment, test environment, production environment, etc., there is a need to frequently switch host configurations.
[0003] When using the Cypress framework for front-end testing, the host configuration and switching can be done manually or through third-party tools. However, the former has low configuration efficiency and is prone to errors, while the latter requires the installation of additional third-party tools, and its performance and efficiency are difficult to guarantee. In summary, the existing Cypress framework has low efficiency in host configuration when performing front-end testing, which leads to low efficiency of front-end testing. Summary of the invention
[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defect that the existing Cypress framework in the prior art has low efficiency in host configuration when performing front-end testing, thereby resulting in low efficiency of front-end testing.
[0005] In a first aspect, the present application provides a host configuration method, the method comprising:
[0006] Before using the Cypress framework to perform automated testing on the target application, obtain application environment information and login user information of the target application;
[0007] Determine the target host configuration according to the application environment information and the login user information;
[0008] Read the target host configuration and write the target host configuration into the local Host file;
[0009] When the target application is automatically tested using the Cypress framework, the switch state change of the configuration switch in the page of the target application is detected in real time, and the Host file is updated according to the switch state change of the configuration switch in the page of the target application.
[0010] In one embodiment, updating the Host file according to the switch state change of the configuration switch in the page of the target application includes:
[0011] For each configuration switch in the page of the target application, if it is detected that the configuration switch changes from an off state to an on state, a host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is written into the Host file;
[0012] If it is detected that the configuration switch changes from the on state to the off state, the host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is cleared from the Host file.
[0013] In one embodiment, determining the target host configuration according to the application environment information and the login user information includes:
[0014] Obtain a preset configuration table, and query a corresponding sub-list in the configuration table according to the application environment information;
[0015] Read the sublist, and search the sublist for a host configuration that matches the logged-in user information;
[0016] If there is a host configuration matching the login user information in the sublist, the matching host configuration is determined as the target host configuration.
[0017] In one embodiment, determining the target host configuration according to the application environment information and the login user information includes:
[0018] Obtain a preset configuration table, and query a corresponding sub-list in the configuration table according to the application environment information;
[0019] Read the sublist, and search the sublist for a host configuration that matches the logged-in user information;
[0020] If there is no host configuration matching the login user information in the sublist, feature extraction is performed on the application environment information and the login user information using a preset target model, and a target host configuration is determined based on the feature extraction result.
[0021] In one embodiment, the updating process of the configuration table includes:
[0022] When the preset target model is used to perform feature extraction on the application environment information and the login user information, and the target host configuration is determined based on the result of the feature extraction, the target position corresponding to the login user information is determined in the sublist, and the target host configuration is added to the target position to complete the update of the configuration table.
[0023] In one embodiment, the real-time detection of a switch state change of a configuration switch in a page of the target application includes:
[0024] Obtain the target page currently displayed by the target application;
[0025] The configuration switch in the target page is identified, and the switch state of the identified configuration switch is detected to see if it has changed. If so, the switch state of the configuration switch whose switch state has changed is determined to be changed, so as to complete the detection of the switch state change of the configuration switch in the page of the target application.
[0026] In one embodiment, the obtaining the application environment information and the login user information of the target application includes:
[0027] Obtaining a deployment file of the target application;
[0028] Determining application environment information of the target application according to the deployment file;
[0029] The user identification of the user currently logged in to the target application is detected, and after corresponding user information is queried in a preset database according to the user identification, the queried user information is determined as the login user information of the target application.
[0030] In a second aspect, the present application provides a host configuration device, the device comprising:
[0031] An information determination module is used to obtain application environment information and login user information of the target application before using the Cypress framework to perform automated testing on the target application;
[0032] A configuration determination module, used to determine the target host configuration according to the application environment information and the login user information;
[0033] A configuration writing module, used for reading the target host configuration and writing the target host configuration into a local Host file;
[0034] The file update module is used to detect the switch state change of the configuration switch in the page of the target application in real time when the target application is automatically tested using the Cypress framework, and update the Host file according to the switch state change of the configuration switch in the page of the target application.
[0035] In a third aspect, the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the host configuration method described in any of the above embodiments.
[0036] In a fourth aspect, the present application provides a computer device, comprising: one or more processors, and a memory;
[0037] The memory stores computer-readable instructions, and when the one or more processors execute the computer-readable instructions, the steps of the host configuration method described in any one of the above embodiments are performed.
[0038] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0039] The host configuration method, device, storage medium and computer equipment provided by the present application include: before using the Cypress framework to perform automated testing on the target application, obtaining the application environment information and login user information of the target application, then determining the target host configuration according to the application environment information and login user information, then reading the target host configuration, and writing the target host configuration into the local Host file. When the target application is automated testing using the Cypress framework, the switch state change of the configuration switch in the page of the target application is detected in real time, and the Host file is updated according to the switch state change of the configuration switch in the page of the target application. By determining the target host configuration according to the application environment information and login user information before using the Cypress framework for automated testing, and then writing it into the local Host file, the host configuration is automatically determined and written locally, and the host configuration and switching can be completed quickly without manual modification or installation of third-party tools, thereby improving the efficiency of front-end testing. It is also possible to detect the configuration switch in real time, and add or delete the host configuration in time to improve the response efficiency of the host configuration. At the same time, in different network environments or application systems, this method can load the most appropriate host configuration to avoid target application failure or performance degradation due to configuration errors, thereby affecting the test results, and can combine the login user information to achieve personalized configuration services. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0041] Figure 1 A schematic diagram of a host configuration method provided in an embodiment of the present application;
[0042] Figure 2 A schematic diagram of a process for updating a Host file according to a switch state change of a configuration switch in a target application page provided in an embodiment of the present application;
[0043] Figure 3 A schematic diagram of a process for determining a target host configuration based on application environment information and login user information provided in an embodiment of the present application;
[0044] Figure 4 A schematic diagram of the structure of a host configuration device provided in an embodiment of the present application;
[0045] Figure 5 An internal structure diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] In one embodiment, the present application provides a host configuration method, and the following embodiment is described by applying the method to a server. It can be understood that the host configuration method can be executed by a single server or a server cluster composed of multiple servers, and the present application does not make specific restrictions on this.
[0048] like Figure 1 As shown, the present application provides a host configuration method, the method comprising:
[0049] S101: Before using the Cypress framework to perform automated testing on a target application, obtain application environment information and login user information of the target application.
[0050] Among them, the Cypress framework is a front-end automated testing framework that allows developers to write end-to-end tests to verify the application to be tested. The target application is an application with a front-end page, for example, the target application can be an APP, a website system, or a mini-program, etc.
[0051] In this step, when the tester needs to use the Cypress framework to perform automated testing on the target application, he can initiate a test instruction through the client. At this time, the server receives the test instruction, and before executing the automated test, the server will first determine the target application that the tester wants to perform automated testing based on the test instruction, and then obtain the application environment information and login user information of the target application to determine the corresponding host configuration, ensuring that subsequent automated testing can be carried out efficiently.
[0052] Specifically, application environment information refers to the environment configuration and dependency information required for the target application to run, including but not limited to the deployment environment, application name, application version, operating system information, hardware configuration information, etc. Login user information refers to the personal information of the user currently logged in to the target application, including but not limited to user name, user ID, user permissions, personal data, etc.
[0053] S102: Determine the target host configuration according to the application environment information and the login user information.
[0054] The target host configuration refers to the host configuration corresponding to the application environment information and login user information.
[0055] In this step, after the server determines the application environment information and the login user information of the target application, the server can determine the unique corresponding target host configuration based on the application environment information and the login user information.
[0056] Specifically, the host configuration is used to define the mapping relationship between the domain name and the IP address. It is understandable that when a user enters a URL that needs to be logged in in the application, the application will first automatically search for the corresponding IP address from the local Host file. If the corresponding IP address can be found in the local Host file, the application can use the IP address to open the corresponding web page. If the corresponding IP address cannot be found in the local Host file, the application will submit the URL to the DNS domain name resolution server for IP address resolution. Therefore, quickly and accurately configuring the host configuration of the target application can improve the efficiency of automated testing of the target application.
[0057] S103: Read the target host configuration and write the target host configuration into the local Host file.
[0058] The Host file refers to a file used to store local Host configurations. The Host file can establish a correspondence between some commonly used URL domain names and their corresponding IP addresses, and store these correspondences in the Host file. It should be noted that, unless otherwise specified, the Host file in this application refers to the local Host file.
[0059] In this step, when the target host configuration is determined, the target host configuration is read, and then the read target host configuration is written into the local Host file. In this way, when running the target application, if you need to obtain the IP address corresponding to a certain URL, you can directly access the local Host file to obtain the IP address corresponding to the URL, thereby ensuring efficient testing.
[0060] S104: When the target application is automatically tested using the Cypress framework, the switch state change of the configuration switch in the page of the target application is detected in real time, and the Host file is updated according to the switch state change of the configuration switch in the page of the target application.
[0061] In this step, when the target host configuration has been determined and the target host configuration has been written into the local Host file, the server can now start to perform automated testing on the target application. In the process of using the Cypress framework to perform automated testing on the target application, the server will detect the switch status of the configuration switch in the page of the target application in real time. When it is detected that the switch status of a configuration switch has changed, the local Host file is updated according to the switch status change of the configuration switch. In this way, the local Host file can be maintained in real time according to the running process of the target application, and the host configuration in the local Host file can be added or deleted in time. It can be understood that the host configuration in this application can include a certain website domain name and its corresponding IP address, and can also include multiple website domain names and the IP address corresponding to each website domain name.
[0062] The host configuration method, device, storage medium and computer equipment provided by the present application include: before using the Cypress framework to perform automated testing on the target application, obtaining the application environment information and login user information of the target application, then determining the target host configuration according to the application environment information and login user information, then reading the target host configuration, and writing the target host configuration into the local Host file. When the target application is automated testing using the Cypress framework, the switch state change of the configuration switch in the page of the target application is detected in real time, and the Host file is updated according to the switch state change of the configuration switch in the page of the target application. By determining the target host configuration according to the application environment information and login user information before using the Cypress framework for automated testing, and then writing it into the local Host file, the host configuration is automatically determined and written locally, and the host configuration and switching can be completed quickly without manual modification or installation of third-party tools, thereby improving the efficiency of front-end testing. It is also possible to detect the configuration switch in real time, and add or delete the host configuration in time to improve the response efficiency of the host configuration. At the same time, in different network environments or application systems, this method can load the most appropriate host configuration to avoid target application failure or performance degradation due to configuration errors, thereby affecting the test results, and can combine the login user information to achieve personalized configuration services.
[0063] like Figure 2 As shown, in one embodiment, updating the Host file according to the switch state change of the configuration switch in the page of the target application includes:
[0064] S201: For each configuration switch in the page of the target application, determine whether the configuration switch has a switch state change.
[0065] The switch state change refers to the on / off change of the configuration switch, and the switch state change includes the switch state changing from the on state to the off state and the switch state changing from the off state to the on state. The configuration switch refers to the switch used to turn on or off the corresponding host configuration.
[0066] In this step, during the process of using the Cypress framework to perform automated testing on the target application, each configuration switch in the page of the target application is detected, and it is determined whether there is a switch state change for each configuration switch.
[0067] S202: If it is detected that the configuration switch changes from the closed state to the open state, a host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is written into a Host file.
[0068] When it is detected that the switch state of the configuration switch changes from the off state to the on state, the host configuration corresponding to the configuration switch is determined, and then the host configuration corresponding to the configuration switch is written into the local Host file.
[0069] Furthermore, the process of determining the host configuration corresponding to the configuration switch may include: obtaining a control parameter of the configuration switch, querying the host configuration of the configuration switch according to the control parameter, and determining the queried host configuration as the host configuration corresponding to the configuration switch.
[0070] S203: If it is detected that the configuration switch changes from the on state to the off state, the host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is cleared from the Host file.
[0071] When it is detected that the switch state of the configuration switch changes from the on state to the off state, the host configuration corresponding to the configuration switch is determined, and then the host configuration corresponding to the configuration switch is cleared from the local Host file.
[0072] In this embodiment, by detecting the switch state change of the configuration switch in real time, the host configuration can be added or deleted in time to improve the response efficiency of the host configuration, and the test efficiency of the automated test on the target application can also be improved.
[0073] like Figure 3 As shown, in one embodiment, determining the target host configuration according to the application environment information and the login user information includes:
[0074] S301: Obtain a preset configuration table, and search for a corresponding sub-list in the configuration table according to application environment information.
[0075] Among them, the sublist is used to record the host configuration of different login user information contained in the corresponding application environment information. The configuration table is used to record the host configuration. The main table in the configuration table includes records of different application environment information. In the main table, each application environment information is a record. Each application environment information recorded in the main table corresponds to a slave table, which records the host configuration of different login user information in a certain application environment.
[0076] In this step, a pre-set configuration table is obtained, and then the application environment information is used to query the configuration table to determine the sub-list corresponding to the application environment information. Specifically, the configuration table is in a state of continuous maintenance, and each time a sub-list is determined, the configuration table needs to be re-obtained to synchronize the latest update of the configuration table.
[0077] S302: Read the sublist, and search the sublist for a host configuration that matches the login user information.
[0078] When the sublist corresponding to the application environment information is determined, a traversal query is performed in the sublist according to the login user information to find a host configuration that matches the login user information.
[0079] Furthermore, since the application environment information and the login user information contain a lot of relevant information, in the query process in S301 and S302, one or a combination of multiple information in the application environment information or the login user information can be used for query. The information used only needs to be able to uniquely determine the corresponding sub-list and host configuration in the configuration table. This application does not impose any specific restrictions on this.
[0080] S303: If there is a host configuration matching the login user information in the sublist, the matching host configuration is determined as the target host configuration.
[0081] When performing a traversal query in the sublist, if a host configuration matching the login user information is found in the sublist, it means that a host configuration matching the login user information exists in the sublist. In this case, the matching host configuration is determined as the target host configuration.
[0082] S304: If there is no host configuration matching the login user information in the sublist, feature extraction is performed on the application environment information and the login user information using a preset target model, and a target host configuration is determined based on the feature extraction result.
[0083] The target model is used to extract features from application environment information and login user information, and analyze the results of feature extraction to output the target host configuration.
[0084] When traversing and querying in the sublist, if no host configuration matching the login user information is found in the sublist, it means that there is no host configuration matching the login user information in the sublist. At this time, the server can use the preset target model to extract features of the application environment information and the login user information, and then determine the target host configuration based on the result of the feature extraction.
[0085] Specifically, in the process of using the target model to determine the target host configuration, based on the target model, feature extraction can be performed on the hardware configuration information, deployment environment, application name, application version, operating system information, etc. in the application environment information, as well as feature extraction on the personal data, user permissions, etc. in the logged-in user information. The target host configuration is determined by combining the results obtained after the feature extraction of the two.
[0086] In addition, the target model of the present application can be obtained by using the application environment sample information and the logged-in user sample information as training samples, the host configuration corresponding to the training samples as sample labels, and using the loss function to train the preset pre-trained model. During the training process, the server can input the training samples and their corresponding sample labels into the pre-trained model for forward propagation, and use the loss function in the back propagation of the pre-trained model to adjust the parameters of the pre-trained model until the pre-trained model meets certain iteration conditions. The pre-trained model that has been trained can be used as the target model. In addition, after obtaining the target model, it can be updated regularly or irregularly using the latest sample data.
[0087] In another embodiment, when there is no host configuration matching the logged-in user information in the sub-list, it is possible to initiate an information supplement instruction and receive files uploaded by the user or input content, based on which the target host configuration is determined. Other methods may also be used to determine the target host configuration, and this application does not impose any specific restrictions on this.
[0088] In this embodiment, the host configuration is determined in the configuration table by using the application environment information and the login user information. In this way, on the one hand, the host configuration can be accurately matched according to the specific application environment and user information, so that the target application runs more efficiently. For example, in different network environments (such as development environment, test environment, and production environment), the most suitable host configuration can be loaded in this way to avoid target application failure or performance degradation due to configuration errors, thereby affecting the results of automated testing. On the other hand, personalized configuration services can be implemented in combination with the login user information, and the matching host configuration can be quickly switched according to different login users.
[0089] In one embodiment, the updating process of the configuration table includes:
[0090] When the preset target model is used to extract features of the application environment information and the login user information, and the target host configuration is determined based on the results of the feature extraction, the target location corresponding to the login user information is determined in the sublist, and the target host configuration is added to the target location to complete the update of the configuration table.
[0091] In this embodiment, when no host configuration matching the login user information is found in the sublist, the target model is used to determine the target host configuration. After the target host configuration is determined, the determined target host configuration can be added to the corresponding position of the configuration table to complete the update of the configuration table. This can avoid using the target model to determine the same application environment information and login user information multiple times, thereby saving computing resources.
[0092] In one embodiment, detecting a switch state change of a configuration switch in a page of a target application in real time includes:
[0093] S1: Get the target page currently displayed by the target application.
[0094] S2: Identify the configuration switch in the target page, and detect whether the switch state of the identified configuration switch has changed. If changed, determine the switch state change of the configuration switch whose switch state has changed, so as to complete the detection of the switch state change of the configuration switch in the page of the target application.
[0095] The switch state includes an on state and an off state.
[0096] In this embodiment, whether the switch state of the identified configuration switch has changed can be determined by comparing the switch state detected this time with the switch state of the same configuration switch detected last time. By detecting the configuration switch in real time, the host configuration can be added or deleted in time, thereby improving the response efficiency of the host configuration and the test efficiency of the target application.
[0097] In one embodiment, obtaining application environment information and login user information of a target application includes:
[0098] S1: Get the deployment file of the target application.
[0099] S2: Determine application environment information of the target application according to the deployment file.
[0100] S3: Detecting the user ID of the current logged-in user of the target application, and querying the corresponding user information in a preset database according to the user ID, and determining the queried user information as the logged-in user information of the target application.
[0101] Among them, the deployment file refers to a series of configuration files used when deploying an application to a specific environment (such as a development environment, a test environment, a production environment, etc.), and the database refers to the database corresponding to the target application.
[0102] In this embodiment, the application environment information and the login user information of the target application are determined respectively through the deployment file and the database, so that the corresponding target host configuration is subsequently determined based on the application environment information and the login user information.
[0103] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0104] The host configuration device provided in an embodiment of the present application is described below. The host configuration device described below and the host configuration method described above can be referenced to each other.
[0105] like Figure 4 As shown, the present application provides a host configuration device 400, the device comprising:
[0106] The information determination module 401 is used to obtain the application environment information and login user information of the target application before using the Cypress framework to perform automated testing on the target application;
[0107] Configuration determination module 402, used to determine the target host configuration according to the application environment information and the login user information;
[0108] Configuration writing module 403, used for reading the target host configuration and writing the target host configuration into the local Host file;
[0109] The file update module 404 is used to detect the switch state change of the configuration switch in the page of the target application in real time when the target application is automatically tested using the Cypress framework, and update the Host file according to the switch state change of the configuration switch in the page of the target application.
[0110] In one embodiment, the file update module includes:
[0111] The configuration writing submodule is used for each configuration switch in the page of the target application. If it is detected that the configuration switch changes from the closed state to the open state, the host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is written into the Host file;
[0112] The configuration clearing submodule is used to determine the host configuration corresponding to the configuration switch if it is detected that the configuration switch changes from the on state to the off state, and clear the host configuration corresponding to the configuration switch from the host file.
[0113] In one embodiment, the configuration determination module includes:
[0114] A first query submodule is used to obtain a preset configuration table and query a corresponding sublist in the configuration table according to the application environment information;
[0115] The second query submodule is used to read the sublist and search the sublist for the host configuration that matches the login user information;
[0116] The first determination submodule is used to determine the matched host configuration as the target host configuration if there is a host configuration matching the login user information in the sublist.
[0117] In one embodiment, the configuration determination module includes:
[0118] A third query submodule is used to obtain a preset configuration table and query a corresponding sublist in the configuration table according to the application environment information;
[0119] The fourth query submodule is used to read the sublist and search the sublist for a host configuration that matches the login user information;
[0120] The second determination submodule is used to extract features from the application environment information and the login user information using a preset target model if there is no host configuration matching the login user information in the sublist, and determine the target host configuration based on the feature extraction result.
[0121] In one embodiment, the third query submodule includes:
[0122] The table update unit is used to determine the target position corresponding to the login user information in the sublist when the preset target model is used to extract features of the application environment information and the login user information, and determine the target host configuration based on the results of the feature extraction, and add the target host configuration to the target position to complete the update of the configuration table.
[0123] In one embodiment, the file update module includes:
[0124] The page acquisition submodule is used to obtain the target page currently displayed by the target application;
[0125] The switch detection submodule is used to identify the configuration switch in the target page and detect whether the switch state of the identified configuration switch has changed. If changed, the switch state change of the configuration switch whose switch state has changed is determined to complete the detection of the switch state change of the configuration switch in the page of the target application.
[0126] In one embodiment, the information determination module includes:
[0127] The file acquisition submodule is used to obtain the deployment files of the target application;
[0128] A first information determination submodule, used to determine application environment information of a target application according to a deployment file;
[0129] The second information determination submodule is used to detect the user identification of the current logged-in user of the target application, and after searching for corresponding user information in a preset database according to the user identification, determine the searched user information as the logged-in user information of the target application.
[0130] The division of each module in the above host configuration device is only for illustration. In other embodiments, the host configuration device can be divided into different modules as needed to complete all or part of the functions of the above host configuration device. Each module in the above host configuration device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0131] In one embodiment, the present application further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the host configuration method described in any of the above embodiments.
[0132] In one embodiment, the present application also provides a computer device, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the host configuration method described in any of the above embodiments.
[0133] Indicatively, Figure 5 As shown, Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 500 may be provided as a server. Figure 5The computer device 500 includes a processing component 502, which further includes one or more processors, and a memory resource represented by a memory 501, for storing instructions that can be executed by the processing component 502, such as an application. The application stored in the memory 501 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 502 is configured to execute instructions to perform the host configuration method of any of the above embodiments.
[0134] The computer device 500 may further include a power supply component 503 configured to perform power management of the computer device 500, a wired or wireless network interface 504 configured to connect the computer device 500 to a network, and an input / output (I / O) interface 505. The computer device 500 may operate based on an operating system stored in the memory 501, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0135] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0136] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish an entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only include those elements, but also include other elements that are not clearly listed, or also include elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. Herein, the singular "one", "one" and "described / the" may also include plural forms, unless the context clearly indicates another way. It should also be understood that the terms "include / comprise" or "have" etc. specify the existence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the existence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof. At the same time, the term "and / or" used in this specification includes any and all combinations of the relevant listed items.
[0137] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A host configuration method, characterized in that: The method comprises: Before using the Cypress framework to perform automated testing on the target application, obtain application environment information and login user information of the target application; Determine the target host configuration according to the application environment information and the login user information; Read the target host configuration and write the target host configuration into the local Host file; When the target application is automatically tested using the Cypress framework, the switch state change of the configuration switch in the page of the target application is detected in real time, and the Host file is updated according to the switch state change of the configuration switch in the page of the target application.
2. The host configuration method according to claim 1, characterized in that: The updating of the Host file according to the switch state change of the configuration switch in the page of the target application includes: For each configuration switch in the page of the target application, if it is detected that the configuration switch changes from an off state to an on state, a host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is written into the Host file; If it is detected that the configuration switch changes from the on state to the off state, the host configuration corresponding to the configuration switch is determined, and the host configuration corresponding to the configuration switch is cleared from the Host file.
3. The host configuration method according to claim 1, characterized in that: The step of determining the target host configuration according to the application environment information and the login user information includes: Obtain a preset configuration table, and query a corresponding sub-list in the configuration table according to the application environment information; Read the sublist, and search the sublist for a host configuration that matches the logged-in user information; If there is a host configuration matching the login user information in the sublist, the matching host configuration is determined as the target host configuration.
4. The host configuration method according to claim 1, characterized in that: The step of determining the target host configuration according to the application environment information and the login user information includes: Obtain a preset configuration table, and query a corresponding sub-list in the configuration table according to the application environment information; Read the sublist, and search the sublist for a host configuration that matches the logged-in user information; If there is no host configuration matching the login user information in the sublist, feature extraction is performed on the application environment information and the login user information using a preset target model, and a target host configuration is determined based on the feature extraction result.
5. The host configuration method according to claim 4, characterized in that: The updating process of the configuration table includes: When the preset target model is used to perform feature extraction on the application environment information and the login user information, and the target host configuration is determined based on the result of the feature extraction, the target position corresponding to the login user information is determined in the sublist, and the target host configuration is added to the target position to complete the update of the configuration table.
6. The host configuration method according to claim 1, characterized in that: The real-time detection of the switch state change of the configuration switch in the page of the target application includes: Obtain the target page currently displayed by the target application; The configuration switch in the target page is identified, and the switch state of the identified configuration switch is detected to see if it has changed. If so, the switch state of the configuration switch whose switch state has changed is determined to be changed, so as to complete the detection of the switch state change of the configuration switch in the page of the target application.
7. The host configuration method according to claim 1, characterized in that: The obtaining of the application environment information and the login user information of the target application includes: Obtaining a deployment file of the target application; Determining application environment information of the target application according to the deployment file; The user identification of the user currently logged in to the target application is detected, and after corresponding user information is queried in a preset database according to the user identification, the queried user information is determined as the login user information of the target application.
8. A host configuration device, characterized in that: The device comprises: An information determination module is used to obtain application environment information and login user information of the target application before using the Cypress framework to perform automated testing on the target application; A configuration determination module, used to determine the target host configuration according to the application environment information and the login user information; A configuration writing module, used for reading the target host configuration and writing the target host configuration into a local Host file; The file update module is used to detect the switch state change of the configuration switch in the page of the target application in real time when the target application is automatically tested using the Cypress framework, and update the Host file according to the switch state change of the configuration switch in the page of the target application.
9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the host configuration method according to any one of claims 1 to 7.
10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the host configuration method according to any one of claims 1 to 7 are performed.