Automated testing method and device for content library fragment storage
Patent Information
- Application Number
- CN202411668063.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-08
Smart Images

Figure CN119782146A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software storage, and in particular to an automated testing method and device for content library shard storage. Background Art
[0002] At present, the integrity verification of video content in the content library mainly relies on manual inspection. Specifically, this process usually includes the following steps: first, the operator requests specific video content from the content library; second, the videos are played through dedicated playback devices or software; finally, the video content is watched manually to check whether it is complete and clear, and whether there are problems such as reverse playback and improper editing. However, due to human subjectivity, the judgment standards between different inspectors may vary, and staring at the screen for a long time to watch the video can easily lead to visual fatigue and distraction, thereby increasing the risk of missed detection or misjudgment. Therefore, how to improve the accuracy of integrity verification has become a problem that needs to be solved. Summary of the invention
[0003] In view of this, the present invention provides an automated testing method and device for content library shard storage.
[0004] In a first aspect, the present invention provides an automated testing method for content library shard storage, the method comprising: obtaining a callback result sent by the content library; wherein the callback result includes the number of initial video slices and a content identifier corresponding to each initial video slice; querying the content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices; when the number of target video slices is the same as the number of initial video slices, comparing the number of target video slices with the expected number of slices to generate a first comparison result; processing the video slices in the content library to obtain a target video file; determining target verification information of the target video file and initial verification information of the source file; comparing the target verification information with the initial verification information of the source file to generate a second comparison result; and generating a test result based on the first comparison result and the second comparison result.
[0005] The automated testing method for content library slicing storage provided in this embodiment directly obtains the initial video slice quantity and content identifier through the callback result, avoiding the tedious process of manual input or query, and improving work efficiency. In addition, by comparing the initial video slice quantity with the target video slice quantity, it is possible to quickly identify whether the video slice is lost or increased during transmission or processing.
[0006] At the same time, the number of target video slices is compared with the expected number of slices to generate a first comparison result, which helps to ensure the integrity of the video file. The second comparison result is generated by comparing the target verification information with the initial verification information of the source file, which further verifies the accuracy of the video file after processing.
[0007] In addition, test results are automatically generated based on callback results and comparison results, which reduces manual intervention and improves the objectivity and accuracy of the test.
[0008] In a possible implementation, target verification information of a target video file and initial verification information of a source file are determined, including: calculating the MD5 value of the target video file and the MD5 value of the source file; taking a frame screenshot of the source file according to a preset time period to determine a first content name and a first timestamp watermark corresponding to the source file; taking a frame screenshot of the target video file according to a preset time period to determine a second content name and a second timestamp watermark corresponding to the target video file; using the MD5 value of the target video file, the second content name and the second timestamp watermark corresponding to the target video file as target verification information; and using the MD5 value of the source file, the first content name and the first timestamp watermark corresponding to the source file as initial verification information.
[0009] In the automated testing method for content library shard storage provided in this embodiment, the MD5 value is the unique digital fingerprint of the file, which can accurately reflect any slight changes in the file content. By comparing the MD5 value of the target video file with the MD5 value of the source file, it is possible to quickly and accurately verify whether the target video file has been tampered with or damaged during transmission or processing.
[0010] At the same time, determining content names for source and target video files helps to distinguish and identify different video files. The accuracy and uniqueness of content names help to ensure the authenticity and traceability of video files during processing. Timestamp watermarks can record the status of video files at a specific point in time. By comparing the timestamp watermarks of the source and target video files, it is possible to verify whether the time sequence and processing flow of the video files are as expected.
[0011] In a possible implementation, obtaining the callback result includes: obtaining content resources; adding a timestamp watermark and a content name to the content resources frame by frame to determine the target content resources; combining the target content resources to obtain an XML file corresponding to the target content resources; sending the XML file to a content library, and processing the XML file to determine the target video file; transcoding the target video file to determine the number of initial video slices and the content identifier corresponding to each initial video slice.
[0012] The automated testing method for fragmented storage of content libraries provided in this embodiment adds a timestamp watermark and a content name to each frame of content resources, which can ensure that each frame of content is unique and traceable. The timestamp watermark can record the generation time of each frame of content, which helps to accurately identify the order and integrity of the content in subsequent processing. The addition of content names makes it easier for users to quickly identify and retrieve specific content resources.
[0013] In a possible implementation, querying the content library storage information from the content library according to the content identifier includes: querying the content library identifier and storage path from the content library according to the content identifier; and querying the number of target video slices from the content library according to the content library identifier and storage path.
[0014] The automated testing method for content library shard storage provided in this embodiment can quickly locate the corresponding content library identifier and storage path in the content library through content identification, avoiding the tedious process of traversing the entire content library to find the target video slice in the traditional method, thereby improving query efficiency.
[0015] At the same time, once the content library identifier and storage path are located, the number of target video slices can be accurately obtained, avoiding the problem of inaccurate number of target video slices caused by manual input or query errors.
[0016] In one possible implementation, a test result is generated based on a first comparison result and a second comparison result, including: when the first comparison result is that the MD5 value of the target video file is the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, then the test is determined to be successful; when the first comparison result is that the MD5 value of the target video file is not the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, if any one of the following is not true, then the test is determined to be unsuccessful.
[0017] The automated testing method for content library shard storage provided by this embodiment, MD5 value as the unique digital fingerprint of the file, can accurately reflect any slight changes in the file content. When the MD5 value of the target video file is the same as the MD5 value of the source file, it can be ensured that the target video file is completely consistent with the source file in content, and no tampering or damage has occurred. The content name and timestamp watermark, as additional information of the file, can further verify the authenticity and integrity of the file. When the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, it can be confirmed that the target video file is consistent with the source file in content name and timestamp watermark, further enhancing the accuracy of verification. The judgment rule combines the verification of three dimensions of MD5 value, content name and timestamp watermark to form a comprehensive verification system. It can ensure that no key information is missed during the verification process, and improve the reliability of verification.
[0018] In a possible implementation manner, the method further includes: generating a test report according to the first comparison result, the second comparison result, the test result, and the event log, and displaying the test report.
[0019] The automated testing method for sharded storage of a content library provided in this embodiment includes a test report that integrates the first comparison result (such as MD5 value comparison), the second comparison result (such as content name and timestamp watermark comparison), the test result (such as test success or failure), and the event log, thereby ensuring the comprehensive recording of all key information, so that users can fully understand the test process, results, and possible problems.
[0020] In a second aspect, the present invention provides an automated testing device for content library segmented storage, the device comprising: a callback result acquisition module, used to obtain the callback result sent by the content library; wherein the callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice; a query module, used to query the content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices; a first comparison module, used to compare the target video slice number with the expected slice number when the target video slice number is the same as the initial video slice number, to generate a first comparison result; an integration module, used to integrate the video slices in the content library to obtain a target video file; a determination module, used to determine the target verification information of the target video file and the initial verification information of the source file; a second comparison module, used to compare the target verification information with the initial verification information of the source file to generate a second comparison result; a generation module, used to generate a test result based on the first comparison result and the second comparison result.
[0021] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the automated testing method for sharded storage of a content library according to the first aspect or any corresponding embodiment thereof.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the automated testing method for sharded storage of a content library according to the first aspect or any corresponding embodiment thereof.
[0023] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the automated testing method for content library shard storage according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 It is an interactive schematic diagram of an automated testing method for content library shard storage provided by an embodiment of the present invention;
[0026] Figure 2 It is a flowchart of an automated testing method for content library shard storage according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of video slicing and video back-source provided according to an embodiment of the present invention;
[0028] Figure 4 Schematic diagram of the automated testing method for content library shard storage provided by the present invention
[0029] Figure 5 is a structural block diagram of an automated testing device for content library shard storage according to an embodiment of the present invention;
[0030] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0032] Please refer to Figure 1 , Figure 1 It is an interactive schematic diagram of an automated testing method for content library shard storage provided according to an embodiment of the present invention.
[0033] Figure 1 The content provider can provide content resources to the CMS; wherein the content resources may include: video content, image content, etc. The CMS platform can be a simulation platform, which can be simulated through test cases, that is, when the test case is executed, the simulated CMS platform combines the content resources according to the content injection request to obtain an XML file, and returns the combined result of the XML file to the FTP server, that is, returns a result of successful XML file combination, and then the CMS platform sends a request to the content library injection interface, the content library responds to the injection request, and after verifying the legitimacy of the XML file, the content library slices the initial video corresponding to the XML file, and then returns the callback result to the content library, and then parses the XML to determine the ftp download address, and determines the source file according to the ftp download address. The callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice, and then responds to the back-to-source request, processes the video slices in the content library to obtain the target video file, and then reads the CDN, and then determines the MD5 value, the second content name and the second timestamp watermark of the target video file as the target verification information; determines the MD5 value of the source file, the first content name and the first timestamp watermark corresponding to the source file, and when the MD5 value of the target video file is the same as the MD5 value of the source file and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, the test is determined to be successful.
[0034] According to an embodiment of the present invention, an embodiment of an automated testing method for sharded storage of a content library is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0035] In this embodiment, an automated testing method for content library shard storage is provided, which can be used for computer devices, such as computers, servers, etc. Figure 2FIG. 1 is a flow chart of an automated testing method for content library shard storage according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0036] Step S201, obtaining a callback result sent by the content library; wherein the callback result includes the number of initial video slices and a content identifier corresponding to each initial video slice.
[0037] The content library is used to represent a database or storage system that stores video slices, content identifiers and other related information. The callback result can represent the result information returned to the requester by the content library after processing a request. Specifically, the callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice. That is, after the content library slices the video, it needs to call back the number of initial video slices and the content identifier corresponding to each initial video slice.
[0038] As an example, after sending a video slice upload request to the content library, a callback result is received, which includes that the initial number of video slices is 10, and the content identifier of each slice is ID1, ID2, ..., ID10.
[0039] It should be noted that in this embodiment, the computer device can execute test cases. Among them, a queue can include multiple test cases, and each test case can be executed according to the order or according to the priority, etc., which is not specifically limited here. Each test case can execute steps S201 to S207. After the current test case executes steps S201 to S207, the next test case is executed until all test cases are executed.
[0040] Step S202, querying content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices.
[0041] The content identifier can represent an identifier used to uniquely identify a video slice or video file in the content library. Specifically, after receiving the content identifier and the initial number of video slices, the memory library storage can be queried based on the content identifier to determine whether the callback result returned by the memory library is correct, that is, whether the target video slice number is consistent with the initial video slice number.
[0042] Step S203: When the target video slice number is the same as the initial video slice number, the target video slice number is compared with the expected slice number to generate a first comparison result.
[0043] The expected number of slices may represent the number of slices obtained by slicing the source file according to a preset rule.
[0044] As an example, the source file may be sliced according to the rule of 2 MB per slice to obtain the number of slices. The source file may also be sliced in other ways, which are not specifically limited here.
[0045] When the number of target video slices is the same as the number of initial video slices, it indicates that the callback result returned by the memory library is correct, and the number of target video slices can be compared with the expected number of slices to generate a first comparison result.
[0046] Step S204: Process the video slices in the content library to obtain target video files.
[0047] The video slices in the content library are merged, re-encoded, and spliced to obtain a complete target video file, wherein the target video file is a video file processed by the memory library.
[0048] It should be noted that each video slice may include a timestamp watermark and a content name, and accordingly, the target video file obtained by processing may also include a timestamp watermark and a content name.
[0049] Please refer to Figure 3 , Figure 3 It is a schematic diagram of video slicing and video back-source provided according to an embodiment of the present invention.
[0050] The videos in the content library are transcoded and sliced, and then written to the content library storage. The content uploaded to the content library storage can be divided into two storage pools, where the first storage pool (mate pool) is used to store the content of the transcoded slices, and the other storage pool (data pool) is used to store the identifiers of the transcoded slices. When the back-to-source step is performed through the content delivery network (Content Delivery Network, CDN), the functional component (Dayu Staroge Hub) matches the identifier obtained by CND with the storage pool storing the identifier, and then reads the content of the corresponding identifier from the storage pool storing the content of the transcoded slices.
[0051] Step S205, determining target verification information of the target video file and initial verification information of the source file.
[0052] The target verification information may represent the verification information of the target video file, such as MD5 value, hash value, time stamp watermark, etc., which is not specifically limited here. The initial verification information may represent the MD5 value, hash value, time stamp watermark, etc. of the source file, which is not specifically limited here.
[0053] Step S206: compare the target verification information with the initial verification information of the source file to generate a second comparison result.
[0054] Compare the verification information of the target video file with the verification information of the source file.
[0055] As an example, the MD5 value of the target video file is abcd1234, which is different from the MD5 value of the source file efgh5678, indicating that there are differences between the target video file and the source file.
[0056] Step S207: Generate a test result based on the first comparison result and the second comparison result.
[0057] The test result may represent the result of the test case being tested. The test result may include the test case being tested successfully or the test case being tested failed. The test result may be determined by the first comparison result and the second comparison result. The specific determination method is described in detail below.
[0058] The automated testing method for content library slicing storage provided in this embodiment directly obtains the initial video slice quantity and content identifier through the callback result, avoiding the tedious process of manual input or query, and improving work efficiency. In addition, by comparing the initial video slice quantity with the target video slice quantity, it is possible to quickly identify whether the video slice is lost or increased during transmission or processing.
[0059] At the same time, the number of target video slices is compared with the expected number of slices to generate a first comparison result, which helps to ensure the integrity of the video file. The second comparison result is generated by comparing the target verification information with the initial verification information of the source file, which further verifies the accuracy of the video file after processing.
[0060] In addition, test results are automatically generated based on callback results and comparison results, which reduces manual intervention and improves the objectivity and accuracy of the test.
[0061] In a possible implementation, the above step S205 includes:
[0062] Step a1, calculating the MD5 value of the target video file and the MD5 value of the source file.
[0063] The MD5 value can generate a 128-bit (16-byte) hash value (usually represented by a 32-bit hexadecimal number) to ensure that information transmission is complete and consistent. Specifically, the MD5 value of the target video file and the MD5 value of the source file can be determined by library functions in programming languages, command line tools, graphical user interface tools, etc.
[0064] Step a2: taking a screenshot of a source file according to a preset time period, and determining a first content name and a first timestamp watermark corresponding to the source file.
[0065] The first content name corresponding to the source file may represent a name or label for identifying or describing the video frame content of the source file. The first timestamp watermark is a watermark that embeds timestamp information into a video frame, and is used to record the generation time or processing time of the frame. Specifically, a tool or library for video files, such as FFmpeg, OpenCV or other video processing software, may be used to extract frames of the source file to determine the first content name and the first timestamp watermark corresponding to the source file.
[0066] Step a3: taking a frame screenshot of the target video file according to a preset time period, and determining a second content name and a second timestamp watermark corresponding to the target video file.
[0067] The second content name corresponding to the target video file may represent a name or label for identifying or describing the video frame content of the target video file. The second timestamp watermark is a watermark that embeds timestamp information into the video frame of the target video file to record the generation time or processing time of the frame.
[0068] As an example, ffmpeg is called to take frame screenshots of the source file and the target video file returned by the content library every 3 seconds, and the pyorc library is called to perform OCR recognition on the frame screenshots to obtain the first content name and the first timestamp watermark corresponding to the source file, and the second content name and the second timestamp watermark corresponding to the target video file.
[0069] Step a4: Use the MD5 value of the target video file, the second content name corresponding to the target video file, and the second timestamp watermark as target verification information.
[0070] Step a5: Use the MD5 value of the source file, the first content name corresponding to the source file, and the first timestamp watermark as initial verification information.
[0071] The MD5 value of the target video file, the corresponding second content name and the second time stamp watermark are combined into the target verification information. The MD5 value of the source file, the corresponding second content name and the second time stamp watermark are combined into the target verification information.
[0072] In the automated testing method for content library shard storage provided in this embodiment, the MD5 value is the unique digital fingerprint of the file, which can accurately reflect any slight changes in the file content. By comparing the MD5 value of the target video file with the MD5 value of the source file, it is possible to quickly and accurately verify whether the target video file has been tampered with or damaged during transmission or processing.
[0073] At the same time, determining content names for source and target video files helps to distinguish and identify different video files. The accuracy and uniqueness of content names help to ensure the authenticity and traceability of video files during processing. Timestamp watermarks can record the status of video files at a specific point in time. By comparing the timestamp watermarks of the source and target video files, it is possible to verify whether the time sequence and processing flow of the video files are as expected.
[0074] In a possible implementation, the above step S201 includes:
[0075] Step b1, obtaining content resources.
[0076] Content resources are used to represent multimedia files such as original videos, audios, images, etc. that need to be processed. Specifically, the content resources that need to be processed can be obtained from a database, a network, or other sources.
[0077] Step b2: adding a timestamp watermark and a content name to the content resource frame by frame to determine the target content resource.
[0078] The timestamp watermark is used to represent the mark indicating the time information added to each frame of the content resource. The content name can be used to represent the description or identification of the content resource, which can be a file name, title, tag, etc. Specifically, a video processing tool or library (such as FFmpeg, OpenCV) can be used to read the content resource frame by frame and add a timestamp watermark and content name to each frame.
[0079] Step b3: combine the target content resources to obtain an XML file corresponding to the target content resources.
[0080] Combine processed content resources (such as video frames with watermarks and names) into a whole and generate an XML file describing these contents.
[0081] As an example, write a Python script that reads the processed video frame information and generates an XML file containing this information.
[0082] Step b4, sending the XML file to the content library, and processing the XML file to determine the target video file.
[0083] Upload the generated XML file to the content library and use a parsing tool or library to read the contents of the XML file to determine the target video file.
[0084] As an example, an HTTP POST request can be used to upload an XML file to a content library. An XML parsing library (such as Python's xml.etree.ElementTree) can also be used to read the XML file, and then the target video file can be determined based on the content of the XML file.
[0085] Step b5, transcoding the target video file to determine the number of initial video slices and the content identifier corresponding to each initial video slice.
[0086] Get the source file from the specified download address, transcode it (i.e. change the video encoding format, resolution, bit rate and other parameters to adapt to different playback needs or storage requirements), then split the transcoded video into multiple initial video slices, and assign a unique content identifier to each slice.
[0087] As an example, select a suitable transcoding tool or library (such as FFmpeg, GStreamer, libavcodec, etc.). Set transcoding parameters (such as encoding format, resolution, frame rate, bit rate, etc.) according to the target playback device or storage requirements. Perform the transcoding operation to generate a transcoded video file. Determine the number of slices based on the total duration of the transcoded video and the expected duration of each slice. Use a video segmentation tool or library (such as FFmpeg) to segment the transcoded video into multiple initial video slices.
[0088] The automated testing method for fragmented storage of content libraries provided in this embodiment adds a timestamp watermark and a content name to each frame of content resources, which can ensure that each frame of content is unique and traceable. The timestamp watermark can record the generation time of each frame of content, which helps to accurately identify the order and integrity of the content in subsequent processing. The addition of content names makes it easier for users to quickly identify and retrieve specific content resources.
[0089] In a possible implementation, the above step S202 includes:
[0090] Step c1, querying the content library identifier and storage path from the content library according to the content identifier.
[0091] As can be seen from the above, the content identifier can represent an identifier used to uniquely identify a video slice or video file in the content library. Through the content identifier, the content library identifier corresponding to the content identifier can be directly determined from the content library, and the storage path can be determined according to the content library identifier.
[0092] Step c2: query the number of target video slices from the content library according to the content library identifier and storage path.
[0093] Receive the content library identifier and storage path returned from step c1. Using the storage path, the system accesses the physical storage system (such as hard disk, network attached storage, cloud storage, etc.) that stores the video slices. Traverse all files under the storage path and calculate the number of files associated with the given content library identifier. If the storage system supports metadata query, the number of slices associated with the given content library identifier can be directly queried. After calculating or querying the number of target video slices, the number is returned to the requesting party.
[0094] The automated testing method for content library shard storage provided in this embodiment can quickly locate the corresponding content library identifier and storage path in the content library through content identification, avoiding the tedious process of traversing the entire content library to find the target video slice in the traditional method, thereby improving query efficiency.
[0095] At the same time, once the content library identifier and storage path are located, the number of target video slices can be accurately obtained, avoiding the problem of inaccurate number of target video slices caused by manual input or query errors.
[0096] In a possible implementation, the above step S207 includes:
[0097] Step d1, when the first comparison result is that the MD5 value of the target video file is the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, then the test is determined to be successful.
[0098] Step d2: when the first comparison result is that the MD5 value of the target video file is different from the MD5 value of the source file and the second comparison result is that any one of the second content name is the same as the first content name and the second timestamp watermark is the same as the first timestamp watermark is not true, the test is determined to be unsuccessful.
[0099] First comparison result: compare the MD5 value of the target video file with the MD5 value of the source file.
[0100] Second comparison result: compare the second content name (which may be the name or description of the target video file) with the first content name (which may be the name or description of the source file), and compare the second timestamp watermark (the timestamp watermark of the target video file) with the first timestamp watermark (the timestamp watermark of the source file). If one of the first comparison result and the second comparison result does not meet the above conditions (i.e., the MD5 values are the same, the content names are the same, and the timestamp watermarks are also the same), the test is determined to be unsuccessful.
[0101] In a possible implementation, the first comparison result may be used as the first condition, and the second comparison result may be used as the second condition; wherein, when the first condition is not met, there is no need to judge the second condition.
[0102] The automated testing method for content library shard storage provided by this embodiment, MD5 value as the unique digital fingerprint of the file, can accurately reflect any slight changes in the file content. When the MD5 value of the target video file is the same as the MD5 value of the source file, it can be ensured that the target video file is completely consistent with the source file in content, and no tampering or damage has occurred. The content name and timestamp watermark, as additional information of the file, can further verify the authenticity and integrity of the file. When the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, it can be confirmed that the target video file is consistent with the source file in content name and timestamp watermark, further enhancing the accuracy of verification. The judgment rule combines the verification of three dimensions of MD5 value, content name and timestamp watermark to form a comprehensive verification system. It can ensure that no key information is missed during the verification process, and improve the reliability of verification.
[0103] In a possible implementation, the method further includes: generating a test report according to the first comparison result, the second comparison result, the test result, and the event log, and displaying the test report.
[0104] Collect the first comparison result, the second comparison result, the final test result (successful or unsuccessful), and any related event logs.
[0105] Generate a report: Using this information, generate a detailed test report. The report should include: The purpose and background of the test. The specific steps of the test execution. A detailed record of the comparison results. The final test results. If the test was unsuccessful, it should include possible reasons and suggestions. A summary or key entries of the event log.
[0106] Test reports can be presented in a variety of formats, such as text files, PDF, HTML web pages or report views in a graphical interface. Depending on the user's needs and the system's capabilities, test reports can be provided to users through screen display, printout, email or upload to cloud storage.
[0107] The automated testing method for sharded storage of a content library provided in this embodiment includes a test report that integrates the first comparison result (such as MD5 value comparison), the second comparison result (such as content name and timestamp watermark comparison), the test result (such as test success or failure), and the event log, thereby ensuring the comprehensive recording of all key information, so that users can fully understand the test process, results, and possible problems.
[0108] Please refer to Figure 4 , Figure 4 It is a schematic diagram of an automated testing method for content library shard storage provided by the present invention.
[0109] The content library shard storage test is generally divided into three parts: content injection (Inject), content slice storage (Storage), and content request loading (Upstream); the overall automation script consists of the three modules of Inject, Storage, and Upstream plus the third-party test library pytest and allure architecture.
[0110] Among them, Inject is used to realize the function of automatically injecting specified resources by the test script and accepting callbacks; test premise: all resources are watermarked frame by frame (the watermark includes the video timestamp and resource name); use the script to implement injection operations for different types of source files (ts, jpg, txt, MP4, etc.) and receive injection result callbacks.
[0111] The Storage module is used to implement the content slice storage part to verify the number of slices and the function of storing records; use the script to query the storage status based on the taskid callback result, calculate the number of slices (2M / slice) according to the source file size and compare it with the actual number of stored slices.
[0112] The Upstream module is mainly used to implement the content request loading part to verify the number of loaded slices, the order of loaded content, and the integrity of the function; use the script to simulate the edge back-to-source request, calculate the MD5 value of the file obtained by the back-to-source request and compare it with the MD5 of the source file, take frame screenshots of the source file and the back-to-source request file at the same time point, and call the third-party OCR library to identify the timestamp of the screenshot and compare it with the resource name.
[0113] More specifically, the watermarked source file is stored in the FTP server, the CMS is simulated to assemble the injection XML file and upload it to the FTP server, the content library injection interface is called to perform the injection operation, and the content library injection result callback is received. The content ID is parsed from the callback XML, the content library storage information (storage path, storage ID, total number of storage slices a) is queried, and the expected number of slices is calculated: source file / 2Mb=b, and the actual number of stored slices is compared, that is, whether the values of a and b are equal. If they are equal, it means that the file is complete, otherwise the file is incomplete and the test fails. Request content library storage, calculate the MD5 value of the file returned by the content library and compare it with the MD5 of the source file, call ffmpeg to take a frame screenshot of the source file and the file returned by the content library every 3 seconds, call the pyorc library to perform OCR recognition on the frame pictures to obtain the content name and timestamp watermark for comparison, if the MD5 value of the source file is consistent with the MD5 value of the requested download file and the file ID and timestamp of the frame comparison are consistent, it means that the downloaded file is correct and complete, otherwise the test fails. Each test case is organized and executed by pytest. You can configure pytest to mark the current test case and continue to execute subsequent test cases or stop directly when the current test case fails. The screenshots of each link and the content and logs that need to be output are passed to allure through allure.attach, and finally Allure outputs the test report.
[0114] In this embodiment, an automated testing device for shard storage of a content library is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0115] This embodiment provides an automated testing device for content library fragment storage, such as Figure 5 As shown, including:
[0116] The callback result acquisition module 501 is used to acquire the callback result sent by the content library; wherein the callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice;
[0117] A query module 502 is used to query the content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices;
[0118] A first comparison module 503, configured to compare the target video slice number with the expected slice number when the target video slice number is the same as the initial video slice number, to generate a first comparison result;
[0119] An integration module 504 is used to integrate the video slices in the content library to obtain a target video file;
[0120] A determination module 505, used to determine target verification information of a target video file and initial verification information of a source file;
[0121] A second comparison module 506, used to compare the target verification information with the initial verification information of the source file to generate a second comparison result;
[0122] The generating module 507 is used to generate a test result based on the first comparison result and the second comparison result.
[0123] In a possible implementation, the determination module 505 includes: a calculation unit, which is used to calculate the MD5 value of the target video file and the MD5 value of the source file. A first determination unit is used to extract frames and screenshots of the source file according to a preset time period, and determine the first content name and the first timestamp watermark corresponding to the source file; a second determination unit is used to extract frames and screenshots of the target video file according to a preset time period, and determine the second content name and the second timestamp watermark corresponding to the target video file; a third determination unit is used to use the MD5 value of the target video file, the second content name and the second timestamp watermark corresponding to the target video file as target verification information; a fourth determination unit is used to use the MD5 value of the source file, the first content name and the first timestamp watermark corresponding to the source file as initial verification information.
[0124] In one possible implementation, the callback result acquisition module 501 includes: a content resource acquisition unit, which is used to acquire content resources; a fifth determination unit, which is used to add a timestamp watermark and a content name to the content resources frame by frame to determine the target content resources; a combination unit, which is used to combine the target content resources to obtain an XML file corresponding to the target content resources; a sending processing unit, which is used to send the XML file to the content library and process the XML file to determine the target video file; and a sixth determination unit, which is used to transcode the target video file and determine the number of initial video slices and the content identifier corresponding to each initial video slice.
[0125] In one possible implementation, the query module 502 includes: a first query unit, used to query the content library identifier and storage path from the content library according to the content identifier; and a second query unit, used to query the number of target video slices from the content library according to the content library identifier and storage path.
[0126] In one possible implementation, the generation module 507 includes: a first determination unit, used to determine that the test is successful when the first comparison result is that the MD5 value of the target video file is the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark; and a second determination unit, used to determine that the test is unsuccessful when the first comparison result is that the MD5 value of the target video file is not the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark.
[0127] In a possible implementation, the apparatus further includes: a generating and displaying module, configured to generate a test report according to the first comparison result, the second comparison result, the test result, and the event log, and to display the test report.
[0128] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0129] The automated testing device for sharded storage of the content library in this embodiment is presented in the form of a functional unit, where the functional unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0130] The embodiment of the present invention also provides a computer device having the above Figure 5 The automated testing device for sharded storage of the content library shown.
[0131] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0132] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0133] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0134] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0135] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0136] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0137] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0138] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0139] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. An automated testing method for content library shard storage, characterized in that: The method further comprises: Obtaining the callback result sent by the content library; wherein the callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice; Querying content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices; When the target video slice number is the same as the initial video slice number, comparing the target video slice number with the expected slice number to generate a first comparison result; Process the video slices in the content library to obtain the target video file; Determine target verification information of the target video file and initial verification information of the source file; Comparing the target verification information with the initial verification information of the source file to generate a second comparison result; A test result is generated based on the first comparison result and the second comparison result.
2. The automated testing method for content library shard storage according to claim 1 is characterized in that: Determine the target verification information of the target video file and the initial verification information of the source file, including: Calculate the MD5 value of the target video file and the MD5 value of the source file; Taking a screenshot of a source file according to a preset time period, and determining a first content name and a first timestamp watermark corresponding to the source file; Taking a frame screenshot of the target video file according to a preset time period, and determining a second content name and a second timestamp watermark corresponding to the target video file; The MD5 value of the target video file, the second content name corresponding to the target video file, and the second timestamp watermark are used as target verification information; The MD5 value of the source file, the first content name corresponding to the source file, and the first timestamp watermark are used as initial verification information.
3. The automated testing method for content library shard storage according to claim 1 is characterized in that: Get callback results, including: Obtain content resources; Adding a timestamp watermark and a content name to the content resource frame by frame to determine a target content resource; Combining the target content resources to obtain an XML file corresponding to the target content resources; Sending the XML file to a content library, and processing the XML file to determine a target video file; The target video file is transcoded to determine the number of initial video slices and the content identifier corresponding to each initial video slice.
4. The automated testing method for content library shard storage according to claim 1, characterized in that: The querying of the content library storage information from the content library according to the content identifier includes: Querying a content library identifier and a storage path from a content library according to the content identifier; According to the content library identifier and the storage path, the target video slice quantity is queried from the content library.
5. The automated testing method for content library shard storage according to claim 2 is characterized in that: Generating a test result based on the first comparison result and the second comparison result includes: When the first comparison result is that the MD5 value of the target video file is the same as the MD5 value of the source file, and the second comparison result is that the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark, then the test is determined to be successful; When the first comparison result is that the MD5 value of the target video file is different from the MD5 value of the source file, and the second comparison result is that any one of the second content name is the same as the first content name, and the second timestamp watermark is the same as the first timestamp watermark is not true, the test is determined to be unsuccessful.
6. The automated testing method for content library shard storage according to any one of claims 1 to 5, characterized in that: The method further comprises: A test report is generated according to the first comparison result, the second comparison result, the test result and the event log, and the test report is displayed.
7. An automated testing device for content library shard storage, characterized in that: The device comprises: A callback result acquisition module, used to acquire the callback result sent by the content library; wherein the callback result includes the number of initial video slices and the content identifier corresponding to each initial video slice; A query module, used to query content library storage information from the content library according to the content identifier; wherein the content library storage information includes the number of target video slices; A first comparison module, configured to compare the target video slice number with the expected slice number when the target video slice number is the same as the initial video slice number, to generate a first comparison result; An integration module is used to integrate the video slices in the content library to obtain the target video file; A determination module, used to determine target verification information of a target video file and initial verification information of a source file; A second comparison module, used to compare the target verification information with the initial verification information of the source file to generate a second comparison result; A generating module is used to generate a test result based on the first comparison result and the second comparison result.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the automated testing method for sharded storage of a content library as described in any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automated testing method for content library shard storage according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the automated testing method for sharded storage of a content library as claimed in any one of claims 1 to 6.