CN115543805A - Case test environment switching method, device, equipment and storage medium - Google Patents

Case test environment switching method, device, equipment and storage medium Download PDF

Info

Publication number
CN115543805A
CN115543805A CN202211236916.8A CN202211236916A CN115543805A CN 115543805 A CN115543805 A CN 115543805A CN 202211236916 A CN202211236916 A CN 202211236916A CN 115543805 A CN115543805 A CN 115543805A
Authority
CN
China
Prior art keywords
environment
actual
expected
field
response
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211236916.8A
Other languages
Chinese (zh)
Inventor
王力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211236916.8A priority Critical patent/CN115543805A/en
Publication of CN115543805A publication Critical patent/CN115543805A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for switching and processing use case testing environments, wherein the environments for automatically executing use cases are set through created environment switch files and environment names of the environment switch files, corresponding configuration files are created based on the environment names, and access information is configured in the configuration files in a fixed format, so that when the execution environments of the use cases are switched, the configuration files with the corresponding names can be called based on the environment names of the environment switch files, and access data is read according to the access information configured in the configuration files, so that the use cases can be automatically accessed under different execution environments, the problems that the execution of coded automatic use cases has strong dependence on the environments, the access information which is strongly related to the environments required by the use cases and the returned expected results cannot be shared among different environments are solved, the technical problem that the use cases cannot meet the execution under different environments is caused, and the maintenance workload of the automatic use cases is increased.

Description

Case test environment switching method, device, equipment and storage medium
Technical Field
The application relates to the technical field of financial science and technology, in particular to a method, a device, equipment and a storage medium for switching case testing environments.
Background
The online system is a system in which input data can be directly input into a computer from a data source for processing, and output data, i.e., a processing result, can be directly transmitted to a user.
For most systems providing interface service, the dependent external system interface is mock when code automation is realized, expected results of input and output of code automation use cases are fixed, and data cleaning before and after execution of the automation use cases is needed to ensure that the use cases are not influenced by the environment. In this case, the automatic use case generally cannot be executed in the joint debugging environment, otherwise, the accuracy of the joint debugging data is affected, or data collision occurs, so that dirty data causes failed use case execution.
In a bank system, the service flow is very complex, and the maintenance cost of the environment is high, so that the code automation environment and the joint debugging environment need to be shared. The financial commission online system is connected with a plurality of different systems of a bank, depends on a large number of external system interfaces, and cannot realize mock for the data interface of each external system due to code automation; therefore, the execution of the coded automation use case has strong dependence on the environment, and the reference information and the return expected result which are needed by the use case and are strongly related to the environment, such as the client number, the card number, the product and the like, cannot be shared among different environments, so that the technical problem that the use case cannot be executed in different environments is caused, and the maintenance workload of the automation use case is increased.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for switching the test environments of a case, which solve the technical problems that the execution of a coded automation case has strong dependence on the environment, the environment required by the case is strongly related to the access information and the return expected result cannot be shared among different environments, so that the case cannot meet the execution under different environments, and the maintenance workload of the automation case is increased.
In view of this, a first aspect of the present application provides a method for switching a case test environment, where the method includes:
s1, creating an environment switch file, and setting an environment name of automatic execution in the environment switch file;
s2, creating a configuration file, naming the configuration file by the environment name configured in the environment switch file, and configuring access information in the configuration file according to a fixed format;
s3, reading the environment name of the environment switch file during the execution of the use case, and acquiring the corresponding configuration file according to the environment name;
s4, reading the access data according to the access information configured in the configuration file;
and S5, if the environment of the use case execution needs to be switched, setting the environment name of the environment switch file as the environment name corresponding to the switched environment, and returning to the step S3.
Optionally, the step S4 specifically includes:
s41, acquiring first access data through an SQL statement according to the database access information configured in the configuration file;
and S42, acquiring second access data through an interface address according to the third-party system access information configured in the configuration file.
Optionally, step S41 is followed by:
s411, transmitting the expected result response code of the use case and the first input parameter data into an interface test template according to map type parameters;
s412, acquiring an actual response message of the first parameter data, wherein the actual response message comprises an actual field, and the actual field comprises a field value and a parameter response code;
and S413, obtaining a response result according to the participation response code and the expected result response code, wherein the response result comprises response success and response failure.
Optionally, after the step S413, the method further includes:
s414, if the response result is successful, according to the source of the field value of the actual response message, and according to a preset field value generation rule, creating an expected value corresponding to the actual field;
s415, analyzing the actual response message, and comparing the results of each actual field of the actual response message with the corresponding expected value, if each actual field of the actual response message is consistent with the corresponding expected value, the case comparison result passes, otherwise, the case comparison result fails.
Optionally, after the step S413, the method further includes:
s416, if the response result is response failure, transmitting an expected result response code of the use case and the actual response result into the interface test template by using a map type parameter;
s417, generating an expected response message of the use case, wherein the expected response message comprises an expected field, the expected field comprises a field value and an expected result response code;
s418, comparing the expected field, the field value contained in the expected field, the expected result response code with the actual field, the field value contained in the actual field and the parameter response code, if the expected field, the field value contained in the actual field and the parameter response code are consistent, passing the case comparison result, otherwise failing to pass the case comparison result.
Optionally, the source of the field value of the actual response packet includes interface entry, user information and product information of the database, and is obtained by calculation according to product configuration.
Optionally, the creating, according to the source of the field value of the actual response packet and according to the preset field value generation rule, the expected value of the corresponding actual field specifically includes:
and acquiring the expected value corresponding to the actual field from a database according to the source of the field value of the actual response message and the database access information.
A second aspect of the present application provides a device for switching between use case testing environments, the device comprising:
the system comprises a first creating unit, a second creating unit and a control unit, wherein the first creating unit is used for creating an environment switch file, and setting an environment name for automatic execution in the environment switch file;
a second creating unit, configured to create a configuration file, name the configuration file by the environment name configured in the environment switch file, and configure access information in the configuration file according to a fixed format;
the execution unit is used for reading the environment name of the environment switch file during execution and acquiring the corresponding configuration file according to the environment name;
the parameter accessing unit is used for reading parameter accessing data according to the access information configured in the configuration file;
and the environment switching unit is used for setting the environment name of the environment switch file as the environment name corresponding to the switched environment if the environment of the case execution needs to be switched, and skipping to the execution unit.
A third aspect of the present application provides a case test environment switching processing device, where the device includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the steps of the case test environment switching processing method according to the first aspect.
A fourth aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium is configured to store a program code, and the program code is configured to execute the steps of the case test environment switching processing method according to the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages:
the application provides a use case test environment switching processing method, which sets an environment for automatic execution of use cases through a created environment switch file and an environment name of the environment switch file, creates a corresponding configuration file based on the environment name, and configures access information in the configuration file in a fixed format, so that when the execution environment of the use cases is switched, the configuration file with the corresponding name can be called based on the environment name of the environment switch file, access data are read according to the access information configured in the configuration file, automatic access of the use cases under different execution environments is realized, the problems that the execution of coded automatic use cases has strong dependence on the environment, the access information which is strongly related to the environment required by the use cases and the returned expected result cannot be shared among different environments are solved, the technical problem that the use cases cannot meet the execution under different environments is caused, and the maintenance workload of the automatic use cases is increased.
Drawings
FIG. 1 is a flowchart of a method for switching example test environments in an embodiment of the present application;
FIG. 2 is a schematic structural diagram of a device for switching use case testing environments in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a case test environment switching device in an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The application designs a method, a device, equipment and a storage medium for switching the test environments of the use cases, and solves the technical problems that the accuracy of joint debugging data is influenced or data conflict occurs because an automatic use case cannot be executed in the joint debugging environment, and the execution of the use case fails because dirty data occurs.
For easy understanding, please refer to fig. 1, in which fig. 1 is a flowchart illustrating a method for switching a use case testing environment according to an embodiment of the present application, and as shown in fig. 1, the method specifically includes:
s1, creating an environment switch file, and setting an environment name of automatic execution in the environment switch file;
it should be noted that, an environment switch file, for example env.
It is understood that when the environment name of the environment switch file is changed, the environment is switched to the environment with the changed environment switch file corresponding to the environment name.
S2, creating a configuration file, naming the configuration file by the environment name configured in the environment switch file, and configuring access information in the configuration file according to a fixed format;
it should be noted that, since different environments are distinguished only by environment names, configuration files are correspondingly created, and the configuration files are named by the environment names configured in the environment switch file, different configuration files correspond to corresponding environments based on the environment names. The access information, such as access address and port of application service, DB instance information, redis access instance information, etc., is configured in a fixed format in the configuration file.
That is, each environment corresponds to a configuration file, and the configuration files are distinguished by environment names.
S3, reading the environment name of the environment switch file during the execution of the use case, and acquiring a corresponding configuration file according to the environment name;
it should be noted that, when the use case is executed, the environment name configured by the environment switch file is first read, and then the configuration file with the corresponding name is obtained based on the environment name, the environment switch file and the configuration file are associated by the environment name, and based on the current environment name of the environment switch file, the configuration file corresponding to the same environment name can be obtained.
S4, reading the access data according to the access information configured in the configuration file;
it should be noted that after the configuration file corresponding to the environment name is obtained, the corresponding access data may be read according to the access information configured in the configuration file, for example, according to the access address and the port of the application service; DB instance information; the redis accesses the instance information, and requests an address and a port through application service respectively; access address, port of DB; a database name; and accessing a user name, a password and the like to obtain corresponding reference data.
And S5, if the environment of the case execution needs to be switched, setting the environment name of the environment switch file as the environment name corresponding to the switched environment, and returning to the step S3.
It should be noted that, based on the technology that can obtain the configuration file by the environment name in different environments, if the environment for executing the use case needs to be switched, only the environment name of the environment switch file needs to be changed to the environment name corresponding to the environment after switching, and the step S3 is returned again, so that the corresponding configuration file is obtained based on the environment name of the environment switch file. It can be understood that, in case testing, after environment switching, automatic parameter transmission can still be performed on the parameter input data required by the case through the pre-configured configuration file corresponding to the environment name, so that the technical problems that execution of the coded automatic case has strong dependence on the environment, the parameter input information required by the case and the returned expected result cannot be shared among different environments, and the case cannot be executed in different environments are solved, and the maintenance workload of the automatic case is increased.
Further, step S4 specifically includes:
s41, acquiring first access data through an SQL statement according to the database access information configured in the configuration file;
and S42, acquiring second access data through the interface address according to the third-party system access information configured in the configuration file.
It should be noted that, according to the first embodiment of the present application, if the entry data in the database needs to be obtained, the entry data needed, for example, the customer number, the card number, the product number, and other information needed for purchasing the interface, needs to be read from the database table through the SQL statement according to the database access information of the system under test configured in the configuration file. If the data of the third-party system needs to be acquired, the access data needs to be acquired through the interface address according to the third-party system access information configured in the configuration file, for example, the client information is acquired through the interface address of the account opening interface.
Further, step S41 is followed by:
s411, transmitting expected result response codes of the use cases and the first input parameters into the interface test template according to map type parameters;
s412, acquiring an actual response message of the first parameter data, wherein the actual response message comprises an actual field, the actual field comprises a field value and a parameter response code;
and S413, obtaining a response result according to the reference response code and the expected result response code, wherein the response result comprises response success and response failure.
It should be noted that the expected result response code of the use case and the first input parameter are transmitted to the interface test template according to the map type parameter, and meanwhile, the actual response message of the first input parameter data is obtained, and the input parameter response code in the actual response message is compared with the expected result response code, for example, the input parameter response code fed back by the interface is 00000, which is consistent with the expected result response code, the response result is obtained as a response success, otherwise, the response failure is obtained.
Further, step S413 is followed by:
s414, if the response result is successful, establishing an expected value corresponding to the actual field according to the source of the field value of the actual response message and a preset field value generation rule;
and S415, analyzing the actual response message, comparing the results of each actual field of the actual response message with the corresponding expected value, if each actual field of the actual response message is consistent with the corresponding expected value, passing the case comparison result, otherwise failing to pass the case comparison result.
It should be noted that, if the expected interface response is successful, the field value source of the actual response packet is further analyzed, and the expected value corresponding to the actual field is created according to the field value generation rule. And analyzing actual fields of the actual response message one by one, comparing each actual field with the corresponding calculated expected value, if the comparison is consistent, the case comparison result passes, otherwise, the case comparison result fails.
Specifically, the method comprises the following steps:
1. the source of the field value of the actual response message includes: interface entries (e.g., customer number, card number, product number, ta number, amount, etc.), user information (e.g., customer name, etc.) and product information (e.g., product name, currency, confirmation day, open date, etc.) of the database, and calculations based on product configuration (e.g., order status, payment status, etc.).
2. Creating an expected value of an actual response message: and acquiring field information required by the actual field of the actual response message from db according to the information such as the number of the participating customer, the card number, the product number and the like, for example, inquiring a customer table through the customer number and the card number to acquire the information (the customer name and the like) of the customer, inquiring the product information and the type of the product through the product number, and confirming the order state, the payment state and the like according to the product type.
3. And comparing the results, namely after obtaining the expected value of the actual response message through the input parameters, carrying out one-to-one corresponding comparison with the actual field of the actual response message, wherein if the expected result is consistent with the actual result, the case comparison result passes, otherwise, the case comparison result fails.
Further, step S413 is followed by:
s416, if the response result is response failure, transmitting the expected result response code and the actual response result of the use case into the interface test template by using the map type parameter;
s417, generating an expected response message of the use case, wherein the expected response message comprises an expected field, an expected field containing a field value and an expected result response code;
s418, comparing the expected field, the expected field containing field value, the expected result response code with the actual field, the actual field containing field value and the reference response code, if the expected field and the expected field containing field value are consistent with the actual field, the case comparison result is passed, otherwise, the case comparison result is failed.
It should be noted that, if the response result is a response failure, the expected result response code and the actual response result of the use case need to be transmitted to the interface test template by using a map type parameter, the expected result response code and the actual response result are compared, and meanwhile, the expected field result is generated according to a failure scene, and the field values of the fields are checked one by one. The method comprises the following specific steps:
1. and respectively comparing the response code and the response information transmitted by the use case with the response code and the response information actually returned by the system, wherein the results are consistent, the use case passes, and otherwise, the use case fails.
2. And judging that the db has no new order flow according to the client number, the card number, the product and the ordering time, or else, using the case fails.
Further, creating an expected value corresponding to the actual field according to a preset field value generation rule according to the source of the field value of the actual response packet specifically includes:
and acquiring the expected value corresponding to the actual field from the database according to the source of the field value of the actual response message and the database access information.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a device for switching a use-case test environment according to an embodiment of the present application, and as shown in fig. 2, the device specifically includes:
a first creating unit 201 configured to create an environment switch file in which an environment name for automated execution is set;
a second creating unit 202, configured to create a configuration file, name the configuration file by an environment name configured in the environment switch file, and configure access information in the configuration file according to a fixed format;
the execution unit 203 is used for reading the environment name of the environment switch file during execution and acquiring a corresponding configuration file according to the environment name;
the parameter accessing unit 204 is configured to read parameter accessing data according to the access information configured in the configuration file;
and the environment switching unit 205 is configured to set the environment name of the environment switch file as the environment name corresponding to the environment after switching if the environment for executing the use case needs to be switched, and jump to the execution unit.
The embodiment of the present application further provides another example test environment switching device, as shown in fig. 3, for convenience of description, only a part related to the embodiment of the present application is shown, and details of the specific technology are not disclosed, please refer to the method part of the embodiment of the present application. The terminal may be any terminal device including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA, abbreviated as "Personal Digital Assistant"), a Sales terminal (POS, abbreviated as "Point of Sales"), a vehicle-mounted computer, etc., and the terminal is taken as a mobile phone as an example:
fig. 3 is a block diagram illustrating a partial structure of a mobile phone related to a terminal provided in an embodiment of the present application. Referring to fig. 3, the handset includes: radio Frequency (RF) circuit 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuit 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power source 1090. Those skilled in the art will appreciate that the handset configuration shown in fig. 3 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 3:
RF circuit 1010 may be used for receiving and transmitting signals during a message transmission or a call, and in particular, for receiving downlink information from a base station and processing the received downlink information to processor 1080; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuit 1010 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (Low Noise Amplifier; LNA), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), wideband Code Division Multiple Access (WCDMA), long Term Evolution (LTE), email), short Message Service (SMS), etc.
The memory 1020 may be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also called a touch screen, may collect a touch operation performed by a user on or near the touch panel 1031 (e.g., an operation performed by a user on or near the touch panel 1031 using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a predetermined program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 may be implemented by various types such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the cellular phone. The Display unit 1040 may include a Display panel 1041, and optionally, the Display panel 1041 may be configured by using a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near the touch panel 1031, the touch operation is transmitted to the processor 1080 to determine the type of the touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of the touch event. Although in fig. 3, the touch panel 1031 and the display panel 1041 are two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 may be integrated to implement the input and output functions of the mobile phone.
The cell phone may also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 1041 and/or the backlight when the mobile phone moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 1060, speaker 1061, microphone 1062 may provide an audio interface between the user and the handset. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then processed by the audio data output processor 1080 and then sent to, for example, another cellular phone via the RF circuit 1010, or output to the memory 1020 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help the user to receive and send e-mail, browse web page and access streaming media etc. through WiFi module 1070, it provides wireless broadband internet access for the user. Although fig. 3 shows the WiFi module 1070, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1080 is a control center of the mobile phone, connects various parts of the whole mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 1020 and calling data stored in the memory 1020, thereby integrally monitoring the mobile phone. Optionally, processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor, which primarily handles operating systems, user interfaces, application programs, etc., and a modem processor, which primarily handles wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
The handset also includes a power source 1090 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1080 via a power management system to manage charging, discharging, and power consumption via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In the embodiment of the present application, the processor 1080 included in the terminal further has the following functions:
s1, creating an environment switch file, and setting an environment name of automatic execution in the environment switch file;
s2, creating a configuration file, naming the configuration file by the environment name configured in the environment switch file, and configuring access information in the configuration file according to a fixed format;
s3, reading the environment name of the environment switch file during execution of the use case, and acquiring a corresponding configuration file according to the environment name;
s4, reading the access data according to the access information configured in the configuration file;
and S5, if the environment of the case execution needs to be switched, setting the environment name of the environment switch file as the environment name corresponding to the switched environment, and returning to the step S3.
The embodiment of the present application further provides a computer-readable storage medium, configured to store a program code, where the program code is configured to execute any one implementation manner of a case test environment switching method in the foregoing embodiments.
The embodiment of the application provides a method, a device, equipment and a storage medium for switching a use case testing environment, wherein the environment of automatic execution of the use case is set through a created environment switch file and an environment name of the environment switch file, a corresponding configuration file is created based on the environment name, and access information is configured in the configuration file in a fixed format, so that when the execution environment of the use case is switched, the configuration file with the corresponding name can be called based on the environment name of the environment switch file, and access data is read according to the access information configured in the configuration file, so that automatic access of the use case in different execution environments is realized, the problems that the execution of a coded automatic use case has strong dependence on the environment, the access information which is strongly related to the environment required by the use case and a returned expected result cannot be shared among different environments are solved, the technical problem that the use case cannot meet the execution under different environments is solved, and the maintenance workload of the automatic use case is increased.
Furthermore, interface parameters required by the automatic test case in the technical scheme provided by the embodiment of the application can be automatically adapted and generated, and the condition that the test personnel need to synchronously adjust the case parameters to adapt to the tested environment due to the change of the environment is reduced; the technical scheme provided by the embodiment of the application can reduce the number manufacturing difficulty of testers, and the system can automatically read or generate data generated by a third-party system required by a case as an input parameter without manually manufacturing the number in each third-party system depending on each environment; meanwhile, the tester does not need to write down response result assertion, and can automatically calculate and match according to rules of different input parameters and interface generation results, so that whether the response message field and the table falling information are correct or not can be automatically compared.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that, in this application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, which are essential or part of the technical solutions contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for switching and processing use case testing environment is characterized by comprising the following steps:
s1, creating an environment switch file, and setting an environment name of automatic execution in the environment switch file;
s2, creating a configuration file, naming the configuration file by the environment name configured in the environment switch file, and configuring access information in the configuration file according to a fixed format;
s3, reading the environment name of the environment switch file during the execution of the use case, and acquiring the corresponding configuration file according to the environment name;
s4, reading the access data according to the access information configured in the configuration file;
and S5, if the environment of the use case execution needs to be switched, setting the environment name of the environment switch file as the environment name corresponding to the switched environment, and returning to the step S3.
2. The use case testing environment switching processing method according to claim 1, wherein the step S4 specifically includes:
s41, acquiring first access data through an SQL statement according to the database access information configured in the configuration file;
and S42, acquiring second access data through an interface address according to the third-party system access information configured in the configuration file.
3. The method for processing case testing environment switch according to claim 2, wherein the step S41 is followed by:
s411, transmitting the expected result response code of the use case and the first input parameter into an interface test template according to a map type parameter;
s412, acquiring an actual response message of the first parameter data, wherein the actual response message comprises an actual field, and the actual field comprises a field value and a parameter response code;
and S413, obtaining a response result according to the participation response code and the expected result response code, wherein the response result comprises response success and response failure.
4. The use case test environment switching processing method according to claim 3, further comprising after the step S413:
s414, if the response result is successful, according to the source of the field value of the actual response message, and according to a preset field value generation rule, creating an expected value corresponding to the actual field;
s415, analyzing the actual response message, and comparing the results of each actual field of the actual response message with the corresponding expected value, if each actual field of the actual response message is consistent with the corresponding expected value, the case comparison result passes, otherwise, the case comparison result fails.
5. The method for processing case testing environment switch according to claim 3, further comprising after step S413:
s416, if the response result is response failure, transmitting an expected result response code of the use case and the actual response result into the interface test template by using a map type parameter;
s417, generating an expected response message of the use case, wherein the expected response message comprises an expected field, the expected field comprises a field value and an expected result response code;
s418, comparing the expected field, the field value contained in the expected field, the expected result response code with the actual field, the field value contained in the actual field and the parameter response code, if the expected field, the field value contained in the actual field and the parameter response code are consistent, passing the case comparison result, otherwise failing to pass the case comparison result.
6. The use case testing environment switching processing method according to claim 4, wherein the source of the field value of the actual response packet includes interface access parameters, user information and product information of the database, and is calculated according to product configuration.
7. The use case testing environment switching processing method according to claim 4, wherein the creating, according to a source of a field value of the actual response packet and according to a preset field value generation rule, an expected value corresponding to an actual field specifically includes:
and acquiring the expected value corresponding to the actual field from a database according to the source of the field value of the actual response message and the database access information.
8. A use case test environment switch processing apparatus, comprising:
the system comprises a first creating unit, a second creating unit and a control unit, wherein the first creating unit is used for creating an environment switch file, and setting an environment name for automatic execution in the environment switch file;
a second creating unit, configured to create a configuration file, name the configuration file by the environment name configured in the environment switch file, and configure access information in the configuration file according to a fixed format;
the execution unit is used for reading the environment name of the environment switch file during execution of the use case and acquiring the corresponding configuration file according to the environment name;
the parameter entering unit is used for reading parameter entering data according to the access information configured in the configuration file;
and the environment switching unit is used for setting the environment name of the environment switch file as the environment name corresponding to the switched environment and jumping to the execution unit if the environment of the use case execution needs to be switched.
9. A use case test environment switch processing apparatus, the apparatus comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is used for executing the case testing environment switching processing method of any claim 1-7 according to the instructions in the program codes.
10. A computer-readable storage medium for storing program code for executing the use case test environment switch processing method according to any one of claims 1 to 7.
CN202211236916.8A 2022-10-10 2022-10-10 Case test environment switching method, device, equipment and storage medium Pending CN115543805A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211236916.8A CN115543805A (en) 2022-10-10 2022-10-10 Case test environment switching method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211236916.8A CN115543805A (en) 2022-10-10 2022-10-10 Case test environment switching method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115543805A true CN115543805A (en) 2022-12-30

Family

ID=84733518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211236916.8A Pending CN115543805A (en) 2022-10-10 2022-10-10 Case test environment switching method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115543805A (en)

Similar Documents

Publication Publication Date Title
US20150106945A1 (en) Method, device and apparatus for acquiring security state of mobile terminal
CN104516812A (en) Method and device for testing software
CN111078556B (en) Application testing method and device
CN107943683A (en) A kind of test script generation method, device, electronic equipment and storage medium
CN107943685B (en) Traversal path generation method and device, server and storage medium
CN111340587A (en) Virtual commodity management method and related device
CN104809055B (en) Application program testing method and device based on cloud platform
CN115904950A (en) Test case generation method, device, equipment and storage medium
CN112540996A (en) Service data verification method and device, electronic equipment and storage medium
CN112131093A (en) Chaos test-based test case automatic generation method and device
CN105005529A (en) Application testing method and apparatus
CN107423123A (en) Method for scheduling task, device, storage medium and electronic equipment
CN116881143A (en) Data object copying abnormality investigation method, device, equipment and storage medium
CN116303085A (en) Test reason analysis method, device, equipment and storage medium
CN115794654A (en) Test case distribution processing method, system, equipment and storage medium
CN114064447B (en) Interface testing method and device, storage medium and terminal
CN115543805A (en) Case test environment switching method, device, equipment and storage medium
CN110633192B (en) Test method, test device, terminal equipment and computer readable storage medium
CN106657278B (en) Data transmission method and device and computer equipment
CN112667868A (en) Data detection method and device
CN110809234A (en) Figure category identification method and terminal equipment
CN112418835A (en) Method and related device for testing online bank payment process
CN115905008A (en) Method, device, equipment and storage medium for automatically generating test case
CN116303060A (en) ESB call request processing method, device, system, equipment and storage medium
CN110569234A (en) Data checking method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination