Testing is a major part of any application development life cycle. There are different types of testing based on the application stage – Unit testing, integration testing, system testing etc. Then there are different types of testing process – Manual testing and Automation Testing.
测试是任何应用程序开发生命周期的重要组成部分。 根据应用程序阶段有不同类型的测试-单元测试,集成测试,系统测试等。然后有不同类型的测试过程-手动测试和自动化测试。
手动测试与自动化测试 (Manual Testing vs Automation Testing)
As the name suggests, manual testing requires human effort in running test cases without the use of any tools. Whereas, automation testing is performed by using some tools and test scripts.
顾名思义,手动测试需要人工来运行测试用例,而无需使用任何工具。 而自动化测试是通过使用一些工具和测试脚本来执行的。
什么是自动化测试? (What is Automation Testing?)
When testing tools like Selenium, QTP, Load Runner etc. are used to write and execute test cases, it’s called Automation Testing.
当使用诸如Selenium,QTP,Load Runner等测试工具来编写和执行测试用例时,称为自动化测试。
什么是功能自动化测试? (What is Functional Automation Testing?)
Functional Automation Testing is the process of identifying various functionalities in the project which need to be repetitively tested and then developing and executing Automation Scripts (Programs) to validate the functionalities.
功能自动化测试是确定项目中需要重复测试的各种功能,然后开发和执行自动化脚本(程序)以验证功能的过程。
自动化测试的优势 (Advantages of Automation Testing)
- Automation vastly increases the test coverage 自动化极大地增加了测试范围
- Automation optimize the testing speed 自动化优化测试速度
- Automation improves the testing quality 自动化提高了测试质量
- Automation reduces the cost of testing 自动化降低了测试成本
- Automation reduces the test execution time 自动化减少了测试执行时间
- Automation does not require Human intervention. We can schedule tests to run overnight without human intervention. 自动化不需要人工干预。 我们可以安排测试在无需人工干预的情况下进行过夜。
- Automation scripts can run at any time and any number of times. 自动化脚本可以随时随地运行。
- Reusability of scripts on other applications. 脚本在其他应用程序上的可重用性。
- Easy to test Stress, Performance and Load 易于测试压力,性能和负载
- Saves manual efforts. 节省了人工。
自动化测试的缺点 (Disadvantages of Automation Testing)
- Debugging the test script is a major issue. It may lead to consequences if any error is present in the test script 调试测试脚本是一个主要问题。 如果测试脚本中存在任何错误,可能会导致后果
- Proficiency is required to write automation test scripts 熟练编写自动化测试脚本
- Test maintenance is costly 测试维护成本高昂
- Maintenance of test data is difficult. 测试数据的维护很困难。
哪些测试用例可以自动化? (Which Test Cases can be Automated?)
Test Cases should be automated if the following conditions are met.
如果满足以下条件,则测试用例应自动化。
- Tests that are used repeatedly 重复使用的测试
- High-Risk test cases 高风险测试案例
- Tests that tend to cause human error 容易引起人为错误的测试
- Test Cases that are impossible to perform manually 无法手动执行的测试用例
- Tests that take lot of time to do manual testing 需要大量时间进行手动测试的测试
- Time consuming test scenarios 耗时的测试方案
- Regression test suites 回归测试套件
- GUI items GUI项目
- Database connections. 数据库连接。
哪些测试用例不应该自动化? (Which Test Cases should Not be Automated?)
- Test Cases for which requires frequent changes 需要经常更改的测试用例
- Test Cases related to UI 与UI相关的测试用例
- Exploratory tests 探索性测试
何时自动化? (When to Automate?)
- When projects are large and critical 当项目很大且至关重要时
- Once application becomes stable 一旦应用稳定
- When enough time is available for testing 有足够的时间进行测试时
- When frequent regression testing needed 需要频繁进行回归测试时
- When manual works are high. 当手工工作很高时。
什么时候不自动化? (When not to Automate?)
- When application not even tested manually atleast once 如果甚至没有手动测试过一次应用程序
- When requirements changing frequently 当需求经常变化时
- When there is no much regression 当没有太多回归
- When there is no time and resource constraint. 没有时间和资源的限制。
Note: Automation Testing is additional support to speed up the testing activity but not for replacement of Manual Testing because everything cannot be automated.
注意 :自动化测试是额外的支持,可以加快测试活动,但不能替代手动测试,因为所有内容都无法实现自动化。
如何决定要自动化什么而不要自动化 (How to decide what to Automate and what not to Automate)
Feature | Programmable | Testing Frequency | Cost | Automation |
---|---|---|---|---|
F1 | ✔ | High | High | ✔ |
F2 | ✔ | Low | High | ✖ |
F3 | ✔ | High | Low | ✔ |
F4 | ✔ | Low | Low | ✖ |
F5 | ✖ | ✖ | ✖ | ✖ |
特征 | 可编程的 | 测试频率 | 成本 | 自动化 |
---|---|---|---|---|
F1 | ✔ | 高 | 高 | ✔ |
F2 | ✔ | 低 | 高 | ✖ |
F3 | ✔ | 高 | 低 | ✔ |
F4 | ✔ | 低 | 低 | ✖ |
F5 | ✖ | ✖ | ✖ | ✖ |
自动化测试工具 (Automation Testing Tools)
- Selenium Selenium
- QTP(UFT) QTP(UFT)
- RFT RFT
- Test Partner 测试伙伴
- Silk Test 真丝测试
QTP, RFT, Silk test are Licensed tools and whereas Selenium is an open source tool.
QTP,RFT,Silk测试是许可工具,而Selenium是开放源代码工具。
自动化测试流程 (Automation Testing Process)
Following steps are followed in an Automation Process:
自动化过程中遵循以下步骤:
- Automation Test Planning 自动化测试计划
- Test Environment Setup 测试环境设置
- Analyze test cases 分析测试用例
- Developing test scripts 开发测试脚本
- Enhance test scripts 增强测试脚本
- Scripts debugging 脚本调试
- Scripts execution 脚本执行
- Analyze test results 分析测试结果
- Defect reporting 缺陷报告
自动化测试工具选择标准 (Automation Testing Tool Selection Criteria)
Selecting an automation tool largely depends on application technology. However, some other points to consider while selecting an automation tool are:
选择自动化工具在很大程度上取决于应用技术。 但是,在选择自动化工具时要考虑的其他几点是:
- Cost(License Price) 费用(许可证价格)
- Features 特征
- Technology support 技术支持
- Performance 性能
- Maintenance 保养
规划,设计与开发 (Planning, Design and Development)
During this phase, Tester creates an automation test strategy and plan, with the following details:
在此阶段,Tester会创建自动化测试策略和计划,其中包含以下详细信息:
- Automation tool selection 自动化工具选择
- Automation Framework design and its features 自动化框架设计及其功能
- In-Scope features to be tested of automation 范围内功能需要进行自动化测试
- Out-of-Scope features to be tested of automation 自动化测试之外的功能
- Automation testbed preparation 自动化测试台准备
- Schedule and Timeline for scripts generation and execution 脚本生成和执行的时间表和时间表
- Deliverables of Test Automation 测试自动化的交付物
测试执行 (Test Execution)
In this phase, automation scripts are executed written by testers. To execute the scripts we need input test data before testers run the tests. Once scripts execution completes testers provide detailed test reports.
在此阶段,自动化脚本由测试人员执行。 要执行脚本,我们需要在测试人员运行测试之前输入测试数据。 脚本执行完成后,测试人员将提供详细的测试报告。
保养 (Maintenance)
As new functionalities added each time to the System Under Test with successive cycles, Automation Scripts need to be added, reviewed and maintained for each test cycle release. Maintenance becomes necessary in order to improve the effectiveness of Automation Scripts.
由于每次都有连续的周期向被测系统添加新功能时,需要为每个测试周期版本添加,检查和维护自动化脚本。 为了提高自动化脚本的有效性,必须进行维护。
自动化框架 (Framework for Automation)
A framework is a set of guidelines which helps us in
框架是一组准则,可以帮助我们
- Less Maintenance of code 减少代码维护
- Maintaining consistency in overall testing 保持整体测试的一致性
- Improves test structure 改善测试结构
- Minimum code utilization 最低代码使用率
Types of frameworks used in automation testing:
自动化测试中使用的框架类型:
- Keyword Driven Framework 关键字驱动框架
- Data Driven Framework 数据驱动框架
- Modular Framework 模块化框架
- Hybrid Framework 混合框架
可以自动化的测试类型 (Types of testing that can be automated)
- Unit Testing 单元测试
- Integration Testing 整合测试
- Functional Testing 功能测试
- Smoke Testing 烟雾测试
- Regression Testing 回归测试
结论 (Conclusion)
If testing is one time needed then we should go for manual testing. If testing is frequently needed then we should go for automation testing. The right automation tool selection, testing process and right selection of the testing team are the key players for automation testing to be successful.
如果需要一次测试,那么我们应该进行手动测试。 如果经常需要测试,那么我们应该进行自动化测试。 正确的自动化工具选择,测试过程以及测试团队的正确选择是自动化测试成功的关键因素。