CN111400196A - Method and device for switching project information based on test environment - Google Patents

Method and device for switching project information based on test environment Download PDF

Info

Publication number
CN111400196A
CN111400196A CN202010352718.2A CN202010352718A CN111400196A CN 111400196 A CN111400196 A CN 111400196A CN 202010352718 A CN202010352718 A CN 202010352718A CN 111400196 A CN111400196 A CN 111400196A
Authority
CN
China
Prior art keywords
project information
switching
acquiring
project
data
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
CN202010352718.2A
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.)
Shanghai Zhongyan Network Technology Co ltd
Original Assignee
Shanghai Zhongyan Network 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 Shanghai Zhongyan Network Technology Co ltd filed Critical Shanghai Zhongyan Network Technology Co ltd
Priority to CN202010352718.2A priority Critical patent/CN111400196A/en
Publication of CN111400196A publication Critical patent/CN111400196A/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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention provides a method and a device for switching project information based on a test environment, wherein the method comprises the following steps: reading an operation file, and acquiring currently operated project information; reading a project configuration file, and acquiring project information in the configuration file supported by the current test server; acquiring an instruction for switching currently running project information; and switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server. According to the invention, the project information capable of switching projects is determined by acquiring the running file on the current server and the project configuration file supported by the current testing environment, so that the testing environment is quickly switched to achieve the effect of switching the projects.

Description

Method and device for switching project information based on test environment
Technical Field
The invention relates to the field of computer testing, in particular to a method and a device for switching project information based on a testing environment.
Background
The existing scheme for switching network test environment mainly includes: 1. the testing environment is equivalent to a plurality of formal environments, each testing environment has a single domain name, and different testing environments are accessed to input different domain names; 2. the domain name resolution host file is configured or similar tools are used to modify the configuration of the user equipment, and then the equipment bottom layer is shifted to the real testing environment.
Therefore, the testing machine resources are limited and many projects exist when the testing environment is switched, and a development engineer needs to spend a large amount of time for preparation when the testing environment is switched every time. When the test engineer does not understand the development, the environment can not be switched by one key quickly, the test environment operation project expected by the test engineer can be obtained, and meanwhile, the project operation state can not be controlled effectively.
Disclosure of Invention
In order to solve the problem that a test engineer in the prior art does not understand development and cannot rapidly switch the environment by one key to continuously operate the project information, the invention provides a method and a device for switching the project information based on the test environment.
In a first aspect, the present invention provides a method for switching project information based on a test environment, where the method includes:
reading an operation file, and acquiring currently operated project information;
reading a project configuration file, and acquiring project information in the configuration file supported by the current test server;
acquiring an instruction for switching currently running project information;
and switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server.
Further, switching the currently running project information according to the switching instruction and the project information in the configuration file supported by the current test server includes:
closing the currently running project information according to the switching instruction;
and opening the project to be switched according to the project information in the configuration file supported by the current test server.
Further, according to the project information in the configuration file supported by the current test server, after the project to be switched is opened, the method includes:
acquiring a synchronous instruction of data and data files in a database of items to be switched;
completing the conversion of the test environment by using the shell script statement;
and completing the synchronization of the data and the data files in the database according to the current converted test environment.
Further, completing synchronization of the data and data files in the database according to the current transformed test environment comprises:
acquiring input information in the test environment after current conversion;
executing a command of a server to be switched according to the input information, and calling data and data files in a database to be synchronized;
and synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
In a second aspect, the present invention provides an apparatus for switching project information based on a test environment, the apparatus comprising:
the system comprises a module for acquiring currently running project information, a module for reading running files and acquiring currently running project information;
the acquisition supported project information module is used for reading the project configuration file and acquiring the project information in the configuration file supported by the current test server;
the switching instruction obtaining module is used for obtaining an instruction for switching currently-operated project information;
and the execution switching module is used for switching the currently running project information according to the switching instruction and the project information in the configuration file supported by the current test server.
Further, the executing the switching module includes:
the closing unit is used for closing the currently running project information according to the switching instruction;
and the to-be-switched item opening unit is used for opening the to-be-switched item according to the item information in the configuration file supported by the current test server.
Further, after the unit of items to be switched is turned on, the method comprises the following steps:
the synchronous instruction acquisition unit is used for acquiring a synchronous instruction of data and data files in a database of the item to be switched;
the test environment conversion unit is used for completing the conversion of the test environment by using the shell script statement;
and the synchronization unit is used for completing the synchronization of the data and the data files in the database according to the currently converted test environment.
Further, the synchronization unit includes:
an input information acquiring unit for acquiring input information in the test environment after the current conversion;
the synchronous data and file calling unit is used for executing a command of the server to be switched according to the input information and calling data and data files in the database to be synchronized;
and the synchronization unit is synchronized to the current test server unit and is used for synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
In a third aspect, the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the steps of the method for switching item information based on a test environment provided in the first aspect are implemented.
In a fourth aspect, the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for switching item information based on a test environment provided in the first aspect.
According to the invention, the project information capable of switching projects is determined by acquiring the running file on the current server and the project configuration file supported by the current testing environment, so that the testing environment is quickly switched to achieve the effect of switching the projects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for switching project information based on a test environment according to an embodiment of the present invention;
FIG. 2 is a block diagram of an apparatus for switching project information based on a test environment according to an embodiment of the present invention;
fig. 3 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, 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 partial embodiments of the present application, but not all 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.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, 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 noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In the prior art, the testing machine has limited resources and more projects in practice, and a development engineer needs to spend a great deal of time for preparation when testing environment is switched each time; meanwhile, a test engineer does not understand development and cannot rapidly switch the environment by one key to continue to run the project information, and in order to solve the above problems, an embodiment of the present invention provides a method for switching the project information based on the test environment, as shown in fig. 1, the method includes:
step S101, reading an operation file and acquiring currently-operated project information;
step S102, reading a project configuration file, and acquiring project information in the configuration file supported by the current test server;
step S103, acquiring an instruction for switching currently running project information;
and step S104, switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server.
Specifically, a computer server reads a currently running file, obtains running project information from the currently running file, and prompts the project information to a test engineer; and reading the project configuration file, and acquiring project information in the configuration file supported by the current test server. If the test engineer selects to switch to another project, the server acquires an instruction for switching the information of the currently running project, and then switches the information of the currently running project according to the switching instruction and the project information in the configuration file supported by the current test server.
According to the embodiment of the invention, the item information capable of switching the items is determined by acquiring the running file on the current server and the item configuration file supported by the current testing environment, so that the testing environment is quickly switched to achieve the effect of switching the items.
Based on the content of the above embodiments, as an alternative embodiment: switching the currently running project information according to the switching instruction and the project information in the configuration file supported by the current test server comprises the following steps:
closing the currently running project information according to the switching instruction;
and opening the project to be switched according to the project information in the configuration file supported by the current test server.
Specifically, after a switching instruction is obtained, the currently running project information is automatically closed, and a new project to be switched is opened according to the project information in the configuration file supported by the current test server.
Based on the content of the above embodiments, as an alternative embodiment: according to the project information in the configuration file supported by the current test server, the method comprises the following steps after the project to be switched is started:
acquiring a synchronous instruction of data and data files in a database of items to be switched;
completing the conversion of the test environment by using the shell script statement;
and completing the synchronization of the data and the data files in the database according to the current converted test environment.
Specifically, the test engineer is prompted whether the database data and/or the data files need to be synchronized, and if yes, the database data and/or the data files are synchronized through an automatic synchronization method between the servers. More specifically, in the shell script, the statement of expect < -EOF is input, the shell environment can be converted into the expect environment, and the conversion of the current session environment is completed. And then, executing a command in the converted session environment, and synchronously downloading the database data and the data file of the remote production environment to the current test server.
Based on the content of the above embodiments, as an alternative embodiment: completing synchronization of data and data files in the database according to the current transformed test environment comprises:
acquiring input information in the test environment after current conversion;
executing a command of a server to be switched according to the input information, and calling data and data files in a database to be synchronized;
and synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
Specifically, a Tcl grammar command is executed in an expect environment, return information in the command is monitored, and corresponding related information is automatically input after a specified keyword is detected. For example: when password is received, the password is automatically filled. And after receiving the username, automatically filling in the username. It should be noted that, in the embodiment of the present invention, after the keyword is acquired, the corresponding information is input according to the displayed prompt information, and the remote server may be opened, so as to implement remote control, implement mapping of the remote server to the local environment, and directly execute the command locally. And then, executing a command of the server to be switched according to the input information, calling the data and the data files in the database to be synchronized, and synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
The embodiment of the invention can ensure the consistency of the on-line environment data after switching and the running project data before switching.
According to still another aspect of the present invention, an apparatus for switching item information based on a test environment is provided in an embodiment of the present invention, referring to fig. 2, fig. 2 is a block diagram of an apparatus for switching item information based on a test environment according to an embodiment of the present invention. The device is used for completing the switching of the project information based on the test environment provided by the embodiment of the invention in the embodiments. Therefore, the description and definition in the method for switching item information based on a test environment provided by the embodiment of the present invention in the foregoing embodiments may be used for understanding each execution module in the embodiment of the present invention.
The device includes:
a module 201 for acquiring currently running project information, configured to read an operating file and acquire currently running project information;
a supported project information obtaining module 202, configured to read a project configuration file, and obtain project information in the configuration file supported by the current test server;
a switching instruction obtaining module 203, configured to obtain an instruction for switching currently running item information;
and the execution switching module 204 is configured to switch currently-operating item information according to the switching instruction and the item information in the configuration file supported by the current test server.
Specifically, the specific process of each module in the apparatus of this embodiment to implement its function may refer to the related description in the corresponding method embodiment, and is not described herein again.
Based on the content of the above embodiments, as an alternative embodiment: the execution switching module comprises:
the closing unit is used for closing the currently running project information according to the switching instruction;
and the to-be-switched item opening unit is used for opening the to-be-switched item according to the item information in the configuration file supported by the current test server.
Specifically, the specific process of each module in the apparatus of this embodiment to implement its function may refer to the related description in the corresponding method embodiment, and is not described herein again.
Based on the content of the above embodiments, as an alternative embodiment: after opening the unit of items to be switched, the method comprises the following steps:
the synchronous instruction acquisition unit is used for acquiring a synchronous instruction of data and data files in a database of the item to be switched;
the test environment conversion unit is used for completing the conversion of the test environment by using the shell script statement;
and the synchronization unit is used for completing the synchronization of the data and the data files in the database according to the currently converted test environment.
Specifically, the specific process of each module in the apparatus of this embodiment to implement its function may refer to the related description in the corresponding method embodiment, and is not described herein again.
Based on the content of the above embodiments, as an alternative embodiment: the synchronization unit includes:
an input information acquiring unit for acquiring input information in the test environment after the current conversion;
the synchronous data and file calling unit is used for executing a command of the server to be switched according to the input information and calling data and data files in the database to be synchronized;
and the synchronization unit is synchronized to the current test server unit and is used for synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
Specifically, the specific process of each module in the apparatus of this embodiment to implement its function may refer to the related description in the corresponding method embodiment, and is not described herein again.
Fig. 3 is a block diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 3, the electronic device includes: a processor 301, a memory 302, and a bus 303;
the processor 301 and the memory 302 respectively complete communication with each other through a bus 303; the processor 301 is configured to call the program instructions in the memory 302 to execute the method for switching item information based on the test environment provided by the foregoing embodiment, for example, including: reading an operation file, and acquiring currently operated project information; reading a project configuration file, and acquiring project information in the configuration file supported by the current test server; acquiring an instruction for switching currently running project information; and switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server.
Embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements steps of a method for switching project information based on a test environment. Examples include: reading an operation file, and acquiring currently operated project information; reading a project configuration file, and acquiring project information in the configuration file supported by the current test server; acquiring an instruction for switching currently running project information; and switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods of the various embodiments or some parts of the embodiments.
Finally, the principle and the implementation of the present invention are explained by applying the specific embodiments in the present invention, and the above description of the embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for switching project information based on a test environment is characterized by comprising the following steps:
reading an operation file, and acquiring currently operated project information;
reading a project configuration file, and acquiring project information in the configuration file supported by the current test server;
acquiring an instruction for switching currently running project information;
and switching the currently operated project information according to the switching instruction and the project information in the configuration file supported by the current test server.
2. The method of claim 1, wherein switching the currently running project information according to the switching instruction and the project information in the configuration file supported by the current test server comprises:
closing the currently running project information according to the switching instruction;
and opening the project to be switched according to the project information in the configuration file supported by the current test server.
3. The method according to claim 2, wherein the step of starting the project to be switched according to the project information in the configuration file supported by the current test server comprises:
acquiring a synchronous instruction of data and data files in a database of items to be switched;
completing the conversion of the test environment by using the shell script statement;
and completing the synchronization of the data and the data files in the database according to the current converted test environment.
4. The method of claim 3, wherein said synchronizing data and data files within the database according to the current transformed test environment comprises:
acquiring input information in the test environment after current conversion;
executing a command of the server to be switched according to the input information, and calling data and data files in the database to be synchronized;
and synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
5. An apparatus for switching item information based on a test environment, the apparatus comprising:
the system comprises a module for acquiring currently running project information, a module for reading running files and acquiring currently running project information;
the acquisition supported project information module is used for reading the project configuration file and acquiring the project information in the configuration file supported by the current test server;
the switching instruction obtaining module is used for obtaining an instruction for switching currently-operated project information;
and the execution switching module is used for switching the currently running project information according to the switching instruction and the project information in the configuration file supported by the current test server.
6. The apparatus of claim 5, wherein the means for performing the handover comprises:
the closing unit is used for closing the currently running project information according to the switching instruction;
and the to-be-switched item opening unit is used for opening the to-be-switched item according to the item information in the configuration file supported by the current test server.
7. The apparatus of claim 6, wherein said opening of the unit of items to be switched comprises:
the synchronous instruction acquisition unit is used for acquiring a synchronous instruction of data and data files in a database of the item to be switched;
the test environment conversion unit is used for completing the conversion of the test environment by using the shell script statement;
and the synchronization unit is used for completing the synchronization of the data and the data files in the database according to the currently converted test environment.
8. The apparatus of claim 7, wherein the synchronization unit comprises:
an input information acquiring unit for acquiring input information in the test environment after the current conversion;
the synchronous data and file calling unit is used for executing a command of the server to be switched according to the input information and calling data and data files in the database to be synchronized;
and the synchronization unit is synchronized to the current test server unit and is used for synchronously downloading the data and the data files in the database to be synchronized to the current test server in an ssh connection mode.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for switching project information based on a test environment according to any one of claims 1 to 4 when executing the program.
10. A non-transitory computer readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method for switching item information based on a test environment according to any one of claims 1 to 4.
CN202010352718.2A 2020-04-28 2020-04-28 Method and device for switching project information based on test environment Pending CN111400196A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010352718.2A CN111400196A (en) 2020-04-28 2020-04-28 Method and device for switching project information based on test environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010352718.2A CN111400196A (en) 2020-04-28 2020-04-28 Method and device for switching project information based on test environment

Publications (1)

Publication Number Publication Date
CN111400196A true CN111400196A (en) 2020-07-10

Family

ID=71437353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010352718.2A Pending CN111400196A (en) 2020-04-28 2020-04-28 Method and device for switching project information based on test environment

Country Status (1)

Country Link
CN (1) CN111400196A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131101A (en) * 2020-08-27 2020-12-25 新华三大数据技术有限公司 Automatic testing method, testing terminal and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109634840A (en) * 2018-10-25 2019-04-16 平安科技(深圳)有限公司 Method for testing software, device, equipment and storage medium
CN109684201A (en) * 2018-11-26 2019-04-26 平安科技(深圳)有限公司 It is switched fast the method, apparatus, computer equipment and storage medium of running environment
US20190213108A1 (en) * 2018-01-09 2019-07-11 National Central University Method that supports multithreading/concurrent programming debugging, computer readable recording medium and computer program product

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190213108A1 (en) * 2018-01-09 2019-07-11 National Central University Method that supports multithreading/concurrent programming debugging, computer readable recording medium and computer program product
CN109634840A (en) * 2018-10-25 2019-04-16 平安科技(深圳)有限公司 Method for testing software, device, equipment and storage medium
CN109684201A (en) * 2018-11-26 2019-04-26 平安科技(深圳)有限公司 It is switched fast the method, apparatus, computer equipment and storage medium of running environment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
佐佑生活: ""springboot的多环境配置(测试,开发,生产)"", 《HTTPS://JINGYAN.BAIDU.COM/ARTICLE/425E69E60B5377BE15FC16CC.HTML》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131101A (en) * 2020-08-27 2020-12-25 新华三大数据技术有限公司 Automatic testing method, testing terminal and storage medium

Similar Documents

Publication Publication Date Title
CN107704395B (en) Cloud platform automation test implementation method and system based on Openstack
JP6671483B2 (en) Method and apparatus for controlling smart devices and computer storage media
CN104885055A (en) Method and device for application data synchronization
WO2005045667A2 (en) A method of rapid software application development for a wireless mobile device
CN111459818A (en) Visual test method and device
CN111460640B (en) Power system simulation method, device, equipment and computer storage medium
CN111400196A (en) Method and device for switching project information based on test environment
US20220103555A1 (en) Service deployment method, device, system, and computer-readable storage medium
CN109783392A (en) Cloud net fusion architecture system detection method and device
CN112543478B (en) WiFi module automatic test method and device, computer equipment and storage medium
CN113760397A (en) Interface call processing method, device, equipment and storage medium
CN112214227A (en) Edge server mirror image customization and deployment system and method
CN109491762B (en) Container state control method and device, storage medium and electronic equipment
CN112306639B (en) Virtual desktop testing method and device
CN107301089B (en) APP deployment and calling method and terminal
CN113127369A (en) Processing method and device for execution script
CN109587282B (en) Method and system for SR (scheduling request) oriented automatic node IP (Internet protocol) configuration of complete equipment cabinet
CN105653389B (en) A kind of data diagnosis restorative procedure and device
CN112667498A (en) Server building method and device, computer equipment and readable storage medium
CN114896018B (en) BMC application interface language switching method, device and medium
CN111241553A (en) BIOS (basic input output System) permission setting method, device, equipment and storage medium
GB2583904A (en) Commissioning a virtualised network function
CN113138915A (en) Page testing method, device and medium
CN114900383B (en) Interface processing method, device, electronic equipment and computer readable storage medium
EP4307060A1 (en) Development assistance device, development assistance method, and development assistance program

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200710