自学内容网 自学内容网

990-30产品经理:The different types of software testing 不同类型的软件测试

Compare different types of software testing, such as unit testing, integration testing集成测试, functional testing, acceptance testing验收测试, and more!
比较不同类型的软件测试,如单元测试、集成测试、功能测试、验收测试等等!

There are numerous很多的 types of software testing techniques that you can use to ensure changes to your code work as expected. Not all testing is equal though, and we explore how some testing practices differ.
有许多类型的软件测试技术,您可以使用它们来确保对代码的更改按预期工作。然而,并非所有的测试都是相同的,我们将探讨一些测试实践是如何不同的。

Manual vs. Automated testing 手动测试与自动测试

It’s important to make the distinction区别 between manual and automated tests. Manual testing is done in person, by clicking through the application or interacting相互作用 with the software and APIs with the appropriate tooling. This is very expensive since it requires someone to setup an environment and execute the tests themselves, and it can be prone to human error as the tester might make typos or omit steps in the test script.
Automated tests, on the other hand, are performed by a machine that executes a test script that was written in advance. These tests can vary in complexity, from checking a single method in a class to making sure that performing a sequence of complex actions in the UI leads to the same results. It’s much more robust and reliable than manual tests – but the quality of your automated tests depends on how well your test scripts have been written. If you’re just getting started with testing, you can read our continuous integration tutorial持续集成教程 to help you with your first test suite第一个测试套件. Looking for more testing tools? Check out these DevOps testing tutorials.
Automated testing is a key component of continuous integration and continuous delivery and it’s a great way to scale your QA process as you add new features to your application. But there’s still value in doing some manual testing with what is called exploratory testing as we will see in this guide.
区分手工测试和自动化测试是很重要的。手动测试是通过单击应用程序或使用适当的工具与软件和API交互来亲自完成的。这是非常昂贵的,因为它需要有人设置一个环境并自己执行测试,而且它很容易出现人为错误,因为测试人员可能会在测试脚本中输入错误或遗漏步骤。
另一方面,自动化测试是由执行预先编写的测试脚本的机器来执行的。这些测试的复杂性各不相同,从检查类中的单个方法,到确保在UI中执行一系列复杂操作会产生相同的结果。它比手工测试更加健壮和可靠——但是自动化测试的质量取决于测试脚本编写得有多好。如果你刚刚开始测试,你可以阅读我们的持续集成教程,以帮助你的第一个测试套件。寻找更多的测试工具?查看这些DevOps测试教程。
自动化测试是持续集成和持续交付的关键组成部分当您向应用程序添加新特性时,这也是扩展QA过程的好方法。但是,正如我们将在本指南中看到的那样,用所谓的探索性测试进行一些手工测试仍然是有价值的。

The different types of tests 不同类型的测试

  1. Unit tests
    Unit tests are very low level and close to the source of an application. They consist in testing individual methods and functions of the classes, components, or modules used by your software. Unit tests are generally quite cheap to automate and can run very quickly by a continuous integration server.

  2. 单元测试
    单元测试是非常低级的,非常接近于应用程序的源代码。它们包括测试您的软件所使用的类、组件或模块的各个方法和功能。单元测试自动化的成本通常很低,并且可以通过持续集成服务器非常快速地运行。

  3. Integration tests
    Integration tests verify that different modules or services used by your application work well together. For example, it can be testing the interaction with the database or making sure that microservices work together as expected. These types of tests are more expensive to run as they require multiple parts of the application to be up and running.

  4. 集成测试
    集成测试验证应用程序使用的不同模块或服务是否能够很好地协同工作。例如,可以测试与数据库的交互,或确保微服务按预期协同工作。这些类型的测试运行起来成本更高,因为它们需要启动和运行应用程序的多个部分。

  5. Functional tests
    Functional tests focus on the business requirements of an application. They only verify the output of an action and do not check the intermediate states of the system when performing that action.
    There is sometimes a confusion between integration tests and functional tests as they both require multiple components to interact with each other. The difference is that an integration test may simply verify that you can query the database while a functional test would expect to get a specific value from the database as defined by the product requirements.

  6. 功能测试
    功能测试关注的是应用程序的业务需求。它们只验证操作的输出,而不检查执行该操作时系统的中间状态。
    有时会混淆集成测试和功能测试,因为它们都需要多个组件相互交互。不同之处在于,集成测试可能只是验证您可以查询数据库,而功能测试期望从数据库中获得产品需求所定义的特定值。

  7. End-to-end tests
    End-to-end testing replicates a user behavior with the software in a complete application environment. It verifies that various user flows work as expected and can be as simple as loading a web page or logging in or much more complex scenarios verifying email notifications, online payments, etc…
    End-to-end tests are very useful, but they’re expensive to perform and can be hard to maintain when they’re automated. It is recommended to have a few key end-to-end tests and rely more on lower level types of testing (unit and integration tests) to be able to quickly identify breaking changes.

  8. 端到端测试
    端到端测试在一个完整的应用程序环境中使用软件复制用户行为。它可以验证各种用户流是否按预期工作,可以像加载网页或登录一样简单,也可以验证电子邮件通知、在线支付等更复杂的场景。
    端到端测试是非常有用的,但是执行它们的代价很高,并且当它们被自动化时很难维护。建议进行一些关键的端到端测试,更多地依赖于较低级别的测试类型(单元测试和集成测试),以便能够快速识别破坏性的更改。

  9. Acceptance testing
    Acceptance tests are formal tests that verify if a system satisfies business requirements. They require the entire application to be running while testing and focus on replicating user behaviors. But they can also go further and measure the performance of the system and reject changes if certain goals are not met.

  10. 验收测试
    验收测试是验证系统是否满足业务需求的正式测试。它们要求整个应用程序在测试时运行,并专注于复制用户行为。但他们也可以更进一步,衡量系统的性能,如果某些目标没有达到,则拒绝更改。

  11. Performance testing
    Performance tests evaluate how a system performs under a particular workload. These tests help to measure the reliability, speed, scalability, and responsiveness of an application. For instance, a performance test can observe response times when executing a high number of requests, or determine how a system behaves with a significant amount of data. It can determine if an application meets performance requirements, locate bottlenecks, measure stability during peak traffic, and more.

  12. 性能测试
    性能测试评估系统在特定工作负载下的执行情况。些测试有助于衡量应用程序的可靠性、速度、可伸缩性和响应性。例如,性能测试可以观察执行大量请求时的响应时间,或者确定系统在处理大量数据时的行为。它可以确定应用程序是否满足性能要求、定位瓶颈、测量峰值流量期间的稳定性等。

  13. Smoke testing
    Smoke tests are basic tests that check the basic functionality of an application. They are meant to be quick to execute, and their goal is to give you the assurance that the major features of your system are working as expected.
    Smoke tests can be useful right after a new build is made to decide whether or not you can run more expensive tests, or right after a deployment to make sure that they application is running properly in the newly deployed environment.

  14. 发烟试验
    冒烟测试是检查应用程序基本功能的基本测试。它们旨在快速执行,其目标是确保系统的主要特性按预期工作。
    在进行新构建之后,冒烟测试可以用于决定是否可以运行更昂贵的测试,或者在进行部署之后,可以用于确保应用程序在新部署的环境中正常运行。

How to automate your tests 如何自动化你的测试

To automate your tests, you will first need to write them programmatically using a testing framework that suits your application. PHPUnit, Mocha, RSpec are examples of testing frameworks that you can use for PHP, Javascript, and Ruby respectively. There are many options out there for each language so you might have to do some research and ask developer communities to find out what would be the best framework for you.
When your tests can be executed via script from your terminal, you can have them be automatically executed by a continuous integration server like Bamboo or use a cloud service like Bitbucket Pipelines. These tools will monitor your repositories and execute your test suite whenever new changes are pushed to the main repository.
If you’re just getting started with testing, you can read our continuous integration tutorial to help you with your first test suite.
为了使测试自动化,您首先需要使用适合您的应用程序的测试框架以编程方式编写测试。PHPUnit,摩卡RSpec是可以分别用于PHP、Javascript和Ruby的测试框架示例。每种语言都有很多选择因此,您可能需要做一些研究,并向开发者社区寻求最适合您的框架。
当您的测试可以通过终端脚本执行时,您可以让持续集成服务器(如Bamboo)或云服务(如Bitbucket Pipelines)自动执行测试。这些工具将监视您的存储库,并在新的更改被推送到主存储库时执行您的测试套件。
如果你刚刚开始测试,你可以阅读我们的持续集成教程,以帮助你的第一个测试套件。

Exploratory testing 探索性测试

The more features and improvements go into your code, the more you’ll need to test to make sure that all your system works properly. And then for each bug you fix, it would be wise to check that they don’t get back in newer releases. Automation is key to make this possible and writing tests sooner or later will become part of your development workflow.
So the question is whether it is still worth doing manual testing? The short answer is yes and it might be best to perform exploratory testing to uncover non-obvious errors.
An exploratory testing session should not exceed two hours and should have a clear scope to help testers focus on a specific area of the software. Once all testers have been briefed, various actions should be used to check how the system behaves.
代码中的特性和改进越多,您就越需要进行测试,以确保所有系统都能正常工作。然后对于你修复的每一个bug,明智的做法是检查它们是否不会在新的版本中恢复。自动化是实现这一目标的关键,编写测试迟早会成为开发工作流程的一部分。
那么问题来了,是否还值得做手工测试呢?简短的回答是肯定的,最好执行探索性测试来发现非明显的错误。
一次探索性测试的时间不应该超过两个小时,并且应该有一个明确的范围,以帮助测试人员专注于软件的某个特定领域。一旦所有的测试人员都被告知了,各种各样的行为应该被用来检查系统的行为。

A note about testing 关于测试的一点说明

To finish this guide, it’s important to talk about the goal of testing. While it’s important to test that users can actually use an application (they can log in and save an object), it is equally important to test that an application doesn’t break when bad data or unexpected actions are performed. You need to anticipate what would happen when a user makes a typo, tries to save an incomplete form, or uses the wrong API. You need to check if someone can easily compromise data or gain access to a resource they’re not supposed to. A good testing suite should try to break your app and help understand its limit.
And finally, tests are code too! So don’t forget them during code review as they might be the final gate to production.
Atlassian’s Open DevOps provides an open toolchain platform that allows you to build a CD-based development pipeline with the tools you love. Learn how Atlassian and third-party tools can integrate testing in your workflow with our DevOps testing tutorials.
在完成本指南之前,讨论一下测试的目标是很重要的。虽然测试用户实际上可以使用一个应用程序是很重要的(他们可以登录并保存一个对象),同样重要的是测试应用程序在坏数据或执行意外操作时不会中断。您需要预测当用户输入错误、试图保存不完整的表单或使用错误的api时会发生什么情况。您需要检查是否有人可以轻松地破坏数据或访问他们不应该访问的资源。一个好的测试套件应该尝试打破你的应用,并帮助了解它的局限性。
最后,测试也是代码!所以在代码审查期间不要忘记它们,因为它们可能是进入生产的最后一关。
Atlassian的Open DevOps提供了一个开放的工具链平台,允许您使用您喜爱的工具构建基于CD的开发管道。通过我们的DevOps测试教程,了解Atlassian和第三方工具如何将测试集成到您的工作流程中。


原文地址:https://blog.csdn.net/CSDNXXCQ/article/details/136448565

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!