CN113377678B - Test environment switching method and device, electronic equipment and storage medium - Google Patents

Test environment switching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113377678B
CN113377678B CN202110788297.2A CN202110788297A CN113377678B CN 113377678 B CN113377678 B CN 113377678B CN 202110788297 A CN202110788297 A CN 202110788297A CN 113377678 B CN113377678 B CN 113377678B
Authority
CN
China
Prior art keywords
test environment
website
domain name
accessed
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110788297.2A
Other languages
Chinese (zh)
Other versions
CN113377678A (en
Inventor
邱明星
叶飞翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guahao Net Hangzhou Technology Co Ltd
Original Assignee
Guahao Net Hangzhou Technology 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 Guahao Net Hangzhou Technology Co Ltd filed Critical Guahao Net Hangzhou Technology Co Ltd
Priority to CN202110788297.2A priority Critical patent/CN113377678B/en
Publication of CN113377678A publication Critical patent/CN113377678A/en
Application granted granted Critical
Publication of CN113377678B publication Critical patent/CN113377678B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention discloses a test environment switching method, a device, electronic equipment and a storage medium. The method comprises the following steps: under the condition that the test environments of the application program are switched, acquiring a website to be accessed, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed; determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website; and accessing a server of the second test environment according to the target access website. The technical scheme of the embodiment of the invention solves the problems of low efficiency, long time consumption and increased workload of testers in the manual switching new environment in the test environment switching method in the prior art, realizes automatic test in a plurality of test environments and improves the test efficiency.

Description

Test environment switching method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a test environment switching method and device, electronic equipment and a storage medium.
Background
Information technology has become the first productivity of social development, and software is the most important component in information technology. With the rapid development of software quality assurance theory and technology, various services can be realized by developing application programs, and in the development and test stage, multiple test environments are often involved, and testing needs to be performed under the multiple test environments to ensure that the application programs are available.
In the prior art, when a target application program needs to be tested under a plurality of different test environments, the corresponding relation between a website to be accessed in the target application program and the test environments (see fig. 1) needs to be manually modified in the process of switching the test environments each time, and the source program of the target application program needs to be packaged and reinstalled, so that the packaging process needs to be manually performed, and the manual switching of the new environments is low in efficiency and long in time consumption, and the workload of testers is increased.
Disclosure of Invention
The embodiment of the invention provides a test environment switching method, a device, electronic equipment and a storage medium, so that the test can be automatically performed in a plurality of test environments, and the effects of improving the test efficiency and reducing the labor cost are achieved.
In a first aspect, an embodiment of the present invention provides a test environment switching method, where the method includes:
under the condition that the test environment of the application program is switched, acquiring a website to be accessed, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed;
determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
and accessing a server of the second test environment according to the target access website.
In a second aspect, an embodiment of the present invention further provides a test environment switching apparatus, where the apparatus includes:
the system comprises a first test environment domain name determining module, a second test environment domain name determining module and a second test environment domain name determining module, wherein the first test environment domain name determining module is used for acquiring a website to be accessed under the condition that the test environment of an application program is switched, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed;
the target access website obtaining module is used for determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
and the server access module is used for accessing the server of the second test environment according to the target access website.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a storage means for storing one or more programs;
the program, when executed by the processor, causes the processor to implement a test environment switching method as provided by any embodiment of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a test environment switching method as provided by any of the embodiments of the present invention.
The technical scheme of the embodiment is suitable for determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed by acquiring the website to be accessed under the condition that the test environment of the application program is switched. And determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website. Wherein, the mapping table of the domain name of the test environment can be modified in real time and is convenient to maintain. According to the target access website, the server of the second test environment is accessed, the test in a plurality of test environments can be automatically realized, the technical problems that the efficiency of manually switching a new environment is low, the time consumption is long and the workload of a tester is more in each time when the test environment is switched in the existing environment test switching method are solved, and the technical effects of improving the test efficiency and reducing the labor cost are achieved.
Drawings
In order to more clearly illustrate the technical solution of the exemplary embodiments of the present invention, a brief description is given below of the drawings required for describing the embodiments. It is obvious that the drawings presented are only drawings of some of the embodiments of the invention to be described, and not all the drawings, and that other drawings can be made according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a test environment switching method provided in the prior art;
FIG. 2 is a flow chart of a test environment switching method according to a first embodiment of the present invention;
fig. 3 is a schematic flow chart of a test environment switching method according to a second embodiment of the present invention;
fig. 4 is a flow chart of a test environment switching method according to a third embodiment of the present invention;
fig. 5 is a schematic diagram of a test environment switching device according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 2 is a schematic flow chart of a test environment switching method provided in an embodiment of the present invention, where the embodiment is applicable to a situation of implementing a self-defined switching of test environments by processing websites to be accessed in a situation that a test environment of an application program is switched, and the method may be implemented by a test environment switching device, where the test environment switching device may be implemented in a software and/or hardware manner, and the test environment switching device may be integrated in an electronic device such as a computer or a server.
As shown in fig. 2, the method of the present embodiment includes:
s110, under the condition that the test environments of the application program are switched, acquiring a website to be accessed, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed.
The website to be accessed can be a website to be accessed at the current moment. The first test environment may be understood as the environment before a switch of the test environment of the application occurs. The first test environment domain name may be a domain name of the test environment before the switching of the test environment of the application occurs. Alternatively, the first test environment domain name may be a domain name of a server.
Specifically, under the condition that the test environment of the application program is switched, the website which needs to be accessed at the current moment is obtained as the website to be accessed. Based on the components of the web site, a first test environment domain name including a first test environment in the web site to be accessed may be determined.
Alternatively, there may be various ways of obtaining the website to be accessed, which are not limited herein, for example, receiving the website to be accessed input by the user; or, the website to be accessed is obtained based on a user operation, wherein the user operation may be an operation of clicking a button or touching a screen by a user, and it should be noted that the user operation is not specifically limited.
S120, determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website.
The second test environment may be understood as an environment after the test environment of the application program is switched. The second test environment domain name may be a domain name of the test environment after the test environment of the application program is switched. The test environment domain name mapping table may be a correspondence table between an environment domain name of the test environment before the test environment is switched and an environment domain name of the test environment after the test environment is switched. The target access web address may be a web address obtained by replacing a first test environment domain name included in the web address to be accessed with a second test environment domain name.
Specifically, according to the test environment domain name mapping table of the test environment, a second test environment domain name of the second test environment corresponding to the first test environment domain name can be determined. Furthermore, the first test environment domain name contained in the website to be accessed can be replaced by the second test environment domain name corresponding to the first test environment domain name, and then the replaced website to be accessed can be obtained. And taking the replaced website to be accessed as a target access website.
For example, the website to be accessed is http:// A-host/Apath, the first test environment domain name is A-host, the second test environment domain name corresponding to the first test environment domain name is A1-host, and then the target access website is http:// A1-host/Apath.
Alternatively, the first test environment domain name contained in the website to be accessed may be replaced by the second test environment domain name, so as to obtain the target access website:
and based on the method exchange, replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website.
The method exchange can be used for replacing a first testing environment domain name contained in the website to be accessed with a second testing environment domain name. Alternatively, the Method exchange may be Method Swizzling in Objective-C.
Specifically, the first test environment domain name contained in the web site to be accessed can be replaced with the second test environment domain name by the Method Swizzling in the Objective-C. Further, a target access website can be obtained.
Illustratively, the method exchange may be an (initWithURL) initialization method, and then the replacement of the first test environment domain name contained in the web site to be accessed with the second test environment domain name may be implemented by the following statement:
-(instancetype)
initWithURL:(NSURL*)URL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval;
wherein the URL is a website to be accessed, the cachePolicy is an acquisition policy, and the timeoutInterval is an acquisition timeout value.
Optionally, in order to avoid abnormality in the replacement of the environmental domain name, after the target access website is obtained, it may be further determined whether the test environmental domain name included in the target access website is a second test environmental domain name corresponding to the first test environmental domain name. Specifically, if so, the access operation can be performed according to the target access website. If not, re-executing the test environment domain name mapping table based on the test environment, determining a second test environment domain name of the second test environment corresponding to the first test environment domain name, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name.
S130, accessing a server of the second test environment according to the target access website.
Specifically, according to the target access website, the target access website can be analyzed, and then, the second test environment domain name contained in the target access website can be determined. And accessing a server of a second test environment corresponding to the second test environment domain name according to the second test environment domain name contained in the target access website.
The technical scheme of the embodiment is suitable for determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed by acquiring the website to be accessed under the condition that the test environment of the application program is switched. And determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website. Wherein, the mapping table of the domain name of the test environment can be modified in real time and is convenient to maintain. According to the target access website, the server of the second test environment is accessed, the test in a plurality of test environments can be automatically realized, the technical problems that the efficiency of manually switching a new environment is low, the time consumption is long and the workload of a tester is more in each time when the test environment is switched in the existing environment test switching method are solved, and the technical effects of improving the test efficiency and reducing the labor cost are achieved.
Example two
Fig. 3 is a schematic flow chart of a test environment switching method according to a second embodiment of the present invention, and on the basis of the foregoing embodiment, optionally, after obtaining a website to be accessed, the method further includes: storing the website to be accessed into a website storage space corresponding to a predefined website object; correspondingly, the replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website includes: and acquiring a website to be accessed from the website storage space, and replacing a first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website.
Optionally, after obtaining the target website, the method further comprises: replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website; correspondingly, the server accessing the second test environment according to the target access website comprises: and accessing a server of the second test environment based on the target website object.
Wherein, the technical terms identical to or corresponding to the above embodiments are not repeated herein.
As shown in fig. 3, the method of this embodiment may specifically include:
s210, acquiring a website to be accessed under the condition that the test environment of the application program is switched.
S220, storing the website to be accessed into a website storage space corresponding to the predefined website object.
The web site object is understood to be an object for assigning a web site to be accessed. Illustratively, the web site object is url. Alternatively, the type of the web address object may be a string type (character string type). The web site storage space is understood to be a memory space for storing web sites to be accessed.
Specifically, the website to be accessed is used as a parameter to be assigned to a predefined website object. And further, the website to be accessed can be stored in the website storage space corresponding to the website object. It should be noted that, after the definition of the website object is completed, the system will automatically allocate a memory space for the website object, so as to obtain a website storage space corresponding to the website object.
Alternatively, since the website to be accessed may change, in order to avoid an abnormality, a predefined website object may be initialized to be empty.
S230, determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed.
S240, determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on the test environment domain name mapping table of the test environment.
S250, acquiring a website to be accessed from the website storage space, and replacing a first test environment domain name contained in the website to be accessed with a second test environment domain name to obtain a target access website.
Specifically, the website to be accessed can be obtained from the website storage space through a predefined website object. After the website to be accessed is obtained, the first testing environment domain name contained in the website to be accessed can be replaced by the second testing environment domain name corresponding to the first testing environment domain name, and the website to be accessed containing the second testing environment domain name can be obtained. And taking the website to be accessed containing the second test environment domain name as a target access website, namely, obtaining the target access website.
S260, replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website.
The target web site object may be understood as an object for assigning a target access web site.
Specifically, after the target access website is obtained, the website to be accessed stored in the website storage space can be replaced by the target access website, so that the content stored in the website storage space is updated. Further, it is possible to determine the content stored in the web site storage space as the target access web site. When the content stored in the website storage space is the target access website, the target website object can be obtained.
It should be noted that, replacing the website to be accessed stored in the website storage space with the target access website to obtain the essence of the target website object corresponding to the target access website is to update the object assigned to the website to be accessed into the object assigned to the target access website.
S270, accessing a server of the second test environment based on the target website object.
Specifically, the value of the target website object can be determined to be the second testing environment domain name by analyzing the target website object. Further, a server of the second test environment corresponding to the second test environment domain name may be accessed based on the value of the target web site object.
Alternatively, accessing a server switched from the first test environment to the second test environment based on the target web site object may be introduced by:
step one, creating a server access request of a second test environment according to the target website object.
Wherein the server access request may be a request to access a server of the second test environment.
Specifically, by loading the target web site object, a server access request for the second test environment may be created.
Optionally, the server access request of the second test environment may be created according to the target website object by loading the target website object, setting the obtaining timeout value and setting the obtaining policy, and then, the server access request of the second test environment may be created.
And step two, accessing a server of the second test environment according to the server access request of the second test environment.
Specifically, when the creation of the server access request of the second test environment is completed, the server of the second test environment may be accessed according to the server access request.
Optionally, after accessing the server of the second test environment according to the server access request of the second test environment, resource data may be obtained by:
and receiving resource data corresponding to the server access request, which is sent by the server of the second test environment.
Wherein the resource data may be data sent by a server of the second test environment. Alternatively, the resource data may be picture resource data, text resource data, audio-video resource data, or the like.
Specifically, after accessing the server of the second test environment according to the server access request of the second test environment, resource data corresponding to the server access request may be determined according to the server access request. Further, a server that may receive the second test environment may send the resource data.
Optionally, after receiving the resource data corresponding to the server access request, the resource data may be displayed.
Specifically, after receiving the resource data corresponding to the server access request, rendering the received resource data in a preset pattern, and further displaying the rendered resource data. The preset style may set a font type, a color, etc. of the file data, or may set an animation effect of the picture data, wherein the animation effect may be a color gradation effect or a picture motion effect.
According to the technical scheme, the website to be accessed is stored in the website storage space corresponding to the predefined website object. And acquiring a website to be accessed from the website storage space, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website. And replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website. Based on the target website object, the server accessing the second test environment solves the technical problems that in the existing environment test switching method, when the test environment is switched each time, new environment needs to be switched manually, the efficiency is low, the time consumption is long, the workload of testers is more, and the technical effects of improving the test efficiency and reducing the labor cost are achieved.
Example III
The third embodiment of the present invention provides an alternative embodiment of a test environment switching method, and the specific implementation manner of the alternative embodiment can be referred to the following embodiment. Wherein, the technical terms identical to or corresponding to the above embodiments are not repeated herein.
Referring to fig. 4, the method of this embodiment specifically includes the following steps:
1. and under the condition that the test environment of the application program is switched, acquiring the website to be accessed.
The web site to be accessed may be a web site of a page to be accessed at the current moment, and is exemplified by the web site to be accessed being a web site of an html page a, for example, the web site of the html page a is http:// a-host/Apath, i.e., the web site to be accessed is http:// a-host/Apath.
Specifically, under the condition that the test environment of the application program is switched, the website of the html page A is obtained.
2. And storing the website to be accessed into a website storage space corresponding to the predefined website object.
Wherein the predefined web address object may be a pre-created URL object.
Specifically, the website of the html page A is stored in a website storage space corresponding to the pre-created URL object.
3. And determining a first test environment domain name containing the first test environment in the website to be accessed according to the website to be accessed.
Wherein the first test environment domain name may be a-host.
Specifically, according to the http:// A-host/Apath, the first environment domain name contained in the http:// A-host/Apath can be determined to be A-host.
3. And determining a second test environment domain name of the second test environment corresponding to the first test environment domain name based on the test environment domain name mapping table of the test environment.
Wherein the second test environment domain name may be A1-host. The test environment domain name mapping table may include a correspondence between an a-host domain name and an A1-host domain name.
Specifically, according to the correspondence between the a-host domain name and the A1-host domain name, a second test environment domain name corresponding to the a-host domain name may be determined, and further, the second test environment domain name may be obtained as A1-host.
3. And acquiring a website to be accessed from the website storage space, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website.
Specifically, http:// A-host/Apath is obtained from a website storage space corresponding to a pre-created URL object, A-host in the http:// A-host/Apath is replaced by A1-host, and further, the http:// A1-host/Apath can be used as a target access website, namely, the target access website can be obtained.
4. Replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website
Specifically, after the target website is obtained, the http:// A-host/Apath stored in the website storage space can be replaced by the http:// A1-host/Apath. Furthermore, a target website object can be obtained, namely, the target website object can be a website object corresponding to http:// A1-host/Apath.
It should be noted that, the target website object is a website object after replacing the website stored in the website storage space, and then it is understood that the target website object may be a website object after replacing the environmental domain name.
5. And creating a server access request of the second test environment according to the target website object.
Specifically, a server access request for the second environment is created by loading the target web site object.
6. And accessing the server of the second test environment according to the server access request of the second test environment.
Specifically, after the server access request is created, the server of the second test environment may be accessed according to the server access request.
7. And receiving resource data corresponding to the server access request, which is sent by the server of the second test environment.
Specifically, after the server of the second test environment is accessed, resource data corresponding to the server access request may be determined. After determining the resource data, the resource data sent by the second test environment server may be received.
8. And displaying the resource data.
Specifically, the resource data is sent to the browser, and the resource data is displayed through the browser.
According to the technical scheme, the problem that the data verification efficiency of the medical records is low in the existing data verification method of the medical records is solved, the data of the medical records can be verified more quickly and effectively, and therefore the technical effect of improving the verification efficiency can be achieved.
Example IV
Fig. 5 is a schematic diagram of a test environment switching device according to a fourth embodiment of the present invention, and the present invention provides a test environment switching device, which includes: a first test environment domain name determination module 310, a target access web site obtaining module 320, and a server access module 330.
The first test environment domain name determining module 310 is configured to obtain a website to be accessed when the test environment of the application program is switched, and determine, according to the website to be accessed, a first test environment domain name including a first test environment in the website to be accessed;
the target access website obtaining module 320 is configured to determine a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replace the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
and a server access module 330, configured to access a server of the second test environment according to the target access website.
The technical scheme of the embodiment is suitable for acquiring the website to be accessed through the first test environment domain name determining module under the condition that the test environment of the application program is switched, and determining the first test environment domain name containing the first test environment in the website to be accessed according to the website to be accessed. The target access website obtaining module determines a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replaces the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website. Wherein, the mapping table of the domain name of the test environment can be modified in real time and is convenient to maintain. The server access module accesses the server of the second test environment according to the target access website, so that the test in a plurality of test environments can be automatically realized, the technical problems that the efficiency of manually switching a new environment is low, the time consumption is long and the workload of a tester is more in each time when the test environment is switched in the existing environment test switching method are solved, and the technical effects of improving the test efficiency and reducing the labor cost are achieved.
Optionally, after acquiring the website to be accessed, the apparatus further includes: the website to be accessed storage module is used for storing the website to be accessed into a website storage space corresponding to a predefined website object; correspondingly, a target access website obtaining module 320 is configured to obtain a website to be accessed from the website storage space, and replace a first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain the target access website.
Optionally, after obtaining the target website, the apparatus further includes: the target website object obtaining module is used for replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website; correspondingly, a server accessing module 330 is configured to access a server of the second test environment based on the target web address object.
Optionally, a server access module 330 is configured to create a server access request of the second test environment according to the target web address object; and accessing the server of the second test environment according to the server access request of the second test environment.
Optionally, after accessing the server of the second test environment according to the server access request of the second test environment, the apparatus further includes: and the resource data receiving module is used for receiving resource data corresponding to the server access request, which is sent by the server of the second test environment.
Optionally, after receiving the resource data corresponding to the server access request, the apparatus further includes: and the resource data display module is used for displaying the resource data.
Optionally, the target access website obtaining module 320 is configured to replace the first test environment domain name contained in the website to be accessed with the second test environment domain name based on method exchange, so as to obtain the target access website.
The device can execute the test environment switching method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the test environment switching method.
It should be noted that, each unit and module included in the test environment switching apparatus are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present invention.
Example five
Fig. 6 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention. Fig. 6 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing any of the embodiments of the present invention. The electronic device 12 shown in fig. 6 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention. Device 12 is typically an electronic device that undertakes the processing of configuration information.
As shown in fig. 6, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting the different components, including the memory 28 and the processing unit 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry standard architecture (Industry Standard Architecture, ISA) bus, micro channel architecture (Micro Channel Architecture, MCA) bus, enhanced ISA bus, video electronics standards association (Video Electronics Standards Association, VESA) local bus, and peripheral component interconnect (Peripheral Component Interconnect, PCI) bus.
Electronic device 12 typically includes a variety of computer-readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer device readable media in the form of volatile memory, such as random access memory (Random Access Memory, RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, commonly referred to as a "hard disk drive"). Although not shown in the drawings, a disk drive for reading from and writing to a removable nonvolatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from and writing to a removable nonvolatile optical disk (e.g., a Compact Disc-Read Only Memory (CD-ROM), digital versatile Disc (Digital Video Disc-Read Only Memory, DVD-ROM), or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product 40, with program product 40 having a set of program modules 42 configured to perform the functions of embodiments of the present invention. Program product 40 may be stored, for example, in memory 28, such program modules 42 include, but are not limited to, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, mouse, camera, etc., and display), with one or more devices that enable a user to interact with the electronic device 12, and/or with any device (e.g., network card, modem, etc.) that enables the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., local area network (Local Area Network, LAN), wide area network Wide Area Network, WAN) and/or a public network, such as the internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk array (Redundant Arrays of Independent Disks, RAID) devices, tape drives, data backup storage devices, and the like.
The processor 16 executes various functional applications and data processing by running a program stored in the memory 28, for example, to implement the test environment switching method provided by the above-described embodiment of the present invention, the method including:
under the condition that the test environment of the application program is switched, acquiring a website to be accessed, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed; determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website; and accessing a server of the second test environment according to the target access website.
Of course, those skilled in the art will appreciate that the processor may also implement the test environment switching method provided in any of the embodiments of the present invention.
Example six
A sixth embodiment of the present invention also provides a computer readable storage medium having a computer program stored thereon, where the program, when executed by a processor, is a test environment switching method provided in the foregoing embodiment of the present invention, for example, the method includes:
under the condition that the test environment of the application program is switched, acquiring a website to be accessed, and determining a first test environment domain name containing a first test environment in the website to be accessed according to the website to be accessed;
determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
and accessing a server of the second test environment according to the target access website.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (8)

1. A test environment switching method, comprising:
under the condition that the testing environment of the application program is switched, acquiring a website to be accessed, storing the website to be accessed into a website storage space corresponding to a predefined website object, and determining a first testing environment domain name containing a first testing environment in the website to be accessed;
determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, acquiring a website to be accessed from the website storage space, and replacing a first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website;
and accessing a server of the second test environment based on the target website object.
2. The method of claim 1, wherein accessing the server of the second test environment based on the target web site object comprises:
creating a server access request of a second test environment according to the target website object;
and accessing the server of the second test environment according to the server access request of the second test environment.
3. The method of claim 2, further comprising, after accessing the server of the second test environment based on the server access request of the second test environment:
and receiving resource data corresponding to the server access request, which is sent by the server of the second test environment.
4. A method according to claim 3, wherein after receiving the resource data corresponding to the server access request, the method further comprises:
and displaying the resource data.
5. The method according to claim 1, wherein the replacing the first test environment domain name contained in the web site to be accessed with the second test environment domain name to obtain the target access web site includes:
and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name based on method exchange to obtain the target access website.
6. A test environment switching apparatus, comprising:
the system comprises a first test environment domain name determining module, a second test environment domain name determining module and a second test environment domain name determining module, wherein the first test environment domain name determining module is used for acquiring a website to be accessed under the condition that the test environment of an application program is switched, storing the website to be accessed into a website storage space corresponding to a predefined website object, and determining a first test environment domain name containing a first test environment in the website to be accessed;
the target access website obtaining module is used for determining a second test environment domain name of a second test environment corresponding to the first test environment domain name based on a test environment domain name mapping table of the test environment, obtaining a website to be accessed from the website storage space, and replacing the first test environment domain name contained in the website to be accessed with the second test environment domain name to obtain a target access website;
the target website object obtaining module is used for replacing the website to be accessed stored in the website storage space with the target access website to obtain a target website object corresponding to the target access website;
and the server access module is used for accessing the server of the second test environment based on the target website object.
7. An electronic device, the electronic device comprising:
one or more processors;
a storage means for storing one or more programs;
the program, when executed by the processor, causes the processor to implement the test environment switching method of any one of claims 1-5.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements the test environment switching method according to any one of claims 1-5.
CN202110788297.2A 2021-07-13 2021-07-13 Test environment switching method and device, electronic equipment and storage medium Active CN113377678B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110788297.2A CN113377678B (en) 2021-07-13 2021-07-13 Test environment switching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110788297.2A CN113377678B (en) 2021-07-13 2021-07-13 Test environment switching method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113377678A CN113377678A (en) 2021-09-10
CN113377678B true CN113377678B (en) 2023-05-16

Family

ID=77581727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110788297.2A Active CN113377678B (en) 2021-07-13 2021-07-13 Test environment switching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113377678B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019148657A1 (en) * 2018-01-31 2019-08-08 平安科技(深圳)有限公司 Method for testing associated environments, electronic device and computer readable storage medium
CN111277457A (en) * 2020-01-15 2020-06-12 平安银行股份有限公司 Method, device and equipment for switching network environment and readable storage medium

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103095783B (en) * 2011-11-08 2015-10-14 阿里巴巴集团控股有限公司 A kind of method and device debugging Web application
CN105391811B (en) * 2014-08-29 2019-12-06 腾讯科技(深圳)有限公司 domain name resolution method, access method of application server and terminal thereof
US10002071B2 (en) * 2016-03-23 2018-06-19 Wipro Limited Method and a system for automating test environment operational activities
CN107402880B (en) * 2016-05-20 2020-10-16 腾讯科技(北京)有限公司 Test method and electronic equipment
CN106055480B (en) * 2016-06-02 2021-03-16 腾讯科技(深圳)有限公司 Method and terminal for debugging webpage
CN110858173A (en) * 2018-08-23 2020-03-03 北京搜狗科技发展有限公司 Data processing method and device and data processing device
CN109787951B (en) * 2018-11-22 2022-09-02 北京奇艺世纪科技有限公司 Network data access method and device and electronic equipment
US11048618B2 (en) * 2019-03-11 2021-06-29 International Business Machines Corporation Environment modification for software application testing
CN110727589A (en) * 2019-09-30 2020-01-24 北京创鑫旅程网络技术有限公司 Test method, device and equipment
CN110781083B (en) * 2019-10-18 2022-08-02 苏宁消费金融有限公司 H5 client code setting multi-environment testing method and system
CN111222068A (en) * 2019-11-29 2020-06-02 云深互联(北京)科技有限公司 Private network IP conversion method and device
CN112131126B (en) * 2020-09-28 2023-10-27 中国银行股份有限公司 Switching method and device of test environment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019148657A1 (en) * 2018-01-31 2019-08-08 平安科技(深圳)有限公司 Method for testing associated environments, electronic device and computer readable storage medium
CN111277457A (en) * 2020-01-15 2020-06-12 平安银行股份有限公司 Method, device and equipment for switching network environment and readable storage medium

Also Published As

Publication number Publication date
CN113377678A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN107506300B (en) User interface testing method, device, server and storage medium
US10489005B2 (en) Usability analysis for user interface based systems
CN110968305A (en) Applet visualization generation method, device, equipment and storage medium
CN113158101B (en) Visual page rendering method, device, equipment and storage medium
CN109885781B (en) Mixed page unified browsing method, device, equipment and storage medium
US20140258785A1 (en) Identifying a storage location for a storage address requested during debugging
CN114048415A (en) Form generation method and device, electronic equipment and computer readable storage medium
CN112799760A (en) Form rendering method and device
CN113377678B (en) Test environment switching method and device, electronic equipment and storage medium
US11163959B2 (en) Cognitive predictive assistance for word meanings
CN110717134A (en) Product description issuing method and device, storage medium and electronic equipment
CN114296852A (en) Method and device for displaying target page, electronic equipment and storage medium
CN111026463B (en) Page loading method, device, equipment and storage medium
CN109948251B (en) CAD-based data processing method, device, equipment and storage medium
CN114253537A (en) Form generation method and device, electronic equipment and storage medium
US11120099B2 (en) Rendering a web element in a web page
CN113495498A (en) Simulation method, simulator, device, and medium for hardware device
CN113760317A (en) Page display method, device, equipment and storage medium
CN112612991A (en) Page display method and device, electronic equipment and storage medium
US11880473B2 (en) Removing data having a data type from a data set
US9697018B2 (en) Synthesizing inputs to preserve functionality
CN112363778B (en) Dynamic picture loading method and device, electronic equipment and storage medium
CN112596838B (en) Method, device, equipment and storage medium for displaying universal Web page
US11321225B2 (en) Reducing the memory load time for logic simulator by leveraging architecture simulator
CN113268240A (en) Webpage acceleration method and device, storage medium and electronic equipment

Legal Events

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