[0018] Method example:
[0019] This embodiment provides an automated testing method for a power distribution master station monitoring system. The method mainly consists of writing various test configurations corresponding to all test functions into the test case, so that in the process of executing the test case for testing, According to the test case, the test of various functions of the monitoring system of the main power distribution station can be completed. Combine below figure 1 , the method is described in detail.
[0020] Step 1: Analyze test requirements and functions according to the specification, formulate a test plan, and determine the framework of automated testing, such as figure 2 As shown, the specific framework content is as follows:
[0021] Bin: The runtime library file that stores the system application service;
[0022] Config: store configuration files, all configuration related to the project are placed in this directory;
[0023] Data: store test cases and test scripts;
[0024] Hisdata: store the test data recorded in the test process and the picture file of the running window;
[0025] Log: store the log files and test reports generated during the test;
[0026] Common: Stores various supporting codes under the autotest module, including online update classes, report generation classes, recording data classes, etc.
[0027] Step 2: Determine the service to be tested (analog telemetry service, status telemetry service, etc.), deploy the service runtime library file in the bin folder, and deploy the service configuration file in the config folder. Open the automated test interface, the service menu is provided on the test interface, and a new test service name is added to the dialog box in File>New Project>Test. After the new service is added, a folder named with the service name will be generated in the corresponding path.
[0028] In step 3, test cases are generated according to various test functions of the test service. One test function corresponds to one type of measurement point configuration, and various measurement point configurations corresponding to all test functions are written into the test case. Wherein, various measuring point configurations include at least one measuring point, and each measuring point includes more than two kinds of configuration information. A menu of test cases is provided on the test interface, and the required test cases can be selected according to the requirements. Moreover, new test cases can be added, and new test cases can be filled in the design fixed template or imported into existing test cases. Among them, each function point in the test case will automatically generate a serial number; the test case defaults to the utf-8 encoding format, and the test case includes the use case creation time, creator and project name. The selected test cases are stored in the form of files under the folder named after the associated service in the data folder, and the files are named starting with "test_".
[0029] Step 4: Define the autotest module, which encapsulates interfaces with various attributes. Among them, the autotest.main() interface can turn the test case into a test script that can be run directly; the test.loader() interface searches all the test methods starting with "test" contained in the service module to be tested, and automatically executes them ;The autotest.config() interface updates the configuration of test points online and other initialization conditions before testing, and informs the autotest.loader() interface to execute the test case; the autotest.assert() interface executes the assertion method; the autotest.read() interface will not pass The function of the test is written into the directory file of the service to be tested; the autotest.record() interface records the test data and window status; the autotest.store() interface stores the automated test results in the database; the autotest.report() interface automatically generates the test report.
[0030] Step 5: Determine the corresponding test script according to the test case. Call the autotest.main() interface to turn the test case into a test script that can be run directly. Specifically, the autotest.loader() interface is used to search for all the test methods starting with "test" contained in the service module to be tested, and execute them automatically.
[0031] Step 6: Start the test, when you click the RUN menu of the test interface, call the autotest.main() interface, automatically load the test cases of the service to be tested, execute the automated test, read the test point configuration in the database, load the test case, and run the test The script tests the corresponding functions of the monitoring system of the main power distribution station according to the configuration of various measuring points in the test case. Moreover, in the process of testing, the test configuration in the test case is updated to the database in an online update manner by calling the autotest.config() interface. After the update is completed, the onlineupdate-to-loader topic message is sent to autotest through kafka. The loader() interface notifies it to execute the test case.
[0032] Step 7: Call the autotest.assert() interface to execute the assertion method. During the execution of the test case, it is determined whether the final test is passed by judging whether the actual results obtained in the test are consistent with the expected results, and the test results of each function in the test case. are displayed in the run window. The display content of the test process includes: test results, input parameters, output results and assertion results. At the same time, after the test is completed, the test pass rate is output, and the proportion of passed function points to all function points is displayed, which is convenient for testers to understand this time intuitively. the result of the test.
[0033] Step 8: During the test process, call the autotest.record() interface to record the running window actions and data in the test, and save them in the form of pictures and files in the folder named after the test service name under the hisdata folder, respectively. Among them, the files are named according to the service to be tested, the test serial number and the test time.
[0034] Step 9, the test interface has a debug window. By calling the autotest.read() interface, the failed functions in the autotest.assert() interface are stored in the log folder in the form of logs, and the failed test is displayed in the debug window. In addition, the test interface provides a playback button. By entering the service to be tested, the test serial number and the function point serial number, the recorded historical data can be reloaded for playback of the test process, which is convenient for testers to find the cause through problem recurrence. At the same time, call the autotest.store() interface to store the automated test results in the database, and call the autotest.report() interface to automatically generate the test report, which is stored in the log folder in the form of html. Among them, a view report button is provided in the test interface to view the test report, which is convenient for the tester to view the test results as a whole more intuitively.
[0035] While the content of the present invention has been described in detail by way of the above preferred embodiments, it should be appreciated that the above description should not be construed as limiting the present invention. Various modifications and alternatives to the present invention will be apparent to those skilled in the art upon reading the foregoing. Accordingly, the scope of protection of the present invention should be defined by the appended claims.