Automatic browser testing method and system, terminal equipment and storage medium

Create test cases through templates and wizards, write test scripts based on preset programming languages, and combine WebDriver protocol, containerization and virtualization technology to solve the compatibility problems of cross-browsers and cross-operating systems in the existing technology, realize the flexibility of test case management and efficient maintenance of automated scripts, and improve the efficiency and reliability of automated testing.

CN119829454APending Publication Date: 2025-04-15佛山领客易选科技服务有限公司

Patent Information

Application Number
CN202411954771.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing browser automation testing technology has compatibility problems between cross-browsers and cross-operating systems, inconvenient test case management, and lack of flexible dynamic update mechanisms, resulting in high maintenance costs. The writing and maintenance of automated scripts requires a high technical threshold, making it difficult for non-developers to participate, which increases the burden on the team.

Method used

Use templates and wizards to create test cases, write test scripts based on preset programming languages, interact with the browser through the WebDriver protocol, use containerization and virtualization technology to ensure the consistency of the test environment, and combine Jenkins and CI/CD tools to achieve seamless connection between automated testing and continuous integration and continuous delivery.

Benefits of technology

Create test cases through templates and wizards to reduce human errors and improve team collaboration efficiency; test scripts based on preset programming languages ​​can quickly execute test tasks and have good scalability; ensure cross-browser and cross-operating system compatibility through WebDriver protocol and containerization technology; combine Jenkins and CI/CD tools to achieve efficient execution and continuous integration of automated tests, reduce test omissions and deployment risks, and accelerate development and testing cycles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829454A_ABST
    Figure CN119829454A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of automatic testing, and provides a browser automatic testing method and system, terminal equipment and a storage medium, the browser automatic testing method comprises the steps that a test case is created according to a template and a guide, and the test case comprises a test step, an expected result and test data; compiling test scripts associated with the plurality of test cases based on a preset programming language; a browser and an operating system are selected, a test script is executed on the browser and the operating system, the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through a containerization technology and a virtualization technology; and configuring a CI / CD pipeline in the Jenkins and setting Webhooks, and constructing a test task to test the test case when a new test script is detected next time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to a browser automated testing method, system, terminal equipment and storage medium. Background Art

[0002] With the continuous development and increasing complexity of Web applications, manual testing can no longer meet the needs of modern software development for efficient, fast and high-quality delivery. Automated testing is widely used in the software development process, especially in the testing of Web applications. Automated testing can significantly improve test coverage and execution efficiency, reduce human errors, and ensure code quality and stability.

[0003] In modern software development, the tasks and environments that automated testing needs to handle are becoming increasingly complex. Existing browser automated testing technology still has some defects. First, cross-browser and cross-operating system compatibility issues are still prominent, and test results may be inconsistent due to environmental differences; second, test case management is inconvenient and lacks a flexible dynamic update mechanism, resulting in high maintenance costs; the writing and maintenance of automated scripts also requires a high technical threshold, and non-developers often find it difficult to participate, which increases the burden on the team. Summary of the invention

[0004] In view of the above-mentioned defects, the purpose of the present invention is to propose a browser automation testing method, system, terminal device and storage medium, aiming to provide test results more quickly and minimize the overall workload required to perform specific operations in a Web browser, thereby reducing the overall operation execution time and improving efficiency.

[0005] To achieve this object, the present invention adopts the following technical solutions:

[0006] A browser automation testing method, the browser automation testing method comprising:

[0007] Create a test case according to the template and wizard, wherein the test case includes test steps, expected results and test data;

[0008] Writing test scripts associated with the plurality of test cases based on a preset programming language;

[0009] Select a browser and an operating system, execute a test script on the browser and the operating system, the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology;

[0010] Configure the CI / CD pipeline in Jenkins and set up webhooks to build a test task to test the test case the next time a new test script is detected.

[0011] Preferably, the method further includes editing test cases; the editing test cases includes:

[0012] Get the created test cases in the storage space;

[0013] Based on the created test cases and test requirements, obtain the processing logic missing from the created test cases;

[0014] Add the required test steps and expected results to the created test case, and store the new test case and the corresponding version number in the storage space.

[0015] Preferably, it also includes deleting the test case;

[0016] The deletion test case includes:

[0017] Get the version number of the selected browser, and compare the configuration of the browser under the current version number with the current test case;

[0018] If the current test case is not applicable to the configuration of the browser under the current version number, the current test case will be soft deleted.

[0019] Preferably, writing a test script associated with a plurality of the test cases based on a preset programming language comprises:

[0020] Select a programming language, and select a code editor and an integrated development environment corresponding to the programming language, wherein the code editor is used to provide syntax highlighting and code completion functions;

[0021] Based on the code editor and integrated development environment, write test scripts using the API provided by the automated testing framework;

[0022] Save the completed test script to the version control system.

[0023] Preferably, selecting a browser includes setting startup parameters of the browser.

[0024] Preferably, after executing the test script on the browser and the operating system, the following steps are included:

[0025] Collect the execution results of each test case and generate a test report, where the execution results of the failed test cases include the failure reasons and stack trace information;

[0026] The test report is converted into a required file format according to the file format conversion technology.

[0027] Preferably, constructing a test task to test the test case when a new test script is detected next time includes:

[0028] When a new test script is submitted to the code repository, submission information is received through Webhooks;

[0029] Trigger a new build task in Jenkins and execute automated tests based on the new test script;

[0030] After the test is completed, set the notification method and recipient, and send the test results to the recipient according to the message queue and notification service.

[0031] A browser automation testing system, the browser automation testing system is applied to the browser automation testing method as described above, the browser automation testing system comprises:

[0032] A test case management module, used to create test cases according to templates and wizards, wherein the test cases include test steps, expected results and test data;

[0033] A test script development module, used for writing test scripts associated with a plurality of the test cases based on a preset programming language;

[0034] A test execution module is used to select a browser and an operating system, and execute a test script on the browser and the operating system, wherein the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology;

[0035] An automated testing integration module that configures a CI / CD pipeline in Jenkins and sets up webhooks to build a test task to test the test case the next time a new test script is detected.

[0036] A terminal device comprises: a memory, a processor and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the above-mentioned browser automation testing method.

[0037] A storage medium stores a browser automation testing program, which implements the steps of the above-mentioned browser automation testing method when executed by a processor.

[0038] One of the above technical solutions has the following advantages or beneficial effects:

[0039] The present invention uses templates and wizards to create test cases, which can ensure the standardization, consistency and repeatability of test steps, reduce human errors, and improve team collaboration efficiency; secondly, the automated test script written based on the preset programming language can simulate user behavior, quickly execute test tasks, and has good scalability, and can cope with complex application scenarios. Interacting with the browser through the WebDriver protocol helps to ensure cross-browser and cross-operating system compatibility, and with the help of containerization and virtualization technology, further ensures the consistency and repeatability of the test environment; combined with Jenkins and CI / CD tools, automated testing is seamlessly connected with continuous integration and continuous delivery processes, ensuring that each code submission can trigger automated testing, timely feedback problems and ensure software quality; through automated and standardized processes, it helps to significantly reduce manual operations, improve test coverage, reduce test omissions and deployment risks, and accelerate development and testing cycles. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0041] Figure 1 is a flow chart of a browser automation testing method provided by an embodiment of the present invention;

[0042] Figure 2 It is a structural diagram of a browser automation testing system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0044] In the present invention, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0045] With the continuous development and increasing complexity of Web applications, manual testing can no longer meet the needs of modern software development for efficient, fast and high-quality delivery. Automated testing is widely used in the software development process, especially in the testing of Web applications. Automated testing can significantly improve test coverage and execution efficiency, reduce human errors, and ensure code quality and stability.

[0046] In modern software development, the tasks and environments that automated testing needs to handle are becoming increasingly complex. Existing browser automated testing technology still has some defects. First, cross-browser and cross-operating system compatibility issues are still prominent, and test results may be inconsistent due to environmental differences; second, test case management is inconvenient and lacks a flexible dynamic update mechanism, resulting in high maintenance costs; the writing and maintenance of automated scripts also requires a high technical threshold, and non-developers often find it difficult to participate, which increases the burden on the team.

[0047] Therefore, a browser automation testing method is proposed, such as Figure 1 As shown, in a preferred embodiment of the present invention, the browser automation testing method comprises the steps of:

[0048] S1: Create a test case according to the template and wizard, wherein the test case includes test steps, expected results and test data;

[0049] In automated testing, creating standardized and clear test cases is a crucial step. The role of templates and wizards is to provide a standardized framework to ensure the consistency and repeatability of test cases. Templates help testers clarify the structure of test steps through predefined formats, including test objects, input data, expected outputs, and execution order, while wizards guide users to fill in these fields step by step to ensure that no detail is missed. In this way, team members, regardless of their experience, can follow unified standards to create high-quality test cases and avoid missing test steps or misunderstandings. The combination of templates and wizards can not only improve the efficiency of test case generation, but also greatly reduce human errors, especially when the team is large or the development progress is fast, to ensure an efficient and stable testing process.

[0050] S2: writing a test script associated with a plurality of the test cases based on a preset programming language;

[0051] The syntax of programming languages ​​and automation tools are used to convert them into instructions that can be executed by computers. The selected programming language needs to be compatible with the automation framework and easy to maintain. Common programming languages ​​such as Python, Java, JavaScript, etc. have powerful library and framework support (such as Selenium, Playwright, Cypress, etc.) and can interact with browsers. When writing test scripts, testers convert the operation steps in the use case into specific instructions, such as opening a web page, clicking a button, entering data, etc. These instructions will interact with the browser or Web application through the WebDriver protocol, simulate user behavior, and verify whether the application meets the expected functional requirements. The choice of programming language often depends on the team's technology stack, the complexity of the requirements, and the scalability of the test script. Through the execution of automated scripts, the test efficiency can be effectively improved and the workload of manual execution can be reduced.

[0052] S3: Select a browser and an operating system, and execute a test script on the browser and the operating system, wherein the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology;

[0053] After the test cases and scripts are written, you need to select specific browsers and operating systems for testing to ensure that the application performs consistently in different environments. Modern Web applications need to run in multiple browsers and operating system environments, and different operating systems and browsers have different ways of rendering pages, executing JavaScript, or processing HTML. Therefore, cross-platform and cross-browser automated testing is particularly important. In this process, the test script communicates with the browser through the WebDriver protocol to simulate user behavior (such as clicking, input, scrolling, etc.). The WebDriver protocol is a standard interface for Web automation, which enables the test script to interact with the browser independently of the browser's specific implementation. For example, through WebDriver, the script can execute the same test steps in different browsers (such as Chrome, Firefox, Safari) to ensure multi-browser compatibility. Containerization technology (such as Docker) and virtualization technology (such as virtual machines) allow tests to be run in an isolated manner in different operating system environments to ensure consistency of testing on different platforms. The benefit of containerization technology lies in the consistency and repeatability of the environment, while virtualization technology provides more operating system configuration options and can simulate real user environments. Virtualization technology can run different operating system environments (such as Windows, Linux, macOS) by simulating multiple operating systems on a single physical host.

[0054] S4: Configure the CI / CD pipeline in Jenkins and set up webhooks to build a test task to test the test case the next time a new test script is detected.

[0055] CI / CD (Continuous Integration / Continuous Delivery) is a software development practice that aims to improve the efficiency of development, testing, and deployment through automated processes. Configuring CI / CD pipelines in Jenkins can integrate automated testing into the development cycle to ensure that each code submission goes through automated build, test, and verification steps. As a continuous integration tool, Jenkins automatically triggers build and test tasks when the code changes by configuring different jobs. Webhooks is a bridge between Jenkins and code hosting platforms (such as GitHub and GitLab). When a code repository detects a new code submission, pull request, or merge, it automatically notifies Jenkins through Webhooks to trigger a build task, which means that each submitted code will immediately execute automated tests to ensure code quality and functional stability. By automating the build, test, and deployment process, the CI / CD pipeline helps teams identify problems faster, reduce manual operations, increase release frequency, and reduce potential deployment risks.

[0056] The present invention uses templates and wizards to create test cases, which can ensure the standardization, consistency and repeatability of test steps, reduce human errors, and improve team collaboration efficiency; secondly, the automated test script written based on the preset programming language can simulate user behavior, quickly execute test tasks, and has good scalability, and can cope with complex application scenarios. Interacting with the browser through the WebDriver protocol helps to ensure cross-browser and cross-operating system compatibility, and with the help of containerization and virtualization technology, further ensures the consistency and repeatability of the test environment; combined with Jenkins and CI / CD tools, automated testing is seamlessly connected with continuous integration and continuous delivery processes, ensuring that each code submission can trigger automated testing, timely feedback problems and ensure software quality; through automated and standardized processes, it helps to significantly reduce manual operations, improve test coverage, reduce test omissions and deployment risks, and accelerate development and testing cycles.

[0057] Preferably, it also includes editing test cases;

[0058] The editing test cases include:

[0059] Get the created test cases in the storage space;

[0060] Based on the created test cases and test requirements, obtain the processing logic missing from the created test cases;

[0061] Add the required test steps and expected results to the created test case, and store the new test case and the corresponding version number in the storage space.

[0062] Specifically, in the test case of the shopping website, the test case requested to be edited by the user is obtained from the storage through a database query operation. This process involves the backend reading the corresponding records from the database, usually by using SQL query statements (such as SELECT) to find all relevant data of the target test case. The data obtained by the backend usually includes various fields of the test case, such as test steps, expected results, test data, creation date, version number, etc. In this step, the backend can also return other relevant information as needed, such as the current test case version, to help users understand the latest status of the test case.

[0063] After obtaining the test cases, they are modified according to the new test requirements or the missing logic in the existing test cases. At this time, it is necessary to compare the existing test case content with the new test requirements to identify the possible missing parts in the test cases. For example, if the new requirement requires testing a specific boundary condition, and the original test case does not cover this scenario, or the user reviews the existing test cases and finds that the test cases do not cover the scenario of insufficient product inventory, this process requires intelligent analysis, such as rule-based inspection, comparison with historical test cases, or comparison of version numbers. In this way, the missing processing logic in the existing test cases (such as missing boundary value tests, abnormal situation handling, etc.) can be discovered, and guidance can be provided for subsequent modifications.

[0064] After identifying the missing logic in the test case, the user can edit the test case on the front-end interface or tool, adding necessary test steps and expected results to it, which may include adding new test steps, supplementing expected results, adjusting test data, etc., to ensure that the test case can cover the new test requirements. After the modification is completed, the updated test case is saved to the storage space. When saving, a new version number is generated for each modification to track and manage different versions of the test case. Version control ensures that the history of each modification can be traced, and users can view and roll back to the previous version at any time. When the database is updated, the transaction processing mechanism is used to ensure the integrity and consistency of the data. In addition, other metadata, such as the modifier, modification time, etc., can be recorded at the same time for future auditing and management. In this way, the update of the test case not only meets the new test requirements, but also retains version control and historical records to ensure the traceability and accuracy of the test process. For example, the initial version is 1.0. After the user's first modification, the version number will become 1.1, and after the second modification, it may become 1.2, and so on. In addition, to prevent data conflicts caused by concurrent editing, an optimistic locking mechanism can be introduced. Under the optimistic locking mechanism, the version number of the current record will be checked for each edit. If the record has been modified by other users during the user editing process, the user will be prompted that the data is outdated and needs to be reloaded.

[0065] Preferably, it also includes deleting the test case;

[0066] The deletion test case includes:

[0067] Get the version number of the selected browser, and compare the configuration of the browser under the current version number with the current test case;

[0068] If the current test case is not applicable to the configuration of the browser under the current version number, the current test case will be soft deleted.

[0069] The browser version number is one of the key factors in determining whether a test case is applicable, because as the browser is updated, many functions and configurations will change. The browser may introduce new features, fix old bugs, or no longer support some old functions. Therefore, the effectiveness of the test case is closely related to the browser version to which it is applicable.

[0070] Based on the obtained browser version number, query the configuration features of the version, which may include the browser's support for different standards, the enabled status of features, and even the differences in API and page rendering mechanisms. Therefore, it is necessary to compare the configuration under the current version number with the content of the test case to confirm whether the test case is still applicable to the current version of the browser.

[0071] During the comparison process, if it is found that the current test case is no longer applicable to the current version configuration of the browser, the soft deletion mechanism will be triggered next. Soft deletion means marking the test case as "deleted" or "unavailable" instead of completely deleting it from the database. Soft deletion is to avoid accidentally deleting important data or historical data that is not processed in time. In actual operation, soft deletion will update the status field of the test case (such as "is_deleted", "status") to "deleted" or "not applicable", but will not immediately remove the record from the database. In this way, although the test case is no longer valid, it will still remain in the database and can be restored when needed in the future.

[0072] The benefit of soft deletion is that it can prevent the complete deletion of important data records and avoid irreversible data loss due to operational errors. At the same time, developers or administrators can perform data backtracking at a later time, view test cases of historical versions, or perform other management operations.

[0073] Preferably, writing a test script associated with a plurality of the test cases based on a preset programming language comprises:

[0074] Select a programming language, and select a code editor and an integrated development environment corresponding to the programming language, wherein the code editor is used to provide syntax highlighting and code completion functions;

[0075] Based on the code editor and integrated development environment, write test scripts using the API provided by the automated testing framework;

[0076] Save the completed test script to the version control system.

[0077] In the development process of automated testing, choosing a suitable programming language is very critical. It determines the writing method and running environment of subsequent test scripts. The programming language not only needs to meet the needs of the project, but also should be determined according to the team's technology stack and the familiarity of the developers. For example, Python, JavaScript, Java, etc. are common automated test script languages. After that, the developer will choose a code editor and integrated development environment (IDE) that is compatible with the selected programming language. The IDE not only provides a centralized working platform, but also integrates multiple functions such as code editor, debugger, and build tools. In this platform, the code editor is responsible for providing developers with syntax highlighting and code completion functions. Syntax highlighting can help developers distinguish different types of code elements, such as variables, functions, keywords, etc., thereby improving code readability. Code completion reduces developer input errors or omissions by prompting available functions, methods, variables, etc., and enhances development efficiency. In addition, the code editor will also have built-in error checking and automatic repair tools, which can immediately feedback potential code problems during the development process, further improving the quality and speed of programming.

[0078] After selecting a programming language and development environment, users can use the API provided by the automated testing framework to write test scripts. The testing framework usually encapsulates some commonly used functions for developers, allowing them to focus on the design and implementation of test scenarios. Take Playwright as an example. It provides a set of APIs that interact with browsers. These APIs allow developers to automate browser operations, such as opening web pages, clicking buttons, entering text, etc., to simulate user interaction with web pages. Using these APIs, developers can write complete test scripts to verify whether the application functions as expected. These frameworks can use object-oriented or functional programming methods to provide reusable modules to help developers write and maintain automated testing code faster. Through the code completion function in the integrated development environment (IDE), developers can quickly view the definition and parameters of the API to avoid common programming errors. In addition, the testing framework will also provide functions such as logging, assertion mechanism, and result reporting to help developers better debug and analyze problems in the testing process.

[0079] After the automated test script is written, saving it to the version control system is a very important step, especially in a multi-person collaborative development environment. The version control system enables developers to effectively manage the historical versions of the code by tracking each modification record, ensuring the consistency and traceability of the code in different development cycles. Whenever a developer modifies the test script, taking Git as an example, these changes can be saved through the Git commit operation and a unique commit record can be generated. These records contain specific modification content and timestamps. If multiple developers modify the script at the same time, Git will provide a conflict resolution mechanism to ensure the correctness of the final version. Through the push operation, the modified code can be synchronized to the remote repository so that team members can access the latest test script. In the version control system, developers can view and trace back historical versions, perform branch management, merge and other operations to ensure that each modification is recorded to avoid code loss or accidental modification. At the same time, version control also provides a clear workflow for team collaboration, helps developers coordinate development progress, and provides support for continuous integration (CI) and continuous delivery (CD) of automated test scripts.

[0080] Preferably, selecting a browser includes setting startup parameters of the browser.

[0081] When performing automated testing or browser configuration, users not only need to choose which browser to use (such as Chrome, Firefox, Edge, etc.), but also need to specify the browser startup mode and behavior according to the test requirements. The browser startup parameters refer to the command line options attached when starting the browser. These options can control various behaviors of the browser, such as whether to enable headless mode (i.e. running in the background without displaying the interface), set the window size, disable GPU acceleration, specify the user data directory, etc. By setting these startup parameters, users can customize the browser startup environment to ensure that it meets specific test scenarios or performance requirements. In automated testing, these parameters are usually passed to the browser through WebDriver (such as Selenium) or other browser automation tools, thereby affecting the browser startup and operation mode. Therefore, setting the startup parameters while selecting the browser is an important step to ensure that the test environment accurately meets the requirements.

[0082] Preferably, after executing the test script on the browser and the operating system, the following steps are included:

[0083] Collect the execution results of each test case and generate a test report, where the execution results of the failed test cases include the failure reasons and stack trace information;

[0084] The test report is converted into a required file format according to the file format conversion technology.

[0085] When executing automated test scripts, test cases are executed one by one and the execution results of each case are collected. The execution results of each test case can include its success or failure status (such as pass, fail, skip), as well as more execution details. Test frameworks (such as JUnit, TestNG, Selenium, etc.) will record the output of each test case during execution, including standard output, error information, and logs. If a test fails, the specific cause of failure will be captured, which is usually caused by assertion failure, exception throwing, or script execution error. After the test fails, not only the cause of failure is recorded, but also the stack trace information is captured. These stack traces describe in detail the location where the error occurred, including the line number of the code, the function call stack, and the specific type of error. Stack traces are crucial for developers because they help them quickly locate the root cause of the problem. By recording the execution of each test case in detail, a test report is generated. The report lists the status, execution time, log information of each test case, and if a failure occurs, the failure reason and stack trace are attached.

[0086] When the test is completed and the report is generated, the report needs to be converted into one or more formats so that users can view and archive it according to their needs. Common file formats include PDF, Excel (XLSX) and HTML. These formats have different advantages depending on different application scenarios. The process of file format conversion needs to rely on some technologies and tools. For example, when converting HTML reports to PDF, rendering engines (such as Puppeteer) are usually used. These tools will parse HTML and CSS code to ensure that the report retains the original style and layout in the final generated PDF file. The PDF format has a fixed page layout for printing and formally sharing reports, which can maintain consistent presentation effects on different platforms. For the Excel format, the data in the test report (such as use case name, execution results, timestamps, etc.) will be extracted and organized in a table format. Libraries such as ApachePOI or xlsx are used to write the data to the Excel file for further data analysis and screening. The Excel format is also suitable for further processing, chart display or combination with other data when the data volume is large. Through these file format conversion technologies, the content of the test report can not only retain its original structure, but also flexibly adapt to the different needs of users.

[0087] Preferably, constructing a test task to test the test case when a new test script is detected next time includes:

[0088] When a new test script is submitted to the code repository, submission information is received through Webhooks;

[0089] Trigger a new build task in Jenkins and execute automated tests based on the new test script;

[0090] After the test is completed, set the notification method and recipient, and send the test results to the recipient according to the message queue and notification service.

[0091] When a developer submits a new test script in a code repository (such as GitHub, GitLab, or Bitbucket), the version control system triggers a Webhooks event. Webhooks is an HTTP callback mechanism that allows external systems (Jenkins in this case) to receive event notifications in the code repository. For example, when a user submits a new test script to the code repository, the code repository sends a POST request to a specific URL of Jenkins. This request contains detailed information about the submission (such as the submitter, submission time, submission content, etc.). Jenkins listens to these requests through the configured Webhooks. Once a new submission is detected, it will receive and parse the submission information to determine whether it is a newly submitted test script or a change containing test-related content. Webhooks ensure that CI / CD tools (such as Jenkins) can receive the latest submissions in the code repository in real time and trigger subsequent build and test processes.

[0092] Once Jenkins receives the Webhooks event and parses it into a new test script submission, it will automatically trigger a new build task according to the pre-configured pipeline. The build task is composed of Jenkins' preset automated processes, including pulling the latest content in the code repository, compiling code, installing dependencies, executing tests, and other steps. During this process, Jenkins will execute automated tests based on the location and content of the new test scripts. These test scripts are written under a specific test framework (such as JUnit, TestNG, PyTest, etc.). Jenkins will call the corresponding commands to run these tests and feed back the execution results to the Jenkins console output. If the test script contains specific configurations or dependencies, Jenkins can also select the appropriate execution environment according to different environment settings (such as development environment, test environment, etc.) to ensure that the test is performed in the expected environment, thereby ensuring the accuracy and reliability of the test.

[0093] After the test task is executed, Jenkins will automatically send a notification of the test results according to the user's notification settings. The notification settings can be customized through the Jenkins configuration interface. Users can choose to use email notifications, Slack message push, SMS, etc. to receive test results. Jenkins implements this function by integrating message queues (such as RabbitMQ, Kafka) or directly calling external notification services (such as SMTP mail servers or Slack API). Assuming that the test fails, Jenkins will automatically send detailed information about the failure to the relevant team members or responsible persons through email or instant messaging services. Email notifications can be sent through the SMTP protocol, including specific error information and stack traces of the test; Slack notifications push messages to the specified chat channel through the API interface. For high-frequency notifications, Jenkins can also use message queues to manage notification tasks to ensure that notifications can be sent in a timely and orderly manner even in high concurrency situations. Users can set the personnel who receive notifications and the conditions for notifications in Jenkins (for example, only notify when the test fails) to ensure that the right people receive key information in a timely manner, so as to respond quickly and solve problems.

[0094] A browser automation testing system, the browser automation testing system is applied to the browser automation testing method as described above, such as Figure 2 As shown, the browser automation testing system includes:

[0095] A test case management module 1 is used to create a test case according to a template and a wizard, wherein the test case includes test steps, expected results and test data;

[0096] A test script development module 2, used for writing test scripts associated with a plurality of the test cases based on a preset programming language;

[0097] A test execution module 3 is used to select a browser and an operating system, and execute a test script on the browser and the operating system, wherein the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology;

[0098] Automation Testing Integration Module 4 is used to configure the CI / CD pipeline in Jenkins and set up webhooks to build a test task to test the test case the next time a new test script is detected.

[0099] This embodiment implements a browser automation testing method and implementation process. Please refer to the above embodiments and will not be described in detail here.

[0100] In addition, an embodiment of the present invention further proposes a terminal device, which includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the browser automation testing method as described above.

[0101] Since the program is configured to implement the steps of the browser automation testing method as described above, the program at least has all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.

[0102] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which a browser automation testing program is stored. When the browser automation testing program is executed by a processor, the steps of the browser automation testing method described above are implemented.

[0103] Since the browser automation testing program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.

[0104] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0105] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A browser automation testing method, characterized in that: The browser automation testing method comprises: Create a test case according to the template and wizard, wherein the test case includes test steps, expected results and test data; Writing test scripts associated with the plurality of test cases based on a preset programming language; Select a browser and an operating system, execute a test script on the browser and the operating system, the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology; Configure the CI / CD pipeline in Jenkins and set up webhooks to build a test task to test the test case the next time a new test script is detected.

2. The browser automation testing method according to claim 1, characterized in that: It also includes editing test cases; The editing test cases include: Get the created test cases in the storage space; Based on the created test cases and test requirements, obtain the processing logic missing from the created test cases; Add the required test steps and expected results to the created test case, and store the new test case and the corresponding version number in the storage space.

3. The browser automation testing method according to claim 1, characterized in that: It also includes deleting test cases; The deletion test case includes: Get the version number of the selected browser, and compare the configuration of the browser under the current version number with the current test case; If the current test case is not applicable to the configuration of the browser under the current version number, the current test case will be soft deleted.

4. The browser automation testing method according to claim 1, characterized in that: Writing a test script associated with a plurality of the test cases based on a preset programming language includes: Select a programming language, and select a code editor and an integrated development environment corresponding to the programming language, wherein the code editor is used to provide syntax highlighting and code completion functions; Based on the code editor and integrated development environment, write test scripts using the API provided by the automated testing framework; Save the completed test script to the version control system.

5. The browser automation testing method according to claim 1, characterized in that: Selecting a browser includes setting the browser's startup parameters.

6. The browser automation testing method according to claim 1, characterized in that: After executing the test script on the mentioned browser and operating system it includes: Collect the execution results of each test case and generate a test report, where the execution results of the failed test cases include the failure reasons and stack trace information; The test report is converted into a required file format according to the file format conversion technology.

7. The browser automation testing method according to claim 1, characterized in that: Building a test task to test the test case the next time a new test script is detected includes: When a new test script is submitted to the code repository, submission information is received through Webhooks; Trigger a new build task in Jenkins and execute automated tests based on the new test script; After the test is completed, set the notification method and recipient, and send the test results to the recipient according to the message queue and notification service.

8. A browser automation testing system, the browser automation testing system being applied to the browser automation testing method according to any one of claims 1 to 7, characterized in that: The browser automation testing system comprises: A test case management module, used to create test cases according to templates and wizards, wherein the test cases include test steps, expected results and test data; A test script development module, used for writing test scripts associated with a plurality of the test cases based on a preset programming language; A test execution module is used to select a browser and an operating system, and execute a test script on the browser and the operating system, wherein the test script communicates with the browser through a WebDriver protocol, and the operating system is compatible with the test script through containerization technology and virtualization technology; An automated testing integration module that configures a CI / CD pipeline in Jenkins and sets up webhooks to build a test task to test the test case the next time a new test script is detected.

9. A terminal device, characterized in that: The terminal device comprises: a memory, a processor, and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the browser automation testing method described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a browser automation testing program, and when the browser automation testing program is executed by the processor, the steps of the browser automation testing method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Distributed WEB automated test system and method

    CN108519952A

  • Test method and device of end-to-end system, computer equipment and storage medium

    CN114185786A

  • Switchable environments for test cases

    US20180300223A1

Cited By

  • Automatic flow monitoring system based on playwright framework

    CN120434145A