CN110928798A - Code testing method, device and equipment - Google Patents

Code testing method, device and equipment Download PDF

Info

Publication number
CN110928798A
CN110928798A CN201911208735.2A CN201911208735A CN110928798A CN 110928798 A CN110928798 A CN 110928798A CN 201911208735 A CN201911208735 A CN 201911208735A CN 110928798 A CN110928798 A CN 110928798A
Authority
CN
China
Prior art keywords
code
test
tested
testing
test case
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
CN201911208735.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.)
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Wave Intelligent 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 Suzhou Wave Intelligent Technology Co Ltd filed Critical Suzhou Wave Intelligent Technology Co Ltd
Priority to CN201911208735.2A priority Critical patent/CN110928798A/en
Publication of CN110928798A publication Critical patent/CN110928798A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

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

Abstract

The invention discloses a code testing method, which can shorten the testing period and improve the working efficiency because the corresponding test case can be tested only aiming at the changed content of the code to be tested, which is different from the old version code, and the unchanged content of the code to be tested, which is different from the old version, is not required to be tested. The invention also discloses a code testing device and equipment, which have the same beneficial effects as the code testing method.

Description

Code testing method, device and equipment
Technical Field
The invention relates to the field of computers, in particular to a code testing method, and also relates to a code testing device and equipment.
Background
With the development of computer technology, codes are more and more widely used, and after the codes are generally written, the codes are tested to verify the accuracy and reliability of the codes, but the number of the codes to be tested is large, so that the whole testing period is long, and the working efficiency is reduced.
Therefore, how to provide a solution to the above technical problem is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a code testing method which can shorten the testing period and improve the working efficiency; another object of the present invention is to provide a code testing apparatus and device, which can shorten the testing period and improve the working efficiency.
In order to solve the above technical problem, the present invention provides a code testing method, including:
upgrading the test environment according to the code to be tested;
determining the change content between the code to be tested and the old version code corresponding to the code to be tested;
determining a test case corresponding to the changed content according to the corresponding relation between the preset code and the test case;
and testing the test case of the changed content in the upgraded test environment.
Preferably, the testing the test case of the changed content in the upgraded test environment specifically includes:
obtaining a test script required by executing the test case;
and executing the test script in the upgraded test environment so as to test the test case with the changed content.
Preferably, after the test script is executed in the upgraded test environment so as to test the test case with the changed content, the code testing method further includes:
and the control prompter prompts the test result of the test case with the changed content.
Preferably, the upgrading the test environment according to the code to be tested specifically includes:
and acquiring codes to be tested from a code library every other preset time period, and upgrading the test environment according to the codes to be tested.
Preferably, the upgrading the test environment according to the code to be tested specifically includes:
compiling the code to be tested into an upgrade file;
and upgrading the test environment according to the upgrading file.
In order to solve the above technical problem, the present invention further provides a code testing apparatus, including:
the upgrading module is used for upgrading the test environment according to the codes to be tested;
the first determining module is used for determining the changed content between the code to be tested and the old version code corresponding to the code to be tested;
the second determining module is used for determining the test case corresponding to the changed content according to the corresponding relation between the preset code and the test case;
and the testing module is used for testing the test case of the changed content in the upgraded testing environment.
Preferably, the test module comprises:
the acquisition module is used for acquiring a test script required by executing the test case;
and the execution module is used for executing the test script in the upgraded test environment so as to test the test case with the changed content.
Preferably, the code testing apparatus further includes:
and the control module is used for controlling a prompter to prompt the test result of the test case with the changed content.
Preferably, the upgrade module is specifically configured to:
and acquiring codes to be tested from a code library every other preset time period, and upgrading the test environment according to the codes to be tested.
In order to solve the above technical problem, the present invention further provides a code testing apparatus, including:
a memory for storing a computer program;
a processor for implementing the steps of the code testing method as described in any one of the above when the computer program is executed.
The invention provides a code testing method, which can shorten the testing period and improve the working efficiency because the corresponding test case can be tested only aiming at the changed content of the code to be tested, which is different from the old version code, and the unchanged content of the code to be tested, which is different from the old version, is not required to be tested.
The invention also provides a code testing device and equipment, which have the same beneficial effects as the code testing method.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed in the prior art and the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flow chart of a code testing method according to the present invention;
FIG. 2 is a schematic structural diagram of a code testing apparatus according to the present invention;
fig. 3 is a schematic structural diagram of a code testing apparatus according to the present invention.
Detailed Description
The core of the invention is to provide a code testing method which can shorten the testing period and improve the working efficiency; another object of the present invention is to provide a code testing apparatus and device, which can shorten the testing period and improve the working efficiency.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 invention.
Referring to fig. 1, fig. 1 is a schematic flow chart of a code testing method according to the present invention, including:
step S1: upgrading the test environment according to the code to be tested;
specifically, if the code to be tested is to be tested, the test environment needs to be upgraded by using the code to be tested, so that each test case of the code to be tested can be tested based on the upgraded test environment.
The code to be tested may be a new version code or a brand new type code written by a worker, and may correspond to all codes in a piece of software, where the codes may include original contents in an old version or newly changed contents.
Step S2: determining the change content between the code to be tested and the old version code corresponding to the code to be tested;
specifically, in consideration of the fact that the prior art tests all test cases corresponding to the code to be tested, but the code data corresponding to the code to be tested is not necessarily newly modified, and some code data which is not changed in the old version is necessarily included therein, however, it is obviously unnecessary to test all test cases corresponding to the code to be tested, and the test period is increased, in the embodiment of the present invention, the content of change between the code to be tested and the code of the old version corresponding to the code to be tested may be determined first, and then the content of change may be heavily tested in the subsequent steps, so as to reduce the test period.
There may be a plurality of methods for determining the change content between the code to be tested and the old version code corresponding to the code to be tested, for example, the code comparison may be performed, and the embodiment of the present invention is not limited herein.
It should be noted that the execution sequence between the step S2 and the step S1 may be changed, and the embodiment of the invention is not limited herein.
Step S3: determining a test case corresponding to the changed content according to the corresponding relation between the preset code and the test case;
specifically, the test case may be understood as a test item, the test cases to be tested are different for different parts of codes, and a clear correspondence exists between the codes and the test cases, for example, for part a of codes, it is necessary to test the test case a.
The preset code and the test case may be set independently, and may be of various types, and the embodiment of the present invention is not limited herein.
Step S4: and testing the test case with changed content in the upgraded test environment.
Specifically, after the preparation work is finished, the test case with changed content can be tested in the upgraded test environment.
The invention provides a code testing method, which can shorten the testing period and improve the working efficiency because the corresponding test case can be tested only aiming at the changed content of the code to be tested, which is different from the old version code, and the unchanged content of the code to be tested, which is different from the old version, is not required to be tested.
On the basis of the above-described embodiment:
as a preferred embodiment, the testing the test case with changed content in the upgraded test environment specifically includes:
acquiring a test script required by executing a test case;
and executing the test script in the upgraded test environment so as to test the test case with changed content.
Specifically, in order to test the test case with changed content in the test environment, a test script corresponding to the test case must be executed, so in the embodiment of the present invention, the test script required for executing the test case may be first obtained, and then the test script may be executed in the upgraded test environment, so that the test case with changed content may be smoothly tested.
As a preferred embodiment, after executing a test script in the upgraded test environment so as to test the test case with changed content, the code testing method further includes:
and the control prompter prompts the test result of the test case with changed content.
Specifically, in the embodiment of the present invention, after the test, the prompter may be controlled to prompt the test result, and the specific prompting manner may be to send the test result to a terminal where a worker is located, and prompt the terminal through a display, so that the worker may quickly and accurately know the test result, and if there is a problem, the worker may quickly modify the problem in the test result, for example, when the test result shows that the test case B fails, the worker may know which codes may have a problem, and may check and modify the codes in a targeted manner, thereby further improving the work efficiency.
Of course, besides the above prompting manners, the prompting manners may be of other various types, and the embodiments of the present invention are not limited herein.
As a preferred embodiment, upgrading the test environment according to the code to be tested specifically includes:
and acquiring the codes to be tested from the code base at preset time intervals and upgrading the test environment according to the codes to be tested.
Specifically, in the embodiment of the present invention, considering that a worker uploads codes to the code library server after writing new codes, the codes in the code library server may be codes to be tested, and the codes to be tested in the code library server may be automatically tested at intervals of a preset time period, so as to further improve an automation level and improve work efficiency.
The preset time period may be set autonomously, for example, a day, and the embodiment of the present invention is not limited herein.
Of course, in addition to this, the worker may also trigger the test manually, that is, the worker sends the test command manually through the external terminal device, and after receiving the test command, the processor may execute the above steps to test the code to be tested.
As a preferred embodiment, upgrading the test environment according to the code to be tested specifically includes:
compiling the code to be tested into an upgrading file;
and upgrading the test environment according to the upgrading file.
Specifically, the code to be tested needs to be compiled into an upgrade file, and then the test environment can be upgraded according to the upgrade file, so that the test environment can be upgraded according to the upgrade file compiled by the code to be tested in the embodiment of the invention.
Specifically, a specific application scenario of the embodiment of the present invention may be as follows:
(1) the task master scheduler can receive a test starting instruction (which can be sent at preset time intervals or manually) from the test environment management server;
(2) the task master scheduler can acquire the latest code to be tested from the code library server, determine the change content between the latest code and the old version, and then the task master scheduler can determine the test case corresponding to the change content;
(3) the task master scheduler can acquire a required test case from the test case management server;
(4) the task master scheduler can send a test instruction and a test case to the test execution machine;
(5) after receiving the test instruction, the test execution machine can send a request to the code base server and obtain a test script corresponding to the test case to be executed from the code base server;
(6) and step (5) are carried out simultaneously: the test execution machine can send a compiling instruction to the code base server, the code base server can send the code to be tested to the code compiling server, and the code compiling server can compile the code to be tested into an upgrading file;
(7) after the code compiling server finishes compiling, the upgrading packet can be sent to the storage testing equipment and the testing environment in the storage testing equipment is upgraded to the version consistent with the latest code to be tested;
(8) after the test environment is upgraded, the test execution machine can start to execute the test, and the test execution machine can control the test script to run in the test environment of the storage test equipment, start to test the test case with the changed content and verify the change point of the code to be tested;
(9) after the test is finished, the test execution machine can send the execution result of the test script to the task master scheduler for analysis;
(10) the execution result after result analysis can show that there are no cases of execution failure and which cases are failed for the code change, then the task total scheduling can automatically push the analysis result to the user, and the user can judge whether there is a problem in the code change according to the result.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a code testing apparatus provided in the present invention, including:
the upgrading module 1 is used for upgrading the test environment according to the codes to be tested;
the first determining module 2 is used for determining the change content between the code to be tested and the old version code corresponding to the code to be tested;
the second determining module 3 is configured to determine a test case corresponding to the changed content according to a corresponding relationship between a preset code and the test case;
and the test module 4 is used for testing the test case with the changed content in the upgraded test environment.
As a preferred embodiment, the test module comprises:
the acquisition module is used for acquiring a test script required by executing the test case;
and the execution module is used for executing the test script in the upgraded test environment so as to test the test case with changed content.
As a preferred embodiment, the code testing apparatus further includes:
and the control module is used for controlling the prompter to prompt the test result of the test case with the changed content.
As a preferred embodiment, the upgrade module is specifically configured to:
and acquiring the codes to be tested from the code base at preset time intervals and upgrading the test environment according to the codes to be tested.
For the introduction of the code testing apparatus provided in the embodiment of the present invention, please refer to the foregoing embodiment of the code testing method, which is not described herein again.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a code testing apparatus provided in the present invention, including:
a memory 5 for storing a computer program;
a processor 6 for implementing the steps of the code testing method as any one of the above when executing the computer program.
For the introduction of the code testing apparatus provided in the embodiment of the present invention, please refer to the foregoing embodiment of the code testing method, which is not described herein again.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A code testing method, comprising:
upgrading the test environment according to the code to be tested;
determining the change content between the code to be tested and the old version code corresponding to the code to be tested;
determining a test case corresponding to the changed content according to the corresponding relation between the preset code and the test case;
and testing the test case of the changed content in the upgraded test environment.
2. The code testing method according to claim 1, wherein the testing the test case of the changed content in the upgraded testing environment specifically includes:
obtaining a test script required by executing the test case;
and executing the test script in the upgraded test environment so as to test the test case with the changed content.
3. The code testing method according to claim 2, wherein after the test script is executed in the upgraded test environment to test the test case of the changed content, the code testing method further comprises:
and the control prompter prompts the test result of the test case with the changed content.
4. The code testing method according to any one of claims 1 to 3, wherein the upgrading of the test environment according to the code to be tested is specifically:
and acquiring codes to be tested from a code library every other preset time period, and upgrading the test environment according to the codes to be tested.
5. The code testing method according to claim 4, wherein the upgrading the testing environment according to the code to be tested specifically comprises:
compiling the code to be tested into an upgrade file;
and upgrading the test environment according to the upgrading file.
6. A code testing apparatus, comprising:
the upgrading module is used for upgrading the test environment according to the codes to be tested;
the first determining module is used for determining the changed content between the code to be tested and the old version code corresponding to the code to be tested;
the second determining module is used for determining the test case corresponding to the changed content according to the corresponding relation between the preset code and the test case;
and the testing module is used for testing the test case of the changed content in the upgraded testing environment.
7. The code testing apparatus of claim 6, wherein the testing module comprises:
the acquisition module is used for acquiring a test script required by executing the test case;
and the execution module is used for executing the test script in the upgraded test environment so as to test the test case with the changed content.
8. The code testing apparatus of claim 7, further comprising:
and the control module is used for controlling a prompter to prompt the test result of the test case with the changed content.
9. The code testing apparatus according to any one of claims 6 to 8, wherein the upgrade module is specifically configured to:
and acquiring codes to be tested from a code library every other preset time period, and upgrading the test environment according to the codes to be tested.
10. A code testing apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the code testing method according to any one of claims 1 to 5 when executing the computer program.
CN201911208735.2A 2019-11-30 2019-11-30 Code testing method, device and equipment Pending CN110928798A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911208735.2A CN110928798A (en) 2019-11-30 2019-11-30 Code testing method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911208735.2A CN110928798A (en) 2019-11-30 2019-11-30 Code testing method, device and equipment

Publications (1)

Publication Number Publication Date
CN110928798A true CN110928798A (en) 2020-03-27

Family

ID=69848269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911208735.2A Pending CN110928798A (en) 2019-11-30 2019-11-30 Code testing method, device and equipment

Country Status (1)

Country Link
CN (1) CN110928798A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113138930A (en) * 2021-05-12 2021-07-20 上海云从企业发展有限公司 Software testing method and device and computer storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176895A (en) * 2011-12-22 2013-06-26 阿里巴巴集团控股有限公司 Method and system of regression testing
CN103577311A (en) * 2012-07-26 2014-02-12 深圳市世纪光速信息技术有限公司 Method and device for screening test cases
CN107402880A (en) * 2016-05-20 2017-11-28 腾讯科技(北京)有限公司 A kind of method of testing and electronic equipment
CN107861876A (en) * 2017-11-16 2018-03-30 平安科技(深圳)有限公司 Method of testing, device, computer equipment and readable storage medium storing program for executing
CN108111929A (en) * 2017-11-17 2018-06-01 深圳市飞鸿光电子有限公司 A kind of method based on Python automatic tests, system and test terminal
CN109828917A (en) * 2019-01-04 2019-05-31 烽火通信科技股份有限公司 A kind of the continuous integrating management method and system of whole process automation
US20190294528A1 (en) * 2018-03-26 2019-09-26 Ca, Inc. Automated software deployment and testing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176895A (en) * 2011-12-22 2013-06-26 阿里巴巴集团控股有限公司 Method and system of regression testing
CN103577311A (en) * 2012-07-26 2014-02-12 深圳市世纪光速信息技术有限公司 Method and device for screening test cases
CN107402880A (en) * 2016-05-20 2017-11-28 腾讯科技(北京)有限公司 A kind of method of testing and electronic equipment
CN107861876A (en) * 2017-11-16 2018-03-30 平安科技(深圳)有限公司 Method of testing, device, computer equipment and readable storage medium storing program for executing
CN108111929A (en) * 2017-11-17 2018-06-01 深圳市飞鸿光电子有限公司 A kind of method based on Python automatic tests, system and test terminal
US20190294528A1 (en) * 2018-03-26 2019-09-26 Ca, Inc. Automated software deployment and testing
CN109828917A (en) * 2019-01-04 2019-05-31 烽火通信科技股份有限公司 A kind of the continuous integrating management method and system of whole process automation

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
维克托•法西克: "《微服务运维实战》", 31 July 2018, 华中科技大学出版社 *
罗琼: "《计算机科学导论》", 31 August 2016, 北京邮电大学出版社 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113138930A (en) * 2021-05-12 2021-07-20 上海云从企业发展有限公司 Software testing method and device and computer storage medium

Similar Documents

Publication Publication Date Title
US11281570B2 (en) Software testing method, system, apparatus, device medium, and computer program product
US9940225B2 (en) Automated error checking system for a software application and method therefor
KR100868762B1 (en) Method of error detecting method for embedded sofeware
US8954930B2 (en) System and method for reducing test effort by object risk analysis
CN104077140A (en) Automatic compiling method and compiling device for continuous integration
CN105302722B (en) CTS automatic testing method and device
CN109902005B (en) Automatic testing method and system
US10579513B2 (en) Test run control method and apparatus
CN106648762B (en) Method and device for building development environment
CN107766226B (en) Test method and device
CN107179982B (en) Cross-process debugging method and device
CN111611157B (en) GMS continuous integration construction automatic test method and system
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN107329889B (en) Method for automatically testing C compiler
CN113505073A (en) Database performance test method, device, equipment and medium
CN110928798A (en) Code testing method, device and equipment
CN101267645B (en) Automatic test method and system for service flow software development of W base station
CN110795341A (en) Automatic testing method, system and device for server
CN111581081B (en) Automatic test system and method
CN115904384A (en) Configuration method, device and equipment for application program release and storage medium
CN113918162A (en) Front-end code automatic checking method based on centralized management mode
CN109358564B (en) Method and device for detecting configuration software and computer readable storage medium
CN113568834A (en) SDK code compatibility detection method, device, computer equipment and medium
CN112346994A (en) Test information correlation method and device, computer equipment and storage medium
CN111651364B (en) SQL (structured query language) checking method and device under parallel development

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

Application publication date: 20200327

RJ01 Rejection of invention patent application after publication