Test method and device for automatically checking BMC information and storage medium
Log in to the BMC page through automation tools, take screenshots and use Tesseract-OCR for text recognition, and verify page data in combination with verification rules, solving the problem of garbled information in traditional testing methods, improving the reliability and operation and maintenance efficiency of the test.
Patent Information
- Application Number
- CN202510322464.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional automated testing methods are difficult to effectively prevent the problem of garbled information on web pages, which affects the user experience and may lead to misreading and misoperation of key information, bringing potential risks of data center operation and maintenance.
Log in to the BMC login page through automated tools, obtain screenshots of user pages, and use Tesseract-OCR for text recognition, and verify the page data in combination with pre-set verification rules to ensure the accuracy and reliability of information.
It effectively avoids information omissions or misreading, enhances the reliability and stability of testing, reduces the risks caused by garbled information, and improves the operation and maintenance efficiency and security of the data center.
Smart Images

Figure CN119847845A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer testing, and in particular to a testing method, device and storage medium for automatically verifying BMC information. Background Art
[0002] In today's digital age, server management systems such as OpenBMC have become a key component of data center operations and maintenance. These systems provide detailed management information and convenient operation interfaces to operation and maintenance personnel through web pages, allowing operation and maintenance personnel to remotely monitor and control server hardware. With the acceleration of digital transformation and the continuous expansion of data center scale, the stability and reliability of server management systems are particularly important.
[0003] In order to ensure the stability and reliability of OpenBMC and other pages, traditional automated testing methods are widely used. Traditional automated testing methods mainly perform interface and performance testing based on Web interfaces, and verify whether the response and functions of Web pages meet expectations by simulating user operations.
[0004] However, with the continuous development of Web technology and the increasing complexity of application environments, traditional automated testing methods have gradually exposed some problems. When testing, it is difficult to effectively prevent garbled information from appearing on Web pages. This garbled problem not only affects the user experience, but may also lead to misreading and misoperation of key information, thus bringing potential risks to the operation and maintenance of data centers. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a test method, device and storage medium for automatically verifying BMC information.
[0006] The technical solution provided in this application is described below: The first aspect of the present application provides a test method for automatically verifying BMC information, the method comprising: Use an automated tool to log in to the BMC login page based on the configuration file data to obtain the BMC user page; Processing the BMC user page to obtain a user page screenshot; Calling Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data; Determining whether the page data complies with a preset verification rule; If yes, then execute the next BMC test.
[0007] Optionally, the step of using an automated tool to log in to a BMC login page according to the configuration file data to obtain a BMC user page includes: Read the configuration file to obtain BMC login data and ChromeDriver data; Creating a browser driver instance based on the automation tool, the ChromeDriver data, and the target Chrome options; Use the browser driver instance to access the BMC login page; The BMC login data is input into the login page to obtain a BMC user page.
[0008] Optionally, before creating a browser driver instance according to the automation tool, the ChromeDriver data, and the target Chrome options, the method further includes: Create Chrome options; Create a user data directory using a temporary file repository; The user data directory and the launch parameters are input into the Chrome options to obtain the target Chrome options.
[0009] Optionally, calling Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data includes: Acquire a cropping area according to the user page screenshot and preset position data; Tesseract-OCR is called to perform text recognition on the cropped area to obtain page data.
[0010] Optionally, calling Tesseract-OCR to perform text recognition on the cropped area to obtain page data includes: Use the pytesseract library to call Tesseract-OCR to perform text recognition on the cropped area to obtain text content; The text content is preprocessed to obtain page data.
[0011] Optionally, the determining whether the page data complies with a preset verification rule includes: Traverse the page data to obtain field types and corresponding field values; Select a target validation rule from the preset validation rules according to the field type; Determine whether the field value corresponding to the field type conforms to the target verification rule.
[0012] Optionally, after determining whether the page data meets a preset verification rule, the method further includes: If not, then recording the difference data in the page data; The difference data is submitted to manual re-inspection and the next BMC test is performed.
[0013] A second aspect of the present application provides a test device for automatically verifying BMC information, the device comprising: A login unit, used to log in to the BMC login page using an automated tool according to configuration file data to obtain a BMC user page; A processing unit, used for processing the BMC user page to obtain a user page screenshot; A recognition unit, configured to call Tesseract-OCR to perform text recognition on the user page screenshot according to preset location data to obtain page data; A judging unit, used to judge whether the page data conforms to a preset verification rule; The first execution unit is used to execute the next BMC test when the judgment unit determines that the page data meets the preset verification rule.
[0014] A third aspect of the present application provides a test device for automatically verifying BMC information, the device comprising: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the first aspect and any optional test method for automatically verifying BMC information in the first aspect.
[0015] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional test method for automatically verifying BMC information in the first aspect.
[0016] It can be seen from the above technical solutions that this application has the following advantages: This application effectively avoids possible information omissions or misinterpretations in traditional testing methods by taking a screenshot of the BMC login page and cropping the key information area in combination with the preset location data. Then, combined with Tesseract-OCR for text recognition, it can accurately capture and identify page data, enhancing the reliability and stability of the test. Furthermore, the recognition results are verified through preset verification rules to ensure the accuracy of the page information, effectively reduce the potential risks caused by garbled information, and improve the operation and maintenance efficiency and security of the data center. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flow chart of an embodiment of a test method for automatically verifying BMC information provided by the present application; Figure 2 A flowchart of another embodiment of the test method for automatically verifying BMC information provided by the present application; Figure 3 A flowchart of another embodiment of the test method for automatically verifying BMC information provided by the present application; Figure 4 A flowchart of another embodiment of the test method for automatically verifying BMC information provided by the present application; Figure 5 A flowchart of another embodiment of the test method for automatically verifying BMC information provided by the present application; Figure 6 A schematic diagram of the structure of an embodiment of a test device for automatically verifying BMC information provided by the present application; Figure 7 This is a schematic diagram of the structure of another embodiment of the test device for automatically verifying BMC information provided by the present application. DETAILED DESCRIPTION
[0019] The present application provides a test method, device and storage medium for automatically verifying BMC information, which are used to solve the problem that traditional interface testing cannot prevent garbled information from appearing on the web.
[0020] It should be noted that the test method for automatically verifying BMC information provided in this application can be applied to terminals or servers. For example, the terminal can be a smart phone or computer, tablet computer, smart TV, smart watch, portable computer terminal or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses the terminal as the execution subject for example.
[0021] See also Figure 1 , Figure 1 An embodiment of a test method for automatically verifying BMC information provided by the present application includes: S101, using an automated tool to log in to the BMC login page according to the configuration file data to obtain a BMC user page; BMC refers to baseboard management controller, which is a dedicated controller mainly used to monitor and manage servers. It is usually contained in the motherboard of the server or the main circuit board of the monitored device, and is part of the intelligent platform control interface. The automation tool Selenium is an open source automation framework for Web application testing. It can simulate various operations of users in the browser, such as clicking, inputting, navigating, etc., and supports multiple programming languages. In this solution, Selenium is mainly used to realize the operation of automating the login to the BMC login page.
[0022] In this embodiment, before logging into the BMC login page, first set the yaml configuration information, including filling in the full path of the ChromeDriver executable file, determining the URL path of the BMC login page, and adding the corresponding device login information for each tested BMC device, including the user name, password, and IP address. Next, configure the Selenium environment, including adding the Python installation path to the system environment variable after completing the Python installation in the system, using the pipinstall selenium command to install the Selenium tool, downloading the ChromeDriver corresponding to the Chrome browser version, and placing the ChromeDriver in the root directory of the Chrome browser installation. Then, read the configuration file with the help of Python's yaml library, parse the file content into a Python dictionary, and obtain the BMC login data from it, including the user name, password, and IP address of multiple BMC devices, and ChromeDriver data, that is, the ChromeDriver executable file path. Subsequently, use the Selenium tool to call the setup_chrome_options function to configure Chrome options, such as disabling SSL certificate checking, specifying a unique user data directory, etc., create a service object based on the ChromeDriver data, and create a browser driver instance in combination with the configured target Chrome options. Furthermore, using the created browser driver instance, for each BMC device, the complete BMC login page address is spliced out through its IP address and the login URL in the configuration file and accessed. Further, an explicit wait mechanism is used to ensure that the username input box, password input box and login button of the login page are loaded. Finally, the JavaScript code is executed to hide the possible interference elements in the page, and the username and password of the BMC device in the configuration file are respectively entered into the corresponding input boxes of the BMC login page, and the login button is automatically clicked to complete the login operation, and the BMC user page can be obtained.
[0023] S102, processing the BMC user page to obtain a user page screenshot; In this embodiment, after entering the BCM user page, since the page information may be loaded asynchronously, the system uses time.sleep(8) to wait for 8 seconds to ensure that all the information on the page is loaded completely. Subsequently, the os library is used to check whether the directory where the screenshots are saved exists. If the directory does not exist, os.makedirs is called to create the directory. Next, in order to distinguish the screenshots of different BMC devices, a unique screenshot file name is generated according to the IP address of the BMC device. Finally, the browser driver instance is used to save the current BMC user page screenshot to the specified directory. The save path is composed of the previously created directory and the generated file name, and the logging library is used to record the path information of the screenshot save, so that the screenshot location can be quickly located during subsequent viewing and debugging.
[0024] S103, calling Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data; Tesserac is an open source optical character recognition engine that can recognize text in multiple languages. It is widely used in document processing, digital libraries, mobile applications and other fields. It is one of the important tools in the field of computer vision and natural language processing. OCR technology is a process of extracting text information from images through image recognition technology.
[0025] In this embodiment, before calling Tesseract-OCR, you first need to configure the Tesseract environment, including installing the Tesseract installation package, checking the Chinese and English language packs during installation, and adding the Tesseract installation path to the system variables. After the installation is complete, verify whether the language pack is installed successfully by executing the "tesseract --list-langs" command. If languages such as "chi_sim", "eng", and "osd" can be listed, it means that the installation is correct. Then use "pip installpytesseract" to install the pytesseract library and configure its path to complete the Tesseract environment configuration.
[0026] Next, define a list regions containing multiple cropping region coordinates, where each coordinate tuple accurately represents the location of a specific information area in the screenshot. Then, use the Image module of the PIL library to open the user page screenshot with the help of the Image.open(image_path) function, where image_path is the specific path of the screenshot file. Subsequently, the regions list is traversed. For each coordinate region in the list, use the image.crop(region) method to crop the opened image to obtain a small image containing specific information. Further, for each cropped small image, call the get_img_info function. Inside this function, the image_to_string method of the pytesseract library is used for text recognition. This method receives two parameters. The first parameter image is the image that needs to be recognized, and the second parameter lang='chi_sim+eng' is used to specify the recognized language as Simplified Chinese and English. By setting these parameters, the Tesseract-OCR engine will extract text information from the incoming image according to the set language, and return the recognized text content as a string, and finally obtain the text information. Finally, the extracted text information is subjected to unnecessary blank characters and line breaks, and the recognition result is subjected to preliminary format adjustment. The processed text information is then printed to obtain the page data.
[0027] S104, determining whether the page data complies with a preset verification rule; In this embodiment, before verification, it is necessary to construct corresponding verification functions according to different types of page data that may appear, such as product name, serial number, and asset tag. Next, taking the product serial number as an example, it is known that it consists of product model PR2715B, 8-digit date, and 2-digit batch. The regular expression ^PR2715B-\d{8}-\d{2}$ is constructed, where "^" and "$" respectively define the starting and ending positions of the matching string to ensure that the entire string strictly follows the set pattern; "PR2715B" specifies the fixed product model part; "\d{8}" means matching consecutive 8-digit numbers, which corresponds to the date part; "\d{2}" matches 2-digit numbers, representing the batch part.
[0028] When performing the verification operation, the system will go through the page data one by one. For each data, first determine its field type, and then call the corresponding verification function based on the type. For example, when encountering product name data, call the validate_name function, and when encountering product serial number data, call the validate_serial_number function. Inside the verification function, the field values corresponding to the field type will be compared using the verification rules. For verification functions involving regular expressions, the field values will be matched with the corresponding regular expressions. Then, if each field value can pass its corresponding verification logic, it means that the page data meets the verification rules, and execute step S105; if any field value in the page data does not meet its corresponding verification condition, that is, it does not meet the predefined verification rules, execute step S106.
[0029] S105, executing the next BMC test; In this embodiment, when it is determined that the page data meets the preset verification rules, the next BMC login information will be obtained from the configuration file data, and then the screenshot, text recognition and verification operations will be performed in sequence. Each cycle is a complete test process for a new BMC until all BMC login information in the configuration file data is traversed, realizing automatic batch testing of multiple BMC pages.
[0030] S106, recording the difference data in the page data; In this embodiment, when there is a situation in the page data that does not comply with the preset verification rules, the logging library is used for log recording. First, the basic parameters of the log record are configured through the logging.basicConfig method, including setting the log file name to validation_errors.log, setting the log level to logging.error to only record logs and log formats at and above the error level, and the format includes time, log level, and message content, etc. Then, when an exception is captured that the data does not comply with the verification rules, the field type in the difference data, such as product name, serial number, etc., the actual identified field value, and verification rules are stored in the log file by using the logging.error method, and the difference data can be recorded. The practice of recording difference data is helpful for subsequent problem analysis and finding possible BMC anomalies, identification errors, or configuration errors.
[0031] S107, submitting the difference data to manual re-inspection and executing the next BMC test.
[0032] In this embodiment, before submitting the recorded difference data to the manual review personnel, a detailed report file needs to be generated, which contains detailed information of the difference data, such as device IP, data type, actual value and expected value, etc. Then, the file containing the difference data is sent to the relevant personnel through email, instant messaging tools, etc. In addition to the above method of submitting for manual review, it can also be set according to the actual situation, which is not specifically limited here.
[0033] After submitting the difference data, the system will continue to perform the next BMC test, obtain the next BMC login information from the configuration file data, and then perform screenshots, text recognition, and verification operations in sequence. Each cycle is a complete test process for a new BMC until all BMC login information in the configuration file data is traversed, realizing automated batch testing of multiple BMC pages.
[0034] This embodiment effectively avoids possible information omission or misreading in traditional testing methods by taking a screenshot of the BMC login page and cropping the key information area in combination with the preset location data. Then, combined with Tesseract-OCR for text recognition, it can accurately capture and recognize page data, enhancing the reliability and stability of the test. Furthermore, the recognition results are verified by preset verification rules to ensure the accuracy of the page information, effectively reduce the potential risks caused by garbled information, and improve the operation and maintenance efficiency and security of the data center.
[0035] See also Figure 2 , Figure 2 Another embodiment of the test method for automatically verifying BMC information provided by the present application includes: S201, read the configuration file to obtain BMC login data and ChromeDriver data; ChromeDriver is a standalone executable file that acts as a bridge between the Chrome browser and the automated testing tool Selenium, allowing the automated tool Selenium to control the behavior of the Chrome browser.
[0036] In this embodiment, when reading the configuration file, the configuration file is opened using the utf-8 encoding format, and then the configuration file content in the file is parsed into a Python dictionary data structure using the yaml.safe_load method, and then the path of the ChromeDriver is obtained through the chromedriver_path key to clarify the storage location of the ChromeDriver in the system. Subsequently, the relative URL of the BMC login page is obtained using the login_url key, where it should be noted that the URL is a uniform resource locator, which is an address used to identify a resource on the Internet. Further, the bmcLists list of the dictionary data structure is located, and each item therein is traversed. From each BMC device information item, the corresponding IP address, user name and password are extracted respectively according to the keys of bmc_ip, username and password. Finally, the system organizes the obtained ChromeDriver path separately into ChromeDriver data, and organizes the IP addresses, user names and passwords of multiple BMC devices into BMC login data.
[0037] S202, creating a browser driver instance according to the automation tool, the ChromeDriver data, and the target Chrome options; The browser driver instance is an object created by combining the automation tool Selenium with ChromeDriver. This object has a series of methods that can be used to control the behavior of the Chrome browser, such as opening and closing the browser, accessing specific web pages, finding and manipulating page elements, etc. The target Chrome option is used to configure the parameters of the Chrome browser startup behavior according to specific test requirements.
[0038] In this embodiment, when creating a browser driver instance, the target Chrome options are set based on the acquired ChromeDriver data, that is, the specific path of the ChromeDriver. These options are the key to customizing the Chrome browser startup behavior. For example, adding the --ignore-certificate-errors option ignores SSL certificate errors, allowing the program to access some untrusted sites; adding the --user-data-dir option and specifying a temporary directory ensures that different test environments are independent of each other.
[0039] Next, in the automation tool Selenium, import the Service class from selenium.webdriver.chrome.service and the Options class from selenium.webdriver.chrome.options. Then, use the Service class to pass in the ChromeDriver path and create an Options object to integrate the target Chrome options. Then, call the webdriver.Chrome method and pass in the configured Service object and Options object as parameters. At this point, Selenium will use ChromeDriver to start the Chrome browser and configure it according to the set options. Finally, the browser driver instance is successfully created.
[0040] S203, using the browser driver instance to access the login page of the BMC; In this embodiment, when accessing the BMC login page, it is necessary to obtain the BMC IP address and the relative URL of the login page from the configuration file, and splice the two into a complete BMC login page URL. Then, the browser driver instance is used to access the spliced complete BMC login page URL to access the BMC login page. It should be noted that during the access process, the system will use the WebDriverWait class to set an explicit wait to ensure that subsequent operations are performed after the login page elements are loaded, so as to avoid operation failures caused by incomplete page loading.
[0041] S204: Input the BMC login data into the login page to obtain a BMC user page.
[0042] In this embodiment, when the BMC login data is input into the BMC login page, it is necessary to locate the user name input box, password input box and login button on the login page through the WebDriverWait class in combination with the method in the expected_conditions module, and then use the send_keys method to input the user name and password in the corresponding BMC login data into the corresponding input boxes, and automatically click the login button to complete the login operation, so as to obtain the BMC user page.
[0043] In this embodiment, by reading the configuration file, the BMC login data and ChromeDriver data are obtained, so that the automated tool can quickly and accurately complete the login operation based on the corresponding data, avoiding the errors that may occur in manual input. In addition, by using the browser driver instance created by the ChromeDriver data and the target Chrome options, it is possible to simulate real user behavior and effectively deal with various verification mechanisms of the BMC login page.
[0044] See also Figure 3 , Figure 3 Another embodiment of the test method for automatically verifying BMC information provided by the present application includes: S301. Create Chrome options; In this embodiment, when using the automation tool Selenium to operate the Chrome browser, first create a blank Chrome options object. It should be noted that Chrome options is a configuration collection that can customize the startup mode and behavior of the browser. It needs to be created with the help of the Options class in the selenium.webdriver.chrome.options module in the Selenium library. The Options class is like a configuration container, and various browser startup parameters can be added into it.
[0045] S302, using a temporary file library to create a user data directory; In this embodiment, the Chrome browser will store the user's personal data in the user data directory when it is running. In the scenario of automated testing, if multiple tests are running at the same time, or different tests require independent environments, it is necessary to create a separate user data directory for each test to avoid data interference. In Python, the user data directory can be created with the help of the tempfile temporary file library, using the mkdtemp() function, which will generate a unique directory under the system's temporary directory, which can be used as a temporary user data directory.
[0046] S303: Input the user data directory and startup parameters into the Chrome options to obtain target Chrome options.
[0047] The startup parameters are used to specify additional configurations when the Chrome browser is started. For example, --ignore-certificate-errors means ignoring SSL certificate errors, and --disable-gpu means disabling GPU acceleration. These parameters can be set according to specific test requirements and are not specifically limited here.
[0048] In this embodiment, when obtaining the target Chrome options, it is necessary to call the setup_chrome_options function to create a ChromeOptions object, which is used to receive various parameters to customize the browser startup behavior. In the process of receiving various parameters, the add_argument() method can be used to add the user data directory to this ChromeOptions object in the form of --user-data-dir=path, and startup parameters such as --ignore-certificate-errors can also be added. Special configurations can also be added with the help of the add_experimental_option() method. After these operations, the obtained ChromeOptions object is the target Chrome option with a specific configuration used to create a browser driver instance.
[0049] In this embodiment, by creating Chrome options to customize the browser startup behavior, the browser can ignore SSL certificate errors, ensure that specific sites can be accessed, and meet the access requirements for special network environments in automated testing. Use a temporary file library to create a user data directory to provide an independent data space for each test instance, avoid data interference between different tests, ensure the independence and stability of the test environment, and improve the accuracy of the test results. Enter the user data directory and startup parameters to obtain the target Chrome options. When creating a browser instance, the browser can be started according to specific requirements, laying a solid foundation for subsequent automated operations, such as accessing the BMC login page and simulating user interactions, and ensuring the smooth progress of the entire automation process.
[0050] See also Figure 4 , Figure 4 Another embodiment of the test method for automatically verifying BMC information provided by the present application includes: S401, obtaining a cropping area according to the user page screenshot and preset position data; In this embodiment, before obtaining the cropping area, it is necessary to determine the coordinate information for cropping the image based on the actual position of the target information in the user page screenshot, and express it in the form of a tuple, such as (x1, y1, x2, y2), where (x1, y1) represents the coordinates of the upper left corner of the cropping area, and (x2, y2) represents the coordinates of the lower right corner of the cropping area. Then, store these tuple coordinates in the regions list to obtain the location data regions list. Then use Python's PIL library to open the user page screenshot. Subsequently, traverse the regions list, and use the Image.crop() method to crop the corresponding area from the screenshot image for each location tuple coordinate. Among them, the Image.crop() method will return a new image object, that is, the image of the cropping area, based on the passed in coordinates.
[0051] S402, using the pytesseract library to call Tesseract-OCR to perform text recognition on the cropped area to obtain text content; In this embodiment, before calling Tesseract-OCR to perform text recognition on the cropped area, it is necessary to install the Tesseract-OCR engine and configure the pytesseract library. In the Python code, the pytesseract library is imported, and for each cropped area image, the pytesserac.image_to_string() function is called. The function passes the image as a parameter, calls the Tesseract-OCR engine internally to analyze the image, recognize the text therein, and return the recognized text content string.
[0052] S403: Preprocess the text content to obtain page data.
[0053] In this embodiment, when processing the text content, a series of cleaning operations need to be performed on the recognized text content. For example, the strip() method of the string is used to remove the blank characters before and after the text; the replace() method of the string is used to replace special characters, such as punctuation marks that are recognized incorrectly; and regular expressions are used to check and correct common recognition errors, such as confusion between numbers and letters. After these preprocessing steps, the text data that can be obtained is the page data.
[0054] In this embodiment, by locating the cropping area, the interference of background noise and other irrelevant information is avoided, making OCR recognition more accurate. In addition, the process has a high degree of automation, which can reduce the tediousness and errors of manual operations, especially when processing a large number of screenshots, which can save a lot of time and labor costs. Then, by preprocessing the recognized text content, useful page data can be further extracted, which facilitates subsequent data analysis and processing.
[0055] See also Figure 5 , Figure 5 Another embodiment of the test method for automatically verifying BMC information provided by the present application includes: S501, traverse the page data to obtain field types and corresponding field values; In this embodiment, the page data is usually composed of multiple data items, each of which contains two parts of information: field type and field value. When traversing the page data, these data items are accessed one by one in order. When accessing each data item, the system will first identify and extract the field type information, which is used for the selection of subsequent verification rules. Then, the system will continue to extract the corresponding field value from the current data item, and use the field value as the object of verification.
[0056] S502, selecting a target verification rule from the preset verification rules according to the field type; Verification rules are a collection of data that contains multiple types of field verification rules. They set corresponding verification standards and logic for different field types. For example, for the serial number field, the system will use a specific regular expression to verify whether its format meets the expectations; and for the power consumption field, the system will check whether its value is within the specified range.
[0057] In this embodiment, after obtaining the field type and field value, the system will select a target verification rule that matches it from the preset verification rules. When selecting a matching target verification rule, the system will perform accurate matching and screening to ensure that the selected verification rule fully corresponds to the field type.
[0058] S503: Determine whether the field value corresponding to the field type complies with the target verification rule.
[0059] In this embodiment, the field value is checked according to the selected target verification rule. The field value is substituted into the target verification rule to determine whether it meets the conditions set in the rule. For example, the verification rule for "serial number" is the format of "product model + date + batch". If the field value meets the format requirements, it is determined to meet the rule; if it does not meet the requirements, such as the format is wrong or contains illegal characters, it is determined to be inconsistent with the rule.
[0060] In this embodiment, the type and value of each field can be obtained by traversing the page data, providing a solid foundation for subsequent verification. Then, according to the field type, the system can automatically select a matching target verification rule, ensuring the pertinence and accuracy of the verification, and also reducing manual intervention and operating costs.
[0061] By strictly comparing field values with target verification rules, the system can quickly identify data that does not meet the requirements, thereby effectively avoiding data errors or anomalies. This mechanism not only improves the efficiency of data processing, but also greatly enhances the reliability and security of data.
[0062] See also Figure 6 , Figure 6 An embodiment of a test device for automatically verifying BMC information provided by the present application includes: A login unit 601 is used to log in to the BMC login page using an automated tool according to the configuration file data to obtain a BMC user page; The processing unit 602 is used to process the BMC user page to obtain a user page screenshot; The recognition unit 603 is used to call Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data; The judging unit 604 is used to judge whether the page data meets the preset verification rules; The first execution unit 605 is configured to execute the next BMC test when the judgment unit determines that the page data meets the preset verification rule.
[0063] Optionally, the login unit 601 is further used for: Read the configuration file to obtain BMC login data and ChromeDriver data; Creating a browser driver instance based on the automation tool, the ChromeDriver data, and the target Chrome options; Use the browser driver instance to access the BMC login page; The BMC login data is input into the login page to obtain a BMC user page.
[0064] Optionally, the method further includes a configuration unit 606, configured to: Create Chrome options; Create a user data directory using a temporary file repository; The user data directory and the launch parameters are input into the Chrome options to obtain the target Chrome options.
[0065] Optionally, the identification unit 603 is further configured to: Acquire a cropping area according to the user page screenshot and preset position data; Tesseract-OCR is called to perform text recognition on the cropped area to obtain page data.
[0066] Optionally, the identification unit 603 is further configured to: Use the pytesseract library to call Tesseract-OCR to perform text recognition on the cropped area to obtain text content; The text content is preprocessed to obtain page data.
[0067] Optionally, the determining unit 604 is further configured to: Traverse the page data to obtain field types and corresponding field values; Select a target validation rule from the preset validation rules according to the field type; Determine whether the field value corresponding to the field type conforms to the target verification rule.
[0068] Optionally, the method further includes a second execution unit 607, configured to: If not, then recording the difference data in the page data; The difference data is submitted to manual re-inspection and the next BMC test is performed.
[0069] See also Figure 7 , Figure 7 Another embodiment of the test device for automatically verifying BMC information provided by the present application includes: Processor 701, memory 702, input and output unit 703, bus 704; The processor 701 is connected to the memory 702, the input and output unit 703 and the bus 704; The memory 702 stores a program, and the processor 701 calls the program to execute any of the above methods.
[0070] The present application also relates to a computer-readable storage medium, on which a program is stored. When the program is run on a computer, the computer executes any of the above methods.
[0071] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0072] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0073] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0074] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0075] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc. Various media that can store program codes.
Claims
1. A test method for automatically verifying BMC information, characterized in that: The method comprises: Use an automated tool to log in to the BMC login page based on the configuration file data to obtain the BMC user page; Processing the BMC user page to obtain a user page screenshot; Calling Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data; Determining whether the page data complies with a preset verification rule; If yes, then execute the next BMC test.
2. The test method for automatically verifying BMC information according to claim 1, characterized in that: The method of using an automated tool to log in to the BMC login page according to the configuration file data to obtain the BMC user page includes: Read the configuration file to obtain BMC login data and ChromeDriver data; Creating a browser driver instance based on the automation tool, the ChromeDriver data, and the target Chrome options; Use the browser driver instance to access the BMC login page; The BMC login data is input into the login page to obtain a BMC user page.
3. The test method for automatically verifying BMC information according to claim 2, characterized in that: Before creating a browser driver instance according to the automation tool, the ChromeDriver data, and the target Chrome options, the method further includes: Create Chrome options; Create a user data directory using a temporary file repository; The user data directory and the launch parameters are input into the Chrome options to obtain the target Chrome options.
4. The test method for automatically verifying BMC information according to claim 1, characterized in that: The calling of Tesseract-OCR to perform text recognition on the user page screenshot according to the preset location data to obtain page data includes: Acquire a cropping area according to the user page screenshot and preset position data; Tesseract-OCR is called to perform text recognition on the cropped area to obtain page data.
5. The test method for automatically verifying BMC information according to claim 4, characterized in that: The calling of Tesseract-OCR to perform text recognition on the cropped area to obtain page data includes: Use the pytesseract library to call Tesseract-OCR to perform text recognition on the cropped area to obtain text content; The text content is preprocessed to obtain page data.
6. The test method for automatically verifying BMC information according to claim 1, characterized in that: The determining whether the page data complies with a preset verification rule includes: Traverse the page data to obtain field types and corresponding field values; Select a target validation rule from the preset validation rules according to the field type; Determine whether the field value corresponding to the field type conforms to the target verification rule.
7. The test method for automatically verifying BMC information according to claim 1, characterized in that: After determining whether the page data meets the preset verification rule, the method further includes: If not, then recording the difference data in the page data; The difference data is submitted to manual re-inspection and the next BMC test is performed.
8. A test device for automatically verifying BMC information, characterized in that: The device comprises: A login unit, used to log in to the BMC login page using an automated tool according to configuration file data to obtain a BMC user page; A processing unit, used for processing the BMC user page to obtain a user page screenshot; A recognition unit, configured to call Tesseract-OCR to perform text recognition on the user page screenshot according to preset location data to obtain page data; A judging unit, used to judge whether the page data conforms to a preset verification rule; The first execution unit is used to execute the next BMC test when the judgment unit determines that the page data meets the preset verification rule.
9. A test device for automatically verifying BMC information, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and when the program is executed on a computer, the method according to any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
BMC Web network information display and verification automatic testing method
CN109450723A
Keyword detection method and device, electronic equipment and storage medium
CN113742559A
RAID card test method and system based on UEFI management interface, terminal and medium
CN118626322A
Capturing video data and serial data during an information handling system failure
US20190384666A1
Cited By
BMC page automatic screenshot method and device and storage medium
CN120161978A
Information extraction method for equipment configuration page and electronic equipment
CN120892110A
Information extraction method of device configuration page and electronic device
CN120892110B