CN112148273A - Automation script modular design method based on Robot Framework - Google Patents
Automation script modular design method based on Robot Framework Download PDFInfo
- Publication number
- CN112148273A CN112148273A CN202011171814.3A CN202011171814A CN112148273A CN 112148273 A CN112148273 A CN 112148273A CN 202011171814 A CN202011171814 A CN 202011171814A CN 112148273 A CN112148273 A CN 112148273A
- Authority
- CN
- China
- Prior art keywords
- keywords
- equipment
- logic layer
- logic
- design method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/76—Adapting program code to run in a different environment; Porting
Abstract
The invention discloses an automatic script modularization design method based on a Robot Framework, which provides a three-layer layering model and modularizes the development of an automatic test script. Therefore, to adapt to a new product, all that is needed is to copy the keywords of the near customers, then rename the module files, name the keywords according to the rules, and finally modify the logic of interaction with the equipment in the adapted keywords. Unlike the traditional way of modifying an interactive logic that requires reading and understanding of code throughout, adapting a new device requires only the internal device to interact with the logic layer code. Greatly reducing the maintenance cost and improving the development and transplantation efficiency.
Description
Technical Field
The invention belongs to the field of script design, and particularly relates to an automatic script modular design method based on a Robot Framework.
Background
The use of Robot Framework in the field of automation testing is becoming more and more popular because of its high scalability and its easy-to-learn nature of the underlying language Python. However, based on the actual situation of some companies, for example, some foundries or manufacturers of research and development, there are many customers, many products, many interfaces, and so on, so that it is very difficult to adapt to different customers and products, and different interfaces become very difficult, and the maintenance task of the subsequent scripts becomes very heavy.
Disclosure of Invention
In order to solve the technical problems, the invention provides an automatic script modular design method based on the Robot Framework, and the efficiency of script development is greatly improved.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
an automatic script modularization design method based on Robot Framework comprises the following steps:
s1, establishing an automatic script template based on the Robot Framework;
s2, determining use cases needing to be automated, and determining whether the use cases needing to be automated can share the same set of test topology;
s3, determining the manufacturers needing to be compatible with the same equipment subsequently used in the whole set of use cases, and determining the customers needing to be compatible subsequently in the whole set of use cases;
s4, devices or clients which need to develop compatible keywords definitely;
s5, developing each use case;
the development method of the use case comprises the following steps: dividing the case step of each test case into indivisible steps, wherein each step defines a keyword in advance and predefines the parameter of the keyword;
s6, creating resource files or directories of the keywords of the use case steps, then defining all the keywords to be developed in S5, and explicitly transmitting reference and return values; in the keyword content, taking out variables from the public variables, and calling keywords of different equipment interaction logic layers in a run keyword if judging mode or a run keyword $ { OLT _ TYPE } Login Olt mode;
and S7, respectively establishing resource subsets according to the types of the operation equipment for the keywords of the equipment interaction logic layer to be realized, which are found out in the S6, and then respectively developing the keywords of the equipment interaction logic layer in the established resource subsets.
Furthermore, the names of the keywords of the developed equipment interaction logic layer need to be named regularly.
Further, the automated script template includes:
test case logic layer: logic used for implementing the test case to be executed;
testing step logic layer: logic for implementing each indivisible test step for implementing calling different underlying keywords by the judgment of specific variables;
device interaction logic layer: specific logic for implementing interactions with devices;
a common variable module: the method is used for placing all configuration items related to the environment and the equipment and all configuration items related to the environment and the equipment for global calling.
Further, the test case logic layer is specifically configured to divide the case into indivisible steps, and then combine keywords of the indivisible steps into one test case.
Furthermore, the test step logic layer only implements the action of an indivisible step and does not implement the specific interaction logic with the equipment, and the indivisible step can specify the keywords of the equipment interaction logic layer for executing different customers through judgment variables.
Further, the device interaction logic layer specifically realizes interaction with different client interfaces, and keys of the device interaction logic layer adapted to different clients should be named regularly.
Compared with the prior art, the invention has the following beneficial effects:
1. by adopting the invention, when the interactive logic layer of the equipment is realized enough, the upper layer can expand new test cases to directly multiplex codes of different interactive logic layers of the equipment; when the device is adapted to a new device to be tested or a new environment, only a new device interaction logic layer needs to be developed; therefore, some differential codes related to the equipment are shielded in the minimum range, and a script development engineer only needs to copy a similar code and then modifies codes of different equipment interaction logic layers to finish transplantation, so that the development of the Robot Framework becomes more efficient.
2. In the invention, because the operation of each step is an atomic and inseparable step, even if different customers are to finish the execution of the test case, the functions required to be realized by the user keywords between the customers should be the same, and the difference is only the content difference of each keyword in the device interaction logic layer. Therefore, to adapt to a new product, all that is needed is to copy the keywords of the near customers, then rename the module files, name the keywords according to the rules, and finally modify the logic of interaction with the equipment in the adapted keywords. Unlike the traditional way of modifying an interactive logic that requires reading and understanding of code throughout, adapting a new device requires only the internal device to interact with the logic layer code. Greatly reducing the maintenance cost and improving the development and transplantation efficiency.
According to the invention, by providing the three-layer layering model, the development of the automatic test script is modularized, the coupling degree between the modules is reduced, and the transplanting development efficiency is improved.
Drawings
FIG. 1 is a model architecture diagram of one embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention.
The invention discloses an automatic script modular design method based on a Robot Framework, which comprises the following steps:
s1, establishing an automatic script template based on the Robot Framework;
as shown in fig. 1, the automation script template includes a test case logic layer, a test step logic layer, an equipment interaction logic layer, and a common variable module; wherein the content of the first and second substances,
the test case logic layer: the logic layer of the test case does not realize the interaction with the equipment;
the test case logic layer only implements the logic of a specific case, and is specifically used for dividing the case into indivisible steps, for example, logging in is an indivisible action. The keys of these indivisible steps are then combined into a test case.
The logic layer of the test step: the logic used to implement each indivisible test step does not implement the actual interaction logic specifically with the device under test. The method is used for calling different bottom-layer keywords by judging specific variables;
the test step logic layer only implements the action of one indivisible step and does not implement the interaction logic specifically with the equipment, for example, logging in a router is an indivisible and atomic action, and the indivisible step can specify the key words of the equipment interaction logic layer for executing different customers by judging variables such as customer names; the layer does not realize specific interaction logic with the equipment, and only makes adaptation judgment between different equipment.
Device interaction logic layer: specific logic for implementing device interaction, such as the logic for implementing Selenium interaction with interface interaction, is implemented here;
the device interaction logic layer specifically implements interaction with different customer interfaces, and keys and keywords of the device interaction logic layer adapted to different customers should be named regularly, for example, the names of manufacturers or models of the OLT are used as the beginning, so as to facilitate the invocation of the test step logic layer, for example: the client name in the public variable is xxx, the name of the client xxx should be xxx Web Login, the related Keyword of the client yyyy should be named yyyy Web Login, thus, different keywords can be called in a test step logic layer in a Run Keyword $ { customer } Web Login mode, the value of $ { customer } in the public variable is xxx, the actually executed xxx Web Login is, the value of $ { customer } in the public variable is yyy, and the actually executed yy Web Login is.
A common variable module: the method is used for placing all configuration items related to the environment and the equipment and all configuration items related to the environment and the equipment for global calling.
S2, determining use cases needing to be automated, and determining whether the use cases needing to be automated can share the same set of test topology;
s3, determining the manufacturers needing to be compatible with the same equipment subsequently used in the whole set of use cases, and determining the customers needing to be compatible subsequently in the whole set of use cases;
s4, devices or clients which need to develop compatible keywords definitely;
s5, developing each use case; the development of the use case does not realize specific business logic, but only realizes a frame structure according to the steps of the use case
The development method of the use case comprises the following steps: dividing the case step of each test case into indivisible steps, wherein each step defines a keyword in advance and predefines the parameter of the keyword;
s6, creating resource files or directories of the keywords of the use case steps, then defining all the keywords to be developed in S5, and explicitly transmitting reference and return values; in the keyword content, variables are taken out from public variables, keywords of different equipment interaction logic layers are called in a run keyword if judging mode or a run keyword $ { OLT _ TYPE } Login Olt mode, and specific service interaction logic is still not realized in the layers;
s7, respectively establishing resource subsets according to the types of the operation equipment for the keywords of the equipment interaction logic layer to be realized found in the S6, and then respectively developing the keywords of the equipment interaction logic layer in the established resource subsets; naming of keys of an interactive logic layer of the developed equipment needs to follow a certain rule, for example, resource subsets of the OLT are controlled, the same key for controlling different OLTs takes the manufacturer or model name of the OLT as the beginning, for example, ZTE C300 Login Olt and H3C Login Olt, so that as long as the common variable $ { OLT _ TYPE } is assigned to ZTE C300, ZTE C300 Login Olt is called, and the common variable $ { OLT _ TYPE } is assigned to H3C, H3C Login Olt is called.
The embodiments described above are only preferred embodiments of the invention and are not exhaustive of the possible implementations of the invention. Any obvious modifications to the above would be obvious to those of ordinary skill in the art, but would not bring the invention so modified beyond the spirit and scope of the present invention.
Claims (6)
1. An automatic script modularization design method based on Robot Framework is characterized by comprising the following steps:
s1, establishing an automatic script template based on the Robot Framework;
s2, determining use cases needing to be automated, and determining whether the use cases needing to be automated can share the same set of test topology;
s3, determining the manufacturers needing to be compatible with the same equipment subsequently used in the whole set of use cases, and determining the customers needing to be compatible subsequently in the whole set of use cases;
s4, devices or clients which need to develop compatible keywords definitely;
s5, developing each use case;
the development method of the use case comprises the following steps: dividing the case step of each test case into indivisible steps, wherein each step defines a keyword in advance and predefines the parameter of the keyword;
s6, creating resource files or directories of the keywords of the use case steps, then defining all the keywords to be developed in S5, and explicitly transmitting reference and return values; in the keyword content, taking out variables from the public variables, and calling keywords of different equipment interaction logic layers in a run keyword if judging mode or a run keyword $ { OLT _ TYPE } Login Olt mode;
and S7, respectively establishing resource subsets according to the types of the operation equipment for the keywords of the equipment interaction logic layer to be realized, which are found out in the S6, and then respectively developing the keywords of the equipment interaction logic layer in the established resource subsets.
2. The automatic script modular design method based on Robot Framework as claimed in claim 1, wherein the naming of the developed device interaction logic layer key needs to be named regularly.
3. The Robot Framework-based automated script modular design method according to claim 1, wherein the automated script template comprises:
test case logic layer: logic used for implementing the test case to be executed;
testing step logic layer: logic for implementing each indivisible test step for implementing calling different underlying keywords by the judgment of specific variables;
device interaction logic layer: specific logic for implementing interactions with devices;
a common variable module: the method is used for placing all configuration items related to the environment and the equipment and all configuration items related to the environment and the equipment for global calling.
4. The Robot Framework-based automated script modular design method according to claim 3,
the test case logic layer is specifically used for dividing the use cases into indivisible steps, and then combining keywords of the indivisible steps into one test case.
5. The Robot Framework-based automated script modular design method according to claim 3,
the test step logic layer only realizes the action of one indivisible step and does not realize the interaction logic with the equipment, and the indivisible step can specify and execute the keywords of the equipment interaction logic layers of different customers through judging variables.
6. The Robot Framework-based automated script modular design method according to claim 3,
the device interaction logic layer specifically realizes interaction with different client interfaces, and is adapted to regular naming between keywords of the device interaction logic layer of different clients.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011171814.3A CN112148273A (en) | 2020-10-28 | 2020-10-28 | Automation script modular design method based on Robot Framework |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011171814.3A CN112148273A (en) | 2020-10-28 | 2020-10-28 | Automation script modular design method based on Robot Framework |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112148273A true CN112148273A (en) | 2020-12-29 |
Family
ID=73953543
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011171814.3A Pending CN112148273A (en) | 2020-10-28 | 2020-10-28 | Automation script modular design method based on Robot Framework |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112148273A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106095677A (en) * | 2016-06-08 | 2016-11-09 | 上海爱数信息技术股份有限公司 | The RESTful Webservice automatic interface testing method realized based on Robot Framework |
CN109814915A (en) * | 2018-12-29 | 2019-05-28 | 天津字节跳动科技有限公司 | Method for parameter configuration, device, medium and electronic equipment based on lua |
CN110825647A (en) * | 2019-11-14 | 2020-02-21 | 广东华晟数据固态存储有限公司 | Test method for automatically testing logical equipment interface |
-
2020
- 2020-10-28 CN CN202011171814.3A patent/CN112148273A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106095677A (en) * | 2016-06-08 | 2016-11-09 | 上海爱数信息技术股份有限公司 | The RESTful Webservice automatic interface testing method realized based on Robot Framework |
CN109814915A (en) * | 2018-12-29 | 2019-05-28 | 天津字节跳动科技有限公司 | Method for parameter configuration, device, medium and electronic equipment based on lua |
CN110825647A (en) * | 2019-11-14 | 2020-02-21 | 广东华晟数据固态存储有限公司 | Test method for automatically testing logical equipment interface |
Non-Patent Citations (1)
Title |
---|
高青娟;陈立潮;张英俊;潘理虎;谢斌红;: "一种关键字驱动的Java API自动测试框架", 计算机技术与发展, no. 08 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7860905B2 (en) | Systems and methods for modularizing data flows | |
CN105224447B (en) | Engine controller software diagnosis module test method and test system | |
CN1326044C (en) | Automation software testing system based on script explanatory tool | |
US8250355B2 (en) | Method, system, and product for identifying provisioning operations via planning methods | |
Weiderman et al. | Approaches to legacy system evolution | |
Graube et al. | Information models in OPC UA and their advantages and disadvantages | |
WO2003038609A1 (en) | Method of deployment for concurrent execution of multiple versions of an integration model on an integration server | |
US7860904B2 (en) | Standalone execution of incomplete data flows | |
JP2010503905A (en) | Discovery web service | |
US20220066409A1 (en) | Method and system for generating an artificial intelligence model | |
CN110221815B (en) | Automatic generation method of control software model based on ontology | |
US20030140126A1 (en) | Method of deployment for concurrent execution of multiple versions of an integration model | |
CN110705724A (en) | Reusable automatic operation and maintenance management system | |
CN102866944A (en) | Pressure testing system and method | |
CN111723176A (en) | Method for generating semantic description of synthetic interaction | |
CN104423968A (en) | Method of designing business logic, server performing the same and storage medium storing the same | |
Schmidt et al. | Methodology for the model driven development of service oriented plant controls | |
CN114460925B (en) | Automatic test method for CAN interface HIL of electric automobile controller | |
CN114371851A (en) | Network equipment automation realization method based on compiling | |
CN112148273A (en) | Automation script modular design method based on Robot Framework | |
CN111813836A (en) | Method for improving Ethereum block chain system expansibility | |
Inverardi et al. | Connectors synthesis for deadlock-free component based architectures | |
Di Lorenzo et al. | Towards Semantics Driven Generation of Executable Web Services Compositions. | |
Becker et al. | Integration tools supporting cooperative development processes in chemical engineering | |
Gill et al. | Integration of domain expert-centric ontology design into the CRISP-DM for cyber-physical production systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |