CN113419969B - Interface automatic formation power guarantee method based on browser plug-in - Google Patents

Interface automatic formation power guarantee method based on browser plug-in Download PDF

Info

Publication number
CN113419969B
CN113419969B CN202110964767.6A CN202110964767A CN113419969B CN 113419969 B CN113419969 B CN 113419969B CN 202110964767 A CN202110964767 A CN 202110964767A CN 113419969 B CN113419969 B CN 113419969B
Authority
CN
China
Prior art keywords
plug
script
browser
browser plug
keyword
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
CN202110964767.6A
Other languages
Chinese (zh)
Other versions
CN113419969A (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.)
Whale Cloud Technology Co Ltd
Original Assignee
Whale Cloud 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 Whale Cloud Technology Co Ltd filed Critical Whale Cloud Technology Co Ltd
Priority to CN202110964767.6A priority Critical patent/CN113419969B/en
Publication of CN113419969A publication Critical patent/CN113419969A/en
Application granted granted Critical
Publication of CN113419969B publication Critical patent/CN113419969B/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
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an interface automatic formation power guarantee method based on a browser plug-in, which comprises the following steps: compiling to form a new plug-in based on the basis of the existing open source plug-in; packaging the new plug-in into a browser format; a user downloads a browser plug-in; importing the downloaded browser plug-in a browser; starting a browser plug-in, normally finishing scene operation in a browser, automatically intercepting a Js object by the browser plug-in according to actions, mapping to generate a stable automatic script, and simultaneously displaying the automatic script in the browser plug-in; the user makes generalized modification based on the displayed use case script and directly plays back the generalized modification; and the browser plug-in automatically calls the local running component and plays back and runs the use case. Has the advantages that: the automatic test is automatically generated and debugged by using the keyword transcoding suite in the plug-in, and the compiling cost of the automatic test case can be greatly reduced compared with the traditional recording mode.

Description

Interface automatic formation power guarantee method based on browser plug-in
Technical Field
The present invention relates to the field of DevOps [ a collective term for a set of processes, methods and systems for facilitating development (application/software engineering), communication, collaboration and integration between technical operations and Quality Assurance (QA) departments ], and in particular, to a browser plug-in based interface automation into power assurance method.
Background
With the development and popularity of agile development in the software industry, the position of automated testing in the software testing industry is gradually increased, and software testing is a relatively mature industry in China and gradually approaches the international level.
As is well known, the automatic test can improve the test efficiency and save time and labor cost; the consistency of the execution content and the test result of each time can be guaranteed, so that repeatable results can be achieved. Meanwhile, due to the accuracy and the speed of the system, the delivery is more efficient, the system is a core link for continuous integration and continuous delivery and can be popularized in a large area, and on the contrary, manual testing cannot meet the progress and cannot be used for rapid delivery. More importantly, the original function of the test is often omitted in the manual test, so that the leakage of the fault is caused.
The automated test model is mainly divided into unit test, API automated test, UI automated test and the like, and each type of industry has a mature automated tool. However, the ratio of the three types of automated tests is 70%, 20% and 10% respectively, regardless of the prevailing community or the common consensus of the industry. The most important reason for the low occupancy of the UI automation test is that the UI interface is frequently changed, the playback and execution are unstable, and the cost performance is too low. But the UI automatic test can better complete the end-to-end integrated test, the execution process can be visually seen according to the actual requirements of the user, and the UI automatic test has the characteristics that the UI automatic test cannot meet the requirements of other two types of tests and has the capability of verifying the final value.
The reason that playback of the UI case is unstable is that the existing tools have incomplete support on the components packaged by the third party in a customized manner, while the native JS component plays back, many abnormal or overtime situations are not processed, and the playback execution success rate is low.
An effective solution to the problems in the related art has not been proposed yet.
Disclosure of Invention
Aiming at the problems in the related art, the invention provides an interface automatic power guarantee method based on a browser plug-in, so as to overcome the technical problems in the prior related art.
Therefore, the invention adopts the following specific technical scheme:
an interface automatic formation power guarantee method based on a browser plug-in comprises the following steps:
s1, adding the keyword library component, the mapping file data component, the interception conversion component and the online operation component into the open source plug-in based on the existing open source plug-in, and compiling to form a new plug-in;
s2, packaging the new plug-in into a browser format to obtain a browser plug-in, and issuing the browser plug-in to a local shared directory;
s3, downloading a browser plug-in by a user;
s4, importing the downloaded browser plug-in by the user in the browser;
s5, starting a browser plug-in, normally completing scene operation in the browser, automatically intercepting a Js object by the browser plug-in according to actions, mapping to generate a stable automation script by contrasting a built-in keyword library component, and simultaneously displaying the automation script in the browser plug-in;
s6, the user makes generalized modification based on the displayed use case script and directly plays back the generalized modification;
s7, automatically calling the local running component by the browser plug-in, and playing back and running the use case;
the keyword library component in the S1 is composed of a front-end Js command component and a mapping table of Robot commands, a plug-in is placed in the mapping table and supports dynamic expansion, and a positioning rule base is added on the basis of the keyword library component, the positioning rule base includes attribute positioning, relative position positioning, and absolute position positioning rules, and forms a keyword suite;
when the keyword suite records the transcoding to generate the script each time, a plurality of rule script arrays are generated based on the suite, namely, the rule script arrays are recorded at one time, a rule is given priority when the rule script arrays are executed, and if the element cannot be found or the positioning is wrong, the rule script arrays are automatically tried to be switched to other rules to find the element.
Further, when the recording of the new plug-in S1 is intercepted, the method further includes the following steps:
clicking a recording event, and adding a monitoring event to a window, a Tab label page, a navigation and command message object of a browser by the new plug-in through a Js universal monitoring method;
extracting the object and command type information of the operation in the message in the event monitoring process to generate a Js script;
before generating the Js script, converting the Js script according to the format of the Robot script and transcoding the Js script to generate the Robot format script through the keyword component.
Further, when the user performs the generalization modification based on the displayed use case script in S6, the generalization modification includes dynamic variable replacement;
wherein the dynamic variable replacement comprises changing a time field to a system timestamp and a number to a random number.
Further, the browser plug-in S2-S5 and S7 further comprises the following steps when the browser plug-in realizes the front-end automation test;
intercepting and recording each interface click and input operation of the browser through a browser plug-in, automatically transcoding the keywords, and generating a case script capable of stably running;
after a user modifies the case script on the browser plug-in interface, the modified case is directly debugged, the browser plug-in starts a debugging module, the case script is automatically played back and run, and a test report is generated;
after debugging is passed, the browser plug-in starts an instantiation function and instantiates the use case into the file system.
Further, the new plug-in formed by the existing open source plug-in S1 further includes three logics of keyword transcoding, multiple positioning rules, and use case playback;
wherein the keyword transcoding further comprises the steps of:
the keyword suite records and stores the general operation of Js in advance as a Key Value according to a KEY-Value rule, writes and packages Python keywords as a Value, matches and maps the values, and stores the values in a configuration file of the plug-in an array mode;
the open source plug-in records and acquires the operation content of the Js control of the UI, operates the Js control to find out the corresponding Python keyword from the configuration file through the KEY-Value rule, and automatically converts the keyword into a packaged Python case script;
the multi-positioning rule further comprises the steps of:
defining a plurality of positioning rules on the basis of a keyword transcoding library, wherein the rules are internally provided with a getElementById element positioning method, an XPath path positioning method, CSS positioning and Name label positioning to form a keyword suite;
in the recording process, the keywords are mapped and transcoded into stable Robot scripts, a plurality of sets of scripts are automatically generated according to rules at the same time, and the scripts are stored into a configuration file in an array mode;
the use case playback further comprises the following steps:
a user directly plays back a use case script in the new plug-in, and the script can be matched with and load a corresponding keyword suite through the content of the use case file;
the local execution agent is started and the playback function of the browser is started.
Further, the browser plug-in S2-S5 and S7, when interacting with the system under test, further includes the following steps:
a user installs a browser plug-in a browser, opens the browser and normally accesses a tested service system;
according to the operation steps of user testing, the browser plug-in automatically intercepts Js operation, searches the mapping relation between keywords and Python in a configuration file according to operation actions, obtains a corresponding Python script, and generates a high-stability test script through the conversion of a multi-rule suite;
the browser plug-in automatically instantiates the script to a local file system;
a user parameterizes related input values based on a test case script displayed by a browser plug-in, and adds judgment condition verification;
the modified use case is operated on line, and the browser plug-in calls a local execution agent to access the tested service system;
after the playback execution is finished, the local execution agent acquires data and generates a test report;
the local execution agent synchronizes the test report to the browser plug-in, and the front end of the browser plug-in displays result information;
wherein the local execution agent comprises a Python universal component installed on a local computer.
Further, the use case generated by the browser plug-in recording is based on a built-in mapping configuration file, and the unstable Js control is converted into a corresponding Python script.
Furthermore, the script generated by the browser plug-in recording is a script set for operating a plurality of sets of rules, each keyword script has a matched script of a plurality of positioning rules, and if one rule set executes error reporting, the rule set can be automatically switched to another rule calling mode.
Furthermore, the browser plug-in transcoding based keyword suite supports online on-demand packaging and modification of users, and the modified browser plug-in automatically loads new keyword content and enables the new keyword content in real time.
Furthermore, the generated script is recorded by the browser plug-in, and after debugging and running are successful, the script is automatically submitted to the cloud case library system through the browser plug-in for an external platform to call and execute.
The invention has the beneficial effects that:
(1) in the method, a user can normally operate the browser only by installing the plug-in of the browser and the local execution agent once, namely the universal Python installation package, and the plug-in intercepts the action of each step through the keyword transcoding suite to generate a stable executable script which is instantiated to a local file, so that a complete test case is provided.
(2) According to the action of intercepting each step, through keyword transcoding suite, the generated script is based on the packaged keyword driving format, and the adaptation of multiple positioning rules is added, so that compared with the mode of original ecological playback of external front-end Js, the speed is obviously improved, the operation success rate is more stable, and the later-stage operation and maintenance loss time is greatly saved.
(3) The key word mapping transcoding capability is transparent to users, no modification is needed to be made for application, service 0 intrusion is achieved, the applicability is wider, and meanwhile, the recording and transcoding plug-in is based on multiple browsers, supports mainstream Google browsers and the like, and has better universality.
(4) The test case script after the transcoding can be directly displayed in a browser plug-in, a user does not need to open an additional debugging tool, the test case script can be directly modified and debugged on the current interface, the plug-in can directly run on the local machine according to an operation instruction, a case execution result is output, the test case script has great significance in the process of automatic test popularization, and an access threshold can be greatly reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in 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 method for browser plug-in based interface automation power assurance according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a front-end automated testing principle implemented stably through a browser plug-in;
FIG. 3 is a schematic diagram of the enhancement of an original recording plug-in by keyword and transcoding techniques;
figure 4 is an interaction diagram of an online plug-in with a system under test.
Detailed Description
For further explanation of the various embodiments, the drawings which form a part of the disclosure and which are incorporated in and constitute a part of this specification, illustrate embodiments and, together with the description, serve to explain the principles of operation of the embodiments, and to enable others of ordinary skill in the art to understand the various embodiments and advantages of the invention, and, by reference to these figures, reference is made to the accompanying drawings, which are not to scale and wherein like reference numerals generally refer to like elements.
According to the embodiment of the invention, the method for guaranteeing the interface automation power based on the browser plug-in is provided, the use requirement of a user can be reduced, the automatic test script with stable playback can be automatically generated according to the recording action, online debugging and playback can be realized, and the problem of unstable playback can be solved; the writing requirement of the use case is reduced, the problem of unstable execution of the UI use case is solved, and the UI use case is truly grounded.
Referring to the drawings and the detailed description, the invention will be further described, as shown in fig. 1, in an embodiment of the invention, an interface automation power guarantee method based on a browser plug-in includes the following steps:
s1, modifying and expanding the source code based on the existing open source plug-in, adding the components such as the keyword library component, the mapping file data component, the interception conversion component and the online operation component into the open source plug-in (the original plug-in), and compiling to form a new plug-in; the new plug-in can automatically convert the command and the Js object generated by recording into a customized script through keywords, and the interception conversion capability is added at each original recording point of the plug-in;
wherein, when the new plug-in is recorded and intercepted in S1, the method further includes the following steps:
clicking a recording event, and adding a monitoring event to a window, a Tab label page, a navigation and command message object of a browser by a new plug-in through a universal monitoring method (AddListener) of Js (javascript, the most universal Web page scripting language for development);
extracting the object and command type information of the operation in the message in the event monitoring process to generate a Js script;
before generating the Js script, converting the Js script according to the format of the Robot (function automation test framework written by python) script and transcoding the Js script to generate the Robot format script through a keyword component.
S2, packaging the new plug-in into a browser format to obtain a browser plug-in, and issuing the browser plug-in to a local shared directory;
s3, downloading a browser plug-in by a user;
s4, importing the downloaded browser plug-in by the user in the browser;
s5, starting a browser plug-in, normally completing scene operation in the browser, automatically intercepting a Js object by the browser plug-in according to actions, mapping to generate a stable automation script by contrasting a built-in keyword library component, and simultaneously displaying the automation script in the browser plug-in;
s6, the user makes generalized modification based on the displayed use case script and directly plays back the generalized modification;
when the user performs the generalization modification based on the displayed use case script in the S6, the generalization modification includes dynamic variable replacement;
wherein the dynamic variable replacement comprises changing a time field to a system time stamp, changing a number to a random number, and the like.
S7, automatically calling the local running component by the browser plug-in, and playing back and running the use case;
the main stream front-end Js language object is packaged into a keyword library (a first key factor: a Robot keyword script is more stable than a native Js object), the keyword library component in S1 consists of a front-end Js command component and a mapping table of a Robot command, a plug-in is placed in the mapping table and supports dynamic expansion, a positioning rule library is added on the basis of the keyword library component and comprises rules of attribute positioning, relative position positioning, absolute position positioning and the like, and a keyword suite (a second key factor) is formed;
when the keyword suite records the transcoding to generate the script each time, a plurality of rule script arrays can be generated based on the suite, namely, the rule script arrays are recorded at one time, a rule is given priority when the rule script arrays of a plurality of rules are executed, if the element cannot be found or the positioning error is found, the rule script arrays can be automatically tried to be switched to other rules to search the element, and the execution stability is guaranteed.
As shown in fig. 2, when the browser plug-in S2-S5 and S7 implements the front-end automation test (a stable front-end automation test principle is implemented by the browser plug-in, generally, the automation test regards the application as a black box, and when a user operates a web page based on the browser, if the application runs normally, the browser should be able to complete a series of functional scenes), the following steps are further included;
through the browser plug-in, the operations of clicking, inputting and the like of each step of the interface of the browser can be intercepted and recorded, and the use case script capable of running stably is generated through automatic processing of keyword transcoding.
After a user modifies the case script on the browser plug-in interface, the modified case can be directly debugged, the browser plug-in starts the debugging module, the case script is automatically played back and run, and a test report is generated.
After debugging is passed, the browser plug-in starts an instantiation function and instantiates the use case into the file system.
As shown in fig. 3, the new plug-in formed by the existing open-source plug-in S1 further includes three-segment logic of keyword transcoding, multiple positioning rules, and use case playback (on the basis of the original recording plug-in, a keyword suite module and a transcoding technology are newly added, the playback logic of the original plug-in is optimized, and a new online use case recording plug-in is formed);
wherein the keyword transcoding further comprises the steps of:
a KEY-Value rule is added in a newly-added keyword suite, common operations (such as DOM document object model, set Value input Value, click event and the like) of Js are recorded in advance and put in a warehouse as a KEY Value by using a KEY-Value rule, and keywords of Python (computer programming language) are compiled and packaged at the same time (the keywords of Python are a series of Js control sets and are subjected to fault tolerance through a Python language built-in function) as Value values, are matched and mapped and are stored in a configuration file of a plug-in an array mode.
The open source plug-in records and acquires the operation content of the Js control of the UI, operates the Js control to find out the corresponding Python keyword from the configuration file through the KEY-Value rule, and automatically converts the keyword into a packaged Python case script;
the multi-positioning rule further comprises the steps of:
defining a plurality of positioning rules on the basis of a keyword transcoding library, wherein the rules are internally provided with a plurality of methods including getElementById (an element node is obtained by using Id, value is an attribute value of the element node, so that the second is to find the element node, the first is to obtain a value attribute of the element node, which is a Javascript DOM operation HTML document, the getElementById method can return a reference to a first object with a specified ID), an element positioning method, XPath [ XML Path Language (XML Path Language), which is a Language for determining a part of position in the XML document ] Path positioning method, CSS [ a computer Language for expressing file styles such as HTML (application of standard general markup Language) or XML (a subset of standard general markup Language) ] positioning, Name label positioning and the like, and a keyword suite is formed;
in the recording process, the keywords are mapped and transcoded into stable Robot scripts, a plurality of sets of scripts are automatically generated according to rules at the same time, and the scripts are stored into a configuration file in an array mode;
the use case playback further comprises the following steps:
a user directly plays back a use case script in the new plug-in, and the script can be matched with and load a corresponding keyword suite through the content of the use case file;
the local execution agent is started and the playback function of the browser is started.
As shown in fig. 4, the browser plug-in S2-S5 and S7 further includes the following steps when interacting with the system under test:
a user installs a browser plug-in (online plug-in) in a browser, opens the browser and normally accesses a tested service system;
according to the operation steps of user testing, the browser plug-in automatically intercepts Js operation, searches the mapping relation between keywords and Python in a configuration file according to operation actions, obtains a corresponding Python script, and generates a high-stability test script through the conversion of a multi-rule suite;
the browser plug-in automatically instantiates the script to a local file system;
a user parameterizes related input values based on a test case script displayed by a browser plug-in, and adds judgment condition verification;
the modified use case is operated on line, and the browser plug-in calls a local execution agent to access the tested service system;
after the playback execution is finished, the local execution agent acquires data and generates a test report;
and the local execution agent synchronizes the test report to the browser plug-in, and the front end of the browser plug-in displays result information.
The local execution agent comprises Python and other general components installed on the local computer.
The use case recorded and generated by the browser plug-in is not an original ecological Js script and is based on a built-in mapping configuration file, and an unstable Js control is converted into a corresponding Python script, so that playback execution is more stable.
The script generated by the browser plug-in recording is a script set for operating a plurality of sets of rules, each keyword script is provided with a matched script of a plurality of positioning rules, and if one rule set executes error reporting, the rule set can be automatically switched to another rule calling mode, so that the problem that the original Js positioning object is unstable is solved.
The browser plug-in transcodes the keyword suite based on the transcoding is not known if some specially customized controls are met, online packaging and modification according to needs of a user are supported, and the modified browser plug-in automatically loads new keyword contents and enables the new keyword contents in real time. The execution can ensure the stability as long as the script can be generated by normal transcoding.
And the browser plug-in records the generated script, and after debugging and running are successful, the script is automatically submitted to a cloud case library system through the browser plug-in for an external platform to call and execute.
Keyword suite principle: based on a Robot Framework [ Robot Framework is a generic test automation Framework for acceptance testing and Acceptance Test Driven Development (ATDD) ].
In one embodiment, for a common Web application, NodeJs is used as a front-end architecture, and the core implementation logic is as follows:
1) normally accessing the Web application, installing a browser plug-in and a one-key deployment package, and meeting preset conditions;
2) the method comprises the following steps of opening Web application through a browser, normally logging in a system, and carrying out test operation of inputting information, clicking a function and inquiring related information;
3) in each operation related step, the online plug-in records the query action in real time, acquires an operation object and parameters, maps the initialization page and query of a built-in keyword suite, and converts the Js syntax into a new script in a Robot format and instantiates the script to a case library;
4) modifying the logged Url address into a $ { Url } variable format through data driving of the plug-in, defining a variable value, and triggering an online debugging function;
5) the plug-in calls a local actuator through a built-in adaptive component, and plays back the use case through a browser.
It should be noted that the present embodiment is described for a very simple application, but the method is applicable to more complex applications.
In summary, with the above technical solutions of the present invention, a user only needs to install a plug-in of a browser and a local execution agent, i.e., a general Python installation package, once in the method of the present invention, and can normally operate the browser, the plug-in intercepts the actions of each step through a keyword transcoding suite, generates a stable executable script, and instantiates the stable executable script to a local file, so that a complete test case is provided. According to the action of intercepting each step, through keyword transcoding suite, the generated script is based on the packaged keyword driving format, and the adaptation of multiple positioning rules is added, so that compared with the mode of original ecological playback of external front-end Js, the speed is obviously improved, the operation success rate is more stable, and the later-stage operation and maintenance loss time is greatly saved. The key word mapping transcoding capability is transparent to users, no modification is needed to be made for application, service 0 intrusion is achieved, the applicability is wider, and meanwhile, the recording and transcoding plug-in is based on multiple browsers, supports mainstream Google browsers and the like, and has better universality. The test case script after the transcoding can be directly displayed in a browser plug-in, a user does not need to open an additional debugging tool, the test case script can be directly modified and debugged on the current interface, the plug-in can directly run on the local machine according to an operation instruction, a case execution result is output, the test case script has great significance in the process of automatic test popularization, and an access threshold can be greatly reduced.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (9)

1. The method for guaranteeing the automatic power generation of the interface based on the browser plug-in is characterized by comprising the following steps of:
s1, adding the keyword library component, the mapping file data component, the interception conversion component and the online operation component into the open source plug-in based on the existing open source plug-in, and compiling to form a new plug-in;
s2, packaging the new plug-in into a browser format to obtain a browser plug-in, and issuing the browser plug-in to a local shared directory;
s3, downloading a browser plug-in by a user;
s4, importing the downloaded browser plug-in by the user in the browser;
s5, starting a browser plug-in, normally completing scene operation in the browser, automatically intercepting a Js object by the browser plug-in according to actions, mapping to generate a stable automation script by contrasting a built-in keyword library component, and simultaneously displaying the automation script in the browser plug-in;
s6, the user makes generalized modification based on the displayed use case script and directly plays back the generalized modification;
s7, automatically calling the local running component by the browser plug-in, and playing back and running the use case;
the keyword library component in the S1 is composed of a front-end Js command component and a mapping table of Robot commands, a plug-in is placed in the mapping table and supports dynamic expansion, and a positioning rule base is added on the basis of the keyword library component, the positioning rule base includes attribute positioning, relative position positioning, and absolute position positioning rules, and forms a keyword suite;
when the keyword suite records and transcodes every time to generate a script, a plurality of rule script arrays are generated based on the suite, namely one-time recording, the rule arrays of a plurality of rules are preferentially selected when the rule arrays of the rules are executed, and if the elements cannot be found or the positioning errors are found, the rule arrays are automatically tried to be switched to other rules to search the elements;
the new plug-in formed by the existing open source plug-in the S1 further comprises three logics of keyword transcoding, multiple positioning rules and use case playback;
wherein the keyword transcoding further comprises the steps of:
the keyword suite records and stores the general operation of Js in advance as a Key Value according to a KEY-Value rule, writes and packages Python keywords as a Value, matches and maps the values, and stores the values in a configuration file of the plug-in an array mode;
the open source plug-in records and acquires the operation content of the Js control of the UI, operates the Js control to find out the corresponding Python keyword from the configuration file through the KEY-Value rule, and automatically converts the keyword into a packaged Python case script;
the multi-positioning rule further comprises the steps of:
defining a plurality of positioning rules on the basis of a keyword transcoding library, wherein the rules are internally provided with a getElementById element positioning method, an XPath path positioning method, CSS positioning and Name label positioning to form a keyword suite;
in the recording process, the keywords are mapped and transcoded into stable Robot scripts, a plurality of sets of scripts are automatically generated according to rules at the same time, and the scripts are stored into a configuration file in an array mode;
the use case playback further comprises the following steps:
a user directly plays back a use case script in the new plug-in, and the script can be matched with and load a corresponding keyword suite through the content of the use case file;
the local execution agent is started and the playback function of the browser is started.
2. The method for guaranteeing automatic power generation of an interface based on a browser plug-in of claim 1, wherein the recording interception of the new plug-in the S1 further comprises the following steps:
clicking a recording event, and adding a monitoring event to a window, a Tab label page, a navigation and command message object of a browser by the new plug-in through a Js universal monitoring method;
extracting the object and command type information of the operation in the message in the event monitoring process to generate a Js script;
before generating the Js script, converting the Js script according to the format of the Robot script and transcoding the Js script to generate the Robot format script through the keyword component.
3. The method for guaranteeing automation of interface into power based on browser plug-in of claim 1, wherein when the user performs generalized modification based on the displayed use case script in S6, the generalized modification includes dynamic variable replacement;
wherein the dynamic variable replacement comprises changing a time field to a system timestamp and a number to a random number.
4. The method for guaranteeing power automation of interface based on browser plug-in of claim 1, wherein the browser plug-in of S2-S5 and S7 further comprises the following steps when implementing front-end automation test;
intercepting and recording each interface click and input operation of the browser through a browser plug-in, automatically transcoding the keywords, and generating a case script capable of stably running;
after a user modifies the case script on the browser plug-in interface, the modified case is directly debugged, the browser plug-in starts a debugging module, the case script is automatically played back and run, and a test report is generated;
after debugging is passed, the browser plug-in starts an instantiation function and instantiates the use case into the file system.
5. The method for automatically securing interface power based on browser plug-in of claim 1, wherein the browser plug-in of S2-S5 and S7 further comprises the following steps when interacting with the system under test:
a user installs a browser plug-in a browser, opens the browser and normally accesses a tested service system;
according to the operation steps of user testing, the browser plug-in automatically intercepts Js operation, searches the mapping relation between keywords and Python in a configuration file according to operation actions, obtains a corresponding Python script, and generates a high-stability test script through the conversion of a multi-rule suite;
the browser plug-in automatically instantiates the script to a local file system;
a user parameterizes related input values based on a test case script displayed by a browser plug-in, and adds judgment condition verification;
the modified use case is operated on line, and the browser plug-in calls a local execution agent to access the tested service system;
after the playback execution is finished, the local execution agent acquires data and generates a test report;
the local execution agent synchronizes the test report to the browser plug-in, and the front end of the browser plug-in displays result information;
wherein the local execution agent comprises a Python universal component installed on a local computer.
6. The method for ensuring browser plug-in based interface automation to power of claim 5, wherein the browser plug-in records the generated use case based on a built-in mapping configuration file and converts unstable Js controls into corresponding Python scripts.
7. The method for guaranteeing interface automation success rate based on the browser plug-in of claim 5, wherein the script generated by the browser plug-in recording is a script set for operating a plurality of sets of rules, each keyword script has a matching script of a plurality of positioning rules, and if an error report is executed by one rule set, the method is automatically switched to another rule calling mode.
8. The browser plug-in based interface automation power guarantee method as claimed in claim 5, wherein the keyword suite based on browser plug-in transcoding supports online on-demand packaging and modification by a user, and the modified browser plug-in automatically loads new keyword content and enables in real time.
9. The method for guaranteeing the automatic power generation of the interface based on the browser plug-in of claim 5, wherein the browser plug-in records the generated script, and after debugging and running are successful, the script is automatically submitted to a cloud case library system through the browser plug-in for an external platform to call and execute.
CN202110964767.6A 2021-08-23 2021-08-23 Interface automatic formation power guarantee method based on browser plug-in Active CN113419969B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110964767.6A CN113419969B (en) 2021-08-23 2021-08-23 Interface automatic formation power guarantee method based on browser plug-in

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110964767.6A CN113419969B (en) 2021-08-23 2021-08-23 Interface automatic formation power guarantee method based on browser plug-in

Publications (2)

Publication Number Publication Date
CN113419969A CN113419969A (en) 2021-09-21
CN113419969B true CN113419969B (en) 2021-11-19

Family

ID=77719132

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110964767.6A Active CN113419969B (en) 2021-08-23 2021-08-23 Interface automatic formation power guarantee method based on browser plug-in

Country Status (1)

Country Link
CN (1) CN113419969B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114253630B (en) * 2021-12-23 2023-07-25 上海新炬网络信息技术股份有限公司 Method for realizing log storage based on Java section modification Form change information
CN115934574A (en) * 2023-03-02 2023-04-07 云账户技术(天津)有限公司 Automatic recording method, system, electronic device and medium for interface test case
CN118535469A (en) * 2024-05-17 2024-08-23 上海灵曼信息科技有限公司 Front-end and back-end debugging system based on browser plug-in and application method thereof

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070300161A1 (en) * 2000-08-23 2007-12-27 Rajesh Bhatia Systems and methods for context personalized web browsing based on a browser companion agent and associated services
CN102142016A (en) * 2010-01-29 2011-08-03 微软公司 Cross-browser interactivity recording, playback and editing
CN106874204A (en) * 2017-02-15 2017-06-20 广州神马移动信息科技有限公司 Automatic test method for customizing and custom-built system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070300161A1 (en) * 2000-08-23 2007-12-27 Rajesh Bhatia Systems and methods for context personalized web browsing based on a browser companion agent and associated services
CN102142016A (en) * 2010-01-29 2011-08-03 微软公司 Cross-browser interactivity recording, playback and editing
CN106874204A (en) * 2017-02-15 2017-06-20 广州神马移动信息科技有限公司 Automatic test method for customizing and custom-built system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Characterizing the Delay Performance of Web-based;Chengwei Zhang等;《2015 IEEE/CIC International Conference on Communications in China (ICCC)》;IEEE;20160407;第1-6页 *
自动化测试服务平台的设计与实现;王迎;《CNKI优秀硕士学位论文全文库》;20150615(第06期);第1-82页 *

Also Published As

Publication number Publication date
CN113419969A (en) 2021-09-21

Similar Documents

Publication Publication Date Title
CN113419969B (en) Interface automatic formation power guarantee method based on browser plug-in
US20220222170A1 (en) Software development framework for a cloud computing platform
CN109189684B (en) Python-based automatic interface testing method
US20190354575A1 (en) Systems and methods of a script generation engine
US8635593B2 (en) Dynamic autocompletion tool
CN106293664A (en) Code generating method and device
US20070044066A1 (en) Embedded multi-language programming
CN101482817B (en) Large-particle Java component assembly method based on black box
EP1906275B1 (en) Natively retaining project documentation in a controller
US10997062B1 (en) System and method for implementing an automated regression testing module
JP2000181750A (en) Software testing method
WO1993023817A9 (en) Data interchange system
CN101291253B (en) Man-machine command interaction method for network management terminal based on graphical interface
CN111078555B (en) Test file generation method, system, server and storage medium
US6003026A (en) Emulator for an SQL relational-database
CN112765032A (en) Program debugging method, device, equipment and storage medium
CN111881056A (en) Automatic test framework and test method
US7996764B2 (en) Apparatus, program and method for accepting a request from a client computer via a network and executing a web application
CN114217789A (en) Function component expansion method, device, equipment, storage medium and program product
CN118132597A (en) SQL grammar conversion method and device, storage medium and electronic equipment
CN117931219A (en) Front-end project implementation method and device, electronic equipment and storage medium
CN110888641A (en) Automatic script generation method and device, server and storage medium
CN110659022A (en) Method for automatically calling Python script based on Java
CN115470152A (en) Test code generation method, test code generation device, and storage medium
CN116302852A (en) Information system call chain analysis and result graphical display method

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