CN113392030B - Method and device for testing Js bridge and related equipment - Google Patents

Method and device for testing Js bridge and related equipment Download PDF

Info

Publication number
CN113392030B
CN113392030B CN202110875884.5A CN202110875884A CN113392030B CN 113392030 B CN113392030 B CN 113392030B CN 202110875884 A CN202110875884 A CN 202110875884A CN 113392030 B CN113392030 B CN 113392030B
Authority
CN
China
Prior art keywords
test
page
target
bridge
testing
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
CN202110875884.5A
Other languages
Chinese (zh)
Other versions
CN113392030A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110875884.5A priority Critical patent/CN113392030B/en
Publication of CN113392030A publication Critical patent/CN113392030A/en
Application granted granted Critical
Publication of CN113392030B publication Critical patent/CN113392030B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3688Test management for test execution, e.g. scheduling of test suites
    • 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/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Abstract

The disclosure relates to a method, a device and related equipment for testing a Js bridge, wherein the method comprises the following steps: displaying a test page for testing a target Js bridge method in a page to be published, wherein page elements in the test page comprise test controls, the page elements in the test page are less than the page elements of the page to be published, the test controls correspond to the test method, and the test method comprises the following steps: the method comprises a test case and a method identifier of a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method; and responding to a trigger instruction of the test control, executing a test method to call the target Js bridge method based on the test case to test the target Js bridge method. When the Js bridge method is tested, the Js bridge method can be tested on the test page containing a small number of page elements without waiting for the real page editing to be completed, and the test efficiency is effectively improved.

Description

Method and device for testing Js bridge and related equipment
Technical Field
The present disclosure relates to the field of testing, and in particular, to a method, an apparatus, and a related device for testing Js bridges.
Background
Js bridge (Jsbridge) is an important communication mechanism between applications and the fifth generation hypertext markup Language (HTML 5) page. The application provides a large amount of basic capability for HTML5 pages through Js bridges.
In developing a new Js-bridge method, it is often necessary to test the newly developed Js-bridge method on an HTML5 page. In the related art, after a manufactured real HTML5 page is obtained, a newly developed Js bridge method needs to be tested on the real HTML5 page.
It can be seen that in the related art, the newly developed Js bridge method cannot be tested until the manufactured real HTML5 page is not obtained. Of course, testing of other pages than the HTML5 page may also present the same problem.
Disclosure of Invention
The disclosure provides a method, a device and related equipment for testing a Js bridge, so as to at least solve the problem that the Js bridge method can be tested after waiting for a manufactured real page in the related technology. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a method for testing Js-bridges, including:
displaying a test page for testing a target Js bridge method in a page to be published, wherein page elements in the test page comprise test controls, the page elements in the test page are less than those of the page to be published, the test controls correspond to the test method, and the test method comprises the following steps: the method comprises a test case and a method identifier of the target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
and responding to a trigger instruction of the test control, executing the test method, and calling the target Js bridge method based on the test case to test the target Js bridge method.
In a possible implementation manner of the first aspect, the test control further corresponds to a callback method, and the method further includes:
and according to the callback method, sending the test result of the target Js bridge method to the test page.
In a possible implementation manner of the first aspect, the displaying a test page for testing the target Js bridge method in the page to be published includes: scanning a two-dimensional code by using a target application program, and displaying a test page corresponding to the two-dimensional code, wherein the test page is used for testing a target Js bridge method in a page to be released;
the response to the trigger instruction of the test control, the test method is executed, and the method comprises the following steps:
and the target application program responds to a trigger instruction of the test control to execute the test method.
According to a second aspect of embodiments of the present disclosure, there is provided a method of testing Js-bridges, comprising:
obtaining a test case and a method identifier of a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
according to the method identifier and the test case, a test method for testing the target Js bridge method in the page to be published is obtained, and the test method comprises the following steps: the test case and the method identifier of the target Js bridge method;
obtaining a test page comprising a test control, wherein the test control corresponds to a test method, and the test page comprises fewer page elements than the page elements of the page to be issued;
and sending the test page to test the target Js bridge method.
In a possible implementation manner of the second aspect, the method further includes:
obtaining test parameters configured in a parameter form, wherein the parameter form is matched with the target Js bridge method;
and saving the obtained test parameters as test cases.
In a possible implementation manner of the second aspect, the method identifier of the method for obtaining the test case and the target Js bridge method includes:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
In a possible implementation manner of the second aspect, the method further includes:
obtaining a method name and a parameter definition of a bridge method to be registered;
and registering the bridge method to be registered according to the method name of the bridge method to be registered and the parameter definition, and generating a newly registered bridge method.
In a possible implementation manner of the second aspect, the method further includes:
and generating a parameter form matched with the newly registered bridge method according to the parameter definition.
According to a third aspect of embodiments of the present disclosure, there is provided an apparatus for testing Js-bridges, including:
the system comprises a page display unit, a target Js bridge method and a test control unit, wherein the page display unit is configured to execute and display a test page for testing the target Js bridge method in a page to be issued, page elements in the test page comprise test controls, the page elements in the test page are less than those of the page to be issued, the test controls correspond to the test method, and the test method comprises the following steps: the method comprises a test case and a method identifier of the target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
and the method executing unit is configured to execute the test method in response to the trigger instruction of the test control so as to call the target Js bridge method based on the test case to test the target Js bridge method.
In a possible implementation manner of the third aspect, the test control further corresponds to a callback method, and the apparatus further includes:
and the result sending unit is configured to send the test result of the target Js bridge method to the test page according to the callback method.
In a possible implementation manner of the third aspect, the page display unit displays a test page for testing the target Js bridge method in the page to be published, and is specifically configured to perform: scanning a two-dimensional code by using a target application program, and displaying a test page corresponding to the two-dimensional code, wherein the test page is used for testing a target Js bridge method in a page to be released;
the method execution unit, in response to a trigger instruction to the test control, executes the test method, and is specifically configured to execute:
and the target application program responds to a trigger instruction of the test control to execute the test method.
According to a fourth aspect of embodiments of the present disclosure, there is provided an apparatus for testing Js-bridges, including:
the data acquisition unit is configured to execute method identification for acquiring a test case and a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
a method obtaining unit configured to perform a test method for obtaining a test of the target Js-bridge method in a page to be published according to the method identifier and the test case, the test method including: the test case and the method identifier of the target Js bridge method;
the page obtaining unit is configured to obtain a test page comprising a test control, wherein the test control corresponds to a test method, and the test page comprises fewer page elements than the page elements of the page to be issued;
and the page sending unit is configured to send the test page so as to test the target Js bridge method.
In a possible implementation manner of the fourth aspect, the method further includes:
a parameter obtaining unit configured to perform obtaining a test parameter configured in a parameter form, wherein the parameter form matches the target Js-bridge method;
and a parameter storage unit configured to perform storage of the obtained test parameters as test cases.
In a possible implementation manner of the fourth aspect, the data obtaining unit obtains a test case and a method identifier of the target Js bridge method, and is specifically configured to perform:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
In a possible implementation manner of the fourth aspect, the method further includes:
a definition obtaining unit configured to perform obtaining a method name and a parameter definition of a bridge method to be registered;
and the method registration unit is configured to register the bridge method to be registered according to the method name of the bridge method to be registered and the parameter definition and generate a newly registered bridge method.
In a possible implementation manner of the fourth aspect, the method further includes:
and a form generation unit configured to perform generation of a parameter form matching the newly registered bridge method in accordance with the parameter definition.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a method of testing Js bridges as described above.
According to a sixth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform a method of testing Js bridges as described above.
According to a seventh aspect of embodiments of the present disclosure, there is provided a computer program product adapted to perform a program initialized with steps of a method of testing Js bridges as described above, when executed on an electronic device.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
when the Js bridge method is tested, the Js bridge method can be tested on the test page containing a small number of page elements without waiting for the edition of a real page (such as an HTML5 page) to be completed. Because the test page contains fewer page elements, the time spent in editing the test page is less, and the test efficiency is effectively improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is a flow chart illustrating a method of testing Js bridges according to an exemplary embodiment;
FIG. 2 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment;
FIG. 3 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment;
FIG. 4 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment;
FIG. 5 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment;
FIG. 6 is a block diagram illustrating an apparatus for testing Js bridges according to another exemplary embodiment;
FIG. 7 is a block diagram illustrating an apparatus for testing Js bridges according to another exemplary embodiment;
fig. 8 is a block diagram of an electronic device, according to another example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
FIG. 1 is a flow chart illustrating a method of testing Js bridges, as shown in FIG. 1, according to an exemplary embodiment, including the following steps.
In step S11, a test page for testing a target Js bridge method in a page to be published is displayed, wherein page elements in the test page include test controls, the test page includes fewer page elements than the page elements of the page to be published, the test controls correspond to the test method, and the test method includes: the test case and the method identification of the target Js bridge method are used, and the test case comprises test parameters of the target Js bridge method.
Alternatively, the method shown in fig. 1 of the present disclosure may be applied to a terminal device. The terminal device may be a personal computer, a tablet computer, a mobile phone, a wearable device, etc.
Alternatively, the present disclosure may perform the method illustrated in fig. 1 under a certain test environment, which may be a Js-bridge test environment.
Wherein, the test environment may be a target application program, namely: step S11 and step S12 are performed by the target application. Alternatively, the target application may be: an application program having a function of opening a test page. The test page may be an HTML5 page, or may be another page. In an alternative embodiment, the target application may be: an application program in a mobile terminal having a function of opening an HTML5 page.
Optionally, displaying a test page for testing the target Js bridge method in the page to be published may specifically include: the target application program displays a test page for testing the target Js bridge method in the page to be published.
In practical applications, the present disclosure may obtain the page address of the test page in a variety of ways, so as to display the test page. For example: the page address of the test page is obtained by scanning the two-dimension code, and the following steps are performed: obtaining a web page address shared through a network; and the following steps: and obtaining the webpage address input by the user.
Alternatively, the target application may provide multiple Js-bridge methods for use with HTML5 pages. The application can test part or all of the Js bridge methods in the Js bridge methods provided by the target application program. Optionally, the testing method corresponding to each testing control may test a Js bridge method. When the test page includes a test control, the present disclosure tests a Js-bridge method through the test page. When the test page comprises a plurality of test controls, the method can test a plurality of Js bridge methods through the test page.
Optionally, a test control corresponding to the test method may trigger execution of the test method in response to a trigger instruction to the test control. Optionally, the test control may be a control for generating a test start instruction according to a trigger instruction for the test control, where the test start instruction is an instruction for starting to test the target Js bridge method.
Optionally, the test page includes fewer page elements than the page elements of the page to be published. The page to be published is a page which is edited by webpage editors according to actual demands and used for publishing, and the page to be published comprises more page elements, such as: the page to be issued comprises: audio playback components, picture display components, key components, animation display components, etc. The test page of the present disclosure may contain a small number of page elements, so that when testing the Js bridge method, the present disclosure may test the Js bridge method on the test page containing a small number of page elements without waiting for the real HTML5 page editing to complete. Since the test page contains fewer page elements, less time is spent editing the test page.
In an alternative embodiment, the test page may be comprised of at least one test control. Namely: the test page comprises the following page elements: and testing the control. In this case, the present disclosure does not require editing of the test page, and the test page including the test control is generated. When the test page is loaded, a test method corresponding to the test control included in the test page is operated to perform the test.
Alternatively, the method identifier may be a method name. The test parameters may correspond to method identifications, and when the method identifications are different, the test parameters corresponding to the method identifications are also different.
In an alternative embodiment, the Test method may be specifically a Test Function (Test Function), and the method identifier may be a Function name. In a computer, a test function is one function for functional verification or error detection in software, and in general, test functions of different functions are different. Test functions are an indispensable part of software, mainly verifying the functional and performance requirements of the software.
In other embodiments, at least one test control in the test page may correspond to a callback method. The callback method can send the test result of the target Js bridge method to the test page.
In an alternative embodiment, the callback method may be embodied as a callback function (Callback Functions). The callback function is a function that is passed as a parameter.
In step S12, in response to the trigger instruction for the test control, the test method is executed to call the target Js bridge method based on the test case to test the target Js bridge method.
Optionally, the present disclosure may perform a test method in response to a trigger instruction to a test control in a test environment. Specifically, in step S12, in response to a trigger instruction for the test control, the test method is executed, which may include:
and the target application program responds to the trigger instruction of the test control to execute the test method.
The target application is already described in step S11, and will not be described again.
Optionally, the test initiation instruction is a trigger instruction to the test control. Wherein, the test control can be: and the control is used for generating a test starting instruction according to the trigger instruction of the test control. The test initiation instruction may be an instruction to initiate testing of the target Js bridge method. In practical application, the control types of the test control may be: keys, sliding bars, a hook frame, etc.
Optionally, in response to the test initiation instruction, the method for executing the test may specifically include: and responding to a trigger instruction of the test control, and executing the test method.
Alternatively, the test page may be comprised of at least one test method and at least one test control. Namely: the test page comprises the following page elements: test methods and test controls. In this case, the present disclosure needs to edit the test controls (e.g., edit the number, position, style, and triggered test method of the test controls), and then generate a test page including the test method and the test controls. In the case where the test page is loaded by the target application and the test control is triggered, the test method included in the test page may be run to perform the test.
In practice, the present disclosure may use a test page template that includes one or more preset test controls. The number, position, style, etc. of the preset test controls are edited in advance, and repeated editing is not needed in the present disclosure. At the moment, the method and the device for testing the page template are used for binding the testing method with the preset testing control in the testing page template, and are more convenient and quick. Because the number, the position and the style of the test controls do not need to be edited, and the test method can be automatically bound with the preset test controls in the test page template, the test page can be automatically generated according to the test page template, and the test page does not need to be edited manually.
According to the method shown in the figure 1, the Js bridge method can be tested by using the test page, and the real page which is manufactured does not need to be waited, so that the test progress of the Js bridge method can be effectively accelerated.
FIG. 2 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment, wherein the method shown in FIG. 2 further includes a callback method, as shown in FIG. 2, comprising the following steps.
In step S11, a test page for testing a target Js bridge method in a page to be published is displayed, wherein page elements in the test page include test controls, the test page includes fewer page elements than the page elements of the page to be published, the test controls correspond to the test method, and the test method includes: the test case and the method identification of the target Js bridge method are used, and the test case comprises test parameters of the target Js bridge method.
In step S12, in response to the trigger instruction for the test control, the test method is executed to call the target Js bridge method based on the test case to test the target Js bridge method.
Step S11 and step S12 are described in the embodiment shown in fig. 1, and the same points are only required to refer to the embodiment shown in fig. 1, and are not described again.
In step S13, according to the callback method, the test result of the target Js bridge method is sent to the test page. The test control also corresponds to a callback method.
The callback method may be called after the target Js bridge method is executed successfully, so as to return the execution result of the target Js bridge method (i.e. the test result of the target Js bridge method) to the test page.
FIG. 3 is a flow chart illustrating a method of testing Js bridges, as shown in FIG. 3, according to another exemplary embodiment, including the following steps.
In step S21, a test case and a method identifier of the target Js bridge method are obtained, where the test case includes test parameters of the target Js bridge method.
The method shown in fig. 3 may be applied to a terminal device or a server device. Alternatively, the method shown in fig. 3 may be applied to a personal computer.
Step S21 may be performed by using test cases obtained in various manners and method identification of the target Js bridge method. For example: obtaining a test case and a method identifier of a target Js bridge method from the server device; and the following steps: and obtaining the test case input by the user and the method identification of the target Js bridge method.
When the method identifier of the test case and the target Js bridge method is input by the user, the embodiment of the disclosure can send the method identifier of the test case and the target Js bridge method to the server device for storage. When the target Js bridge method provided by other application programs is required to be tested, the target Js bridge method and the test case can be obtained from the server side for testing, and the user does not need to repeatedly input the test case and the method identification of the target Js bridge method, so that the method is convenient and quick. Meanwhile, the test case and the method identifier of the target Js bridge method are sent to the server side equipment for storage, and the test case can be shared for other people to use as the test case of the target Js bridge method. It can be seen that the test cases obtained by the present disclosure can be reused. When a certain HTML5 page needs to be migrated to other application programs, the method can be used for testing on the other application programs by using the test cases stored in the server side equipment and the method identification of the target Js bridge method, and the method is very convenient.
In step S22, according to the method identifier and the test case, a test method for testing the target Js bridge method in the page to be published is obtained, where the test method includes: test cases and method identification of target Js bridge methods.
The present disclosure may combine the method identification with the test case to obtain a test method that tests the target Js-bridge method.
Optionally, the method disclosed by the disclosure can also perform combined processing on the callback method, the method identifier and the test case to obtain a test method for testing the target Js bridge method.
In step S23, a test page including a test control is obtained, where the test control corresponds to the test method, and the test page includes fewer page elements than the page elements of the page to be published.
Optionally, the test page is composed of at least one test control. Optionally, the test page may be a blank page, which is not required to be edited in the present disclosure, and a test page including the test control may be generated, which is simple and fast.
Optionally, a test control corresponding to the test method may trigger execution of the test method in response to a trigger instruction to the test control. Optionally, the test control may be a control for generating a test start instruction according to a trigger instruction for the test control, where the test start instruction is an instruction for starting to test the target Js bridge method. At this time, the present disclosure may edit the test control, except for the test control, the other areas of the test page are blank. In other embodiments, the present disclosure may use a test page template to generate a test page including test controls. The test page template includes one or more preset test controls. The number, position, style, etc. of the preset test controls are edited in advance, and repeated editing is not needed in the present disclosure. At the moment, the method and the device for testing the page template are used for binding the testing method with the preset testing control in the testing page template, and are more convenient and quick. Because the number, the position and the style of the test controls do not need to be edited, and the test method can be automatically bound with the preset test controls in the test page template, the test page can be automatically generated according to the test page template, and the test page does not need to be edited manually.
Optionally, after obtaining the test page including the test control in step S23, the present disclosure may display a test button, and when the test button is triggered, the present disclosure further executes step S24.
In step S24, a test page is sent to test the target Js-bridge method.
Optionally, the present disclosure may send each page element of the test page to the testing environment of the Js bridge, so as to test the target Js bridge method in the testing environment of the Js bridge.
Alternatively, the testing environment of the Js bridge may be the target application, that is, step S24 may send each page element of the testing page to the target application, so that the target application opens the testing page to test the target Js bridge method.
Optionally, step S24 may display a two-dimensional code corresponding to the page address of the test page, and after the target application of a certain electronic device scans the two-dimensional code, the target application may access the page address of the test page and load the test page. Thus, step S24 achieves that each page element of the test page is sent to the test environment of the Js bridge.
FIG. 4 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment, the method of FIG. 4 further including the following steps relative to the method of FIG. 3.
In step S25, the test parameters configured in the parameter form are obtained, wherein the parameter form is matched with the target Js-bridge method.
Alternatively, the parameter form may be a form for filling out the test parameters. The parameter types in the test form can be preset, and the parameter types of the test parameters filled in the test form can be effectively restrained through the test form with the preset parameter types, so that errors are prevented. Of course, the disclosure may also restrict parameter information such as the length of the test parameters through the test form.
In practical applications, the present disclosure may set the parameter form according to the Js bridge specification. The specification of the Js bridge is used to constrain at least one of method names, remarks, parameters, and parameter internal field definitions of the Js bridge method. When a Js bridge method is needed to be established, the established Js bridge method is required to meet the standards of the Js bridge.
In step S26, the obtained test parameters are stored as test cases.
Optionally, after the obtained test parameters are saved as the test cases in step S26, the test cases may be uploaded to the server device for storage. Thus, each terminal device can obtain the test case from the server device and use the test case.
Of course, when the test case is uploaded, the method identifier of the test case and the target Js bridge method can be sent to the server side equipment for storage, so that the test case is embodied as the test case of the target Js bridge method.
Optionally, step S21 in the method shown in fig. 4 may specifically include:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
The test cases stored in the server and the method identification of the target Js bridge method are uploaded to the server in advance.
FIG. 5 is a flow chart illustrating a method of testing Js bridges according to another exemplary embodiment, the method of FIG. 5 further including the following steps relative to the method of FIG. 3.
In step S27, the method name and parameter definition of the bridge method to be registered are obtained.
Wherein the parameter definition may be a parameter internal field definition.
In step S28, the bridge method to be registered is registered according to the method name and parameter definition of the bridge method to be registered, and a newly registered bridge method is generated.
Alternatively, the present disclosure may send the generated newly registered bridge method to the server device to share the newly registered bridge method.
Steps S27 and S28 may register a new bridge method.
Optionally, the method shown in fig. 5 may further include:
and generating a parameter form matched with the newly registered bridge method according to the parameter definition.
FIG. 6 is a block diagram illustrating an apparatus for testing Js bridges according to an exemplary embodiment. Referring to fig. 6, the apparatus includes a page display unit 121 and a method execution unit 122.
The page display unit 121 is configured to execute displaying a test page for testing a target Js bridge method in a page to be published, wherein page elements in the test page include test controls, the page elements included in the test page are less than the page elements of the page to be published, the test controls correspond to a test method, and the test method includes: the method comprises a test case and a method identifier of a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
the method execution unit 122 is configured to execute a test method in response to a trigger instruction to the test control, so as to call the target Js bridge method to test the target Js bridge method based on the test case.
Optionally, the test control further corresponds to a callback method, and the apparatus shown in fig. 6 may further include:
and the result sending unit is configured to send the test result of the target Js bridge method to the test page according to the callback method.
Optionally, the page display unit 121 displays a test page for testing the target Js bridge method in the page to be published, specifically configured to perform: and scanning the two-dimensional code by using the target application program, displaying a test page corresponding to the two-dimensional code, wherein the test page is used for testing the target Js bridge method in the page to be released.
Optionally, the method executing unit 122 executes the test method in response to a trigger instruction to the test control, and is specifically configured to execute:
and the target application program responds to the trigger instruction of the test control to execute the test method.
FIG. 7 is a block diagram illustrating another apparatus for testing Js bridges according to an exemplary embodiment. Referring to fig. 7, the apparatus includes: a data obtaining unit 221, a method obtaining unit 222, a page obtaining unit 223, and a page transmitting unit 224.
A data obtaining unit 221 configured to perform obtaining a test case and a method identifier of the target Js bridge method, where the test case includes test parameters of the target Js bridge method;
the method obtaining unit 222 is configured to perform a test method for obtaining a target Js bridge method in a page to be published according to the method identifier and the test case, where the test method includes: test cases and method identification of a target Js bridge method;
the page obtaining unit 223 is configured to obtain a test page including a test control, where the test control corresponds to the test method, and the test page includes fewer page elements than the page elements of the page to be issued;
the page sending unit 224 is configured to perform sending of a test page to test the target Js-bridge method.
Optionally, the apparatus shown in fig. 7 may further include:
a parameter obtaining unit configured to perform obtaining a test parameter configured in a parameter form, wherein the parameter form matches with the target Js-bridge method;
and a parameter saving unit configured to perform saving of the obtained test parameters as test cases.
Optionally, the data obtaining unit 221 obtains a test case and a method identifier of the target Js bridge method, and is specifically configured to perform:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
Optionally, the apparatus shown in fig. 7 may further include:
a definition obtaining unit configured to perform obtaining a method name and a parameter definition of a bridge method to be registered;
and the method registration unit is configured to perform registration of the bridge method to be registered according to the method name and parameter definition of the bridge method to be registered and generate a newly registered bridge method.
Optionally, the apparatus shown in fig. 7 may further include:
and a form generation unit configured to perform generation of a parameter form matching the newly registered bridge method in accordance with the parameter definition.
The specific manner in which the individual units perform the operations in relation to the apparatus of the above embodiments has been described in detail in relation to the embodiments of the method and will not be described in detail here.
Fig. 8 is a block diagram of an electronic device 800, as shown in fig. 8, according to an exemplary embodiment, the electronic device 800 comprising:
a processor 820;
memory 804 for storing instructions executable by processor 820;
wherein processor 820 is configured to execute instructions to implement any of the methods of testing Js bridges as provided by embodiments of the disclosure.
In an exemplary embodiment, a computer readable storage medium comprising instructions, such as the memory 804 comprising instructions, is also provided, which when executed by the processor 820 of the electronic device 800, enables the electronic device to perform any of the methods of testing Js bridges provided by the embodiments of the disclosure. Alternatively, the storage medium may be a non-transitory computer readable storage medium, for example, a ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, which, when executed on an electronic device 800, is adapted to carry out a program initializing steps of a method of testing Js bridges as provided by any of the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (19)

1. A method of testing Js bridges, comprising:
displaying a test page for testing a target Js bridge method in a page to be published, wherein page elements in the test page comprise test controls, the page elements in the test page are less than those of the page to be published, the test controls correspond to the test method, and the test method comprises the following steps: the method comprises a test case and a method identifier of the target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
and responding to a trigger instruction of the test control, executing the test method, and calling the target Js bridge method based on the test case to test the target Js bridge method.
2. The method of claim 1, wherein the test control further corresponds to a callback method, the method further comprising:
and sending a test result of the target Js bridge method to the test page according to the callback method.
3. The method of claim 1, wherein displaying the test page for testing the target Js-bridge method in the page to be published comprises: scanning a two-dimensional code by using a target application program, and displaying a test page corresponding to the two-dimensional code, wherein the test page is used for testing a target Js bridge method in a page to be released;
the response to the trigger instruction of the test control, the test method is executed, and the method comprises the following steps:
and the target application program responds to a trigger instruction of the test control to execute the test method.
4. A method of testing Js bridges, comprising:
obtaining a test case and a method identifier of a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
according to the method identifier and the test case, a test method for testing the target Js bridge method in the page to be published is obtained, and the test method comprises the following steps: the test case and the method identifier of the target Js bridge method;
obtaining a test page comprising a test control, wherein the test control corresponds to a test method, and the test page comprises fewer page elements than the page elements of the page to be issued;
and sending the test page to test the target Js bridge method.
5. The method as recited in claim 4, further comprising:
obtaining test parameters configured in a parameter form, wherein the parameter form is matched with the target Js bridge method;
and saving the obtained test parameters as test cases.
6. The method of claim 5, wherein the method identification of the get test case and target Js-bridge method comprises:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
7. The method as recited in claim 4, further comprising:
obtaining a method name and a parameter definition of a bridge method to be registered;
and registering the bridge method to be registered according to the method name of the bridge method to be registered and the parameter definition, and generating a newly registered bridge method.
8. The method as recited in claim 7, further comprising:
and generating a parameter form matched with the newly registered bridge method according to the parameter definition.
9. An apparatus for testing Js bridges, comprising:
the system comprises a page display unit, a target Js bridge method and a test control unit, wherein the page display unit is configured to execute and display a test page for testing the target Js bridge method in a page to be issued, page elements in the test page comprise test controls, the page elements in the test page are less than those of the page to be issued, the test controls correspond to the test method, and the test method comprises the following steps: the method comprises a test case and a method identifier of the target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
and the method executing unit is configured to execute the test method in response to the trigger instruction of the test control so as to call the target Js bridge method based on the test case to test the target Js bridge method.
10. The apparatus of claim 9, wherein the test control further corresponds to a callback method, the apparatus further comprising:
and the result sending unit is configured to send the test result of the target Js bridge method to the test page according to the callback method.
11. The apparatus of claim 9, wherein the page display unit displays a test page for testing the target Js-bridge method in the page to be published, and is specifically configured to perform: scanning a two-dimensional code by using a target application program, and displaying a test page corresponding to the two-dimensional code, wherein the test page is used for testing a target Js bridge method in a page to be released;
the method execution unit, in response to a trigger instruction to the test control, executes the test method, and is specifically configured to execute:
and the target application program responds to a trigger instruction of the test control to execute the test method.
12. An apparatus for testing Js bridges, comprising:
the data acquisition unit is configured to execute method identification for acquiring a test case and a target Js bridge method, wherein the test case comprises test parameters of the target Js bridge method;
a method obtaining unit configured to perform a test method for obtaining a test of the target Js-bridge method in a page to be published according to the method identifier and the test case, the test method including: the test case and the method identifier of the target Js bridge method;
the page obtaining unit is configured to obtain a test page comprising a test control, wherein the test control corresponds to a test method, and the test page comprises fewer page elements than the page elements of the page to be issued;
and the page sending unit is configured to send the test page so as to test the target Js bridge method.
13. The apparatus as recited in claim 12, further comprising:
a parameter obtaining unit configured to perform obtaining a test parameter configured in a parameter form, wherein the parameter form matches the target Js-bridge method;
and a parameter storage unit configured to perform storage of the obtained test parameters as test cases.
14. The apparatus of claim 13, wherein the data obtaining unit obtains a test case and a method identifier of a target Js-bridge method, and is specifically configured to perform:
the selected test case and the method identification of the target Js bridge method are obtained from the server.
15. The apparatus as recited in claim 12, further comprising:
a definition obtaining unit configured to perform obtaining a method name and a parameter definition of a bridge method to be registered;
and the method registration unit is configured to register the bridge method to be registered according to the method name of the bridge method to be registered and the parameter definition and generate a newly registered bridge method.
16. The apparatus as recited in claim 15, further comprising:
and a form generation unit configured to perform generation of a parameter form matching the newly registered bridge method in accordance with the parameter definition.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of testing Js bridges of any of claims 1 to 8.
18. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of testing Js bridges of any one of claims 1 to 8.
19. Computer program product, characterized in that it is adapted to perform a program initialized with the steps of the method of testing Js bridges of any one of claims 1 to 8, when executed on an electronic device.
CN202110875884.5A 2021-07-30 2021-07-30 Method and device for testing Js bridge and related equipment Active CN113392030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110875884.5A CN113392030B (en) 2021-07-30 2021-07-30 Method and device for testing Js bridge and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110875884.5A CN113392030B (en) 2021-07-30 2021-07-30 Method and device for testing Js bridge and related equipment

Publications (2)

Publication Number Publication Date
CN113392030A CN113392030A (en) 2021-09-14
CN113392030B true CN113392030B (en) 2023-10-24

Family

ID=77622789

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110875884.5A Active CN113392030B (en) 2021-07-30 2021-07-30 Method and device for testing Js bridge and related equipment

Country Status (1)

Country Link
CN (1) CN113392030B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357323A (en) * 2015-12-11 2016-02-24 北京京东尚科信息技术有限公司 HTML5 page debugging method and device in APP
CN109408387A (en) * 2018-10-24 2019-03-01 天津字节跳动科技有限公司 Page test method and device
CN109815115A (en) * 2018-12-14 2019-05-28 深圳壹账通智能科技有限公司 Method and device, the computer equipment, storage medium of debugging bridge joint mouth
CN110046101A (en) * 2019-04-15 2019-07-23 腾讯音乐娱乐科技(深圳)有限公司 Page automated testing method, device and computer storage medium
CN110377476A (en) * 2019-07-05 2019-10-25 无锡睿勤科技有限公司 Terminal test method, terminal and readable storage medium storing program for executing
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10735449B2 (en) * 2017-07-11 2020-08-04 Viaforensics, Llc Methods and apparatuses for improved mobile app security testing via bridged native and web user interface interaction
US10936477B2 (en) * 2018-01-31 2021-03-02 Salesforce.Com, Inc. End-to-end user interface component testing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357323A (en) * 2015-12-11 2016-02-24 北京京东尚科信息技术有限公司 HTML5 page debugging method and device in APP
CN109408387A (en) * 2018-10-24 2019-03-01 天津字节跳动科技有限公司 Page test method and device
CN109815115A (en) * 2018-12-14 2019-05-28 深圳壹账通智能科技有限公司 Method and device, the computer equipment, storage medium of debugging bridge joint mouth
CN110046101A (en) * 2019-04-15 2019-07-23 腾讯音乐娱乐科技(深圳)有限公司 Page automated testing method, device and computer storage medium
CN110377476A (en) * 2019-07-05 2019-10-25 无锡睿勤科技有限公司 Terminal test method, terminal and readable storage medium storing program for executing
CN110941546A (en) * 2019-10-12 2020-03-31 平安健康保险股份有限公司 Automatic test method, device, equipment and storage medium for WEB page case

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JavaScript API自动化测试方案的管理设计与实现;张令芬;;电子设计工程;第24卷(第2期);第35-37、41页 *

Also Published As

Publication number Publication date
CN113392030A (en) 2021-09-14

Similar Documents

Publication Publication Date Title
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN110928767B (en) Webpage analysis method, device, equipment and storage medium
CN113741898B (en) Form generation method, device and equipment
CN111090431A (en) Data processing method and device
CN112597020A (en) Interface testing method and device, computer equipment and storage medium
CN105786476B (en) Data processing method and system between mobile client and server
CN111666199B (en) Debugging method executed on intelligent terminal and software debugger
CN112835809A (en) Test data setting method, device, equipment and medium based on browser
CN110320378B (en) Method, apparatus, device and computer readable storage medium for applying for a quality control test
CN110134380B (en) Code generation method and device based on template engine and electronic equipment
CN108804120B (en) Page construction method, device, equipment and storage medium
CN114443905A (en) Interface document updating method and device, electronic equipment and readable storage medium
CN113392030B (en) Method and device for testing Js bridge and related equipment
CN113419729A (en) Front-end page building method, device, equipment and storage medium based on modularization
CN111694733A (en) API (application programming interface) testing method and device for software development kit SDK (software development kit)
JP2009237654A (en) Test program management system
CN111488286B (en) Method and device for independently developing Android modules
CN111427770B (en) Resource testing method and related equipment
CN109284097B (en) Method, device, system and storage medium for realizing complex data analysis
CN113934412A (en) Program generation method, device, equipment and storage medium
CN111078209B (en) Development processing method, device and equipment for business page
CN116974653B (en) Class loading method and system
CN109361730A (en) Card information acquisition methods, system and Cloud Server based on face
CN117709361B (en) Model generation method, device and equipment of session scene
CN115562670B (en) Page configuration method, device, electronic equipment and medium

Legal Events

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