1. Introduction to Robot Framework
1) RobotFramework
Robot Framework is a functional automation testing framework written in Python that supports keyword drive and has good scalability. It is mainly used for system testing that requires multiple acceptances, or acceptance test-driven development. It is especially valuable for some systems that require maintenance all year round.
2) RIDE
RIDE is a software specially used to edit Robot Framework use cases. It is written in Python and is open source. After we have written a set of scripts for a system, whenever we make some changes to the system, we can take out the scripts we have written and modify them slightly. By executing these scripts, we can check whether the functions of the system are still intact. . The system requires a continuous improvement process, and RIDE use cases will also be modified accordingly as the system changes.
3) Features:
a. Test cases are saved in text files; b. Test cases support the use of variables, and if statements and for loops can also be used. Testers can create the test libraries they need according to their own circumstances; c. Test execution reports and The log is in html format and is easy to read; d. Supports keyword-driven, data-driven, behavior-driven, etc.
2. RIDE test case
1. Create a new project.
First, click File—>New Project on the menu bar. (Select "Directory" here because we need to create a folder to store the use cases. In fact, you can also use File, depending on your needs)
After creation, as shown below
2. Create a test suite (Suite),
right-click the newly created file "testBaidu" -> click "New Suite"
3. Create a test case (Test Case),
right-click the newly created file "New Test Case" -> click "New Suite"
添加完以后如下图
4. Write use case script
1) Add Selenium2Library library file.
Click on the created test suite and select Add Library
添加好以后文件名是黑色的,如果是红色,则说明加载不成功,需要检查库文件是否已安装,或者名称是否正确
2) Write scripts.
The use case scenario is as follows:
a.打开浏览器进入百度主页
b.在搜索框中输入搜索文字”test“
c.点击搜索按钮
d.等待10s
e.关闭浏览器
3) Run the script and check the running status.
Select the test case and click "Tools" -> "Run Tests" in the menu bar, or directly click the run icon to pause or terminate during the running process.
运行完成后可查看运行日志了解运行情况
这样,一个简单的测试用例就完成了
Summary:
Automated testing can quickly and automatically complete a large number of test cases, saving manual testing costs. But for projects whose requirements change frequently, a lot of time is needed for maintenance. It is very convenient to use RIDE to write test cases, and it provides a logging function to record in detail various situations that occur during the execution of the use case, so that it is easy to find the error when the use case fails to run.