框架 端到端 智能问答
Software testing is a fundamental part of the Software Development Life Cycle (SDLC) and any system we develop, we cannot ignore this part of the development pipeline.
软件测试是软件开发生命周期(SDLC)的基本组成部分,对于我们开发的任何系统,我们都不能忽略开发流程的这一部分。
We can see both manual and automation testing in real-life projects. Manual testing is good for small systems but manually testing a large system is something unimaginable. That’s where test automation comes in, allowing us to run thousands of tests for millions of scenarios to check if the system is bug-free or not.
我们可以在实际项目中看到手动和自动化测试。 手动测试对小型系统很有用,但是手动测试大型系统是无法想象的。 这就是测试自动化的用武之地,它使我们可以为数百万个场景运行数千个测试,以检查系统是否无错误。
When we talk about automation testing, there are different types of testing we developer consider while developing a project e.g. Unit Tests, Integration Tests, End to End Tests, etc. Each of these is important for their own reason because they intend to solve a specific type of testing procedure.
当我们谈论自动化测试时,开发人员在开发项目时会考虑不同类型的测试,例如单元测试,集成测试,端到端测试等。由于它们自己的原因,每个原因都很重要,因为它们打算解决特定的问题。测试程序的类型。
什么是端到端测试? (What Is End to End Testing?)
The diagram below can help us understand the whole testing paradigm and where end-to-end testing fits in the whole picture.
下图可以帮助我们理解整个测试范式以及端到端测试在整个图中的适合位置。
Unit tests are the small building blocks of the whole testing service, where we try to test functional units of the system e.g. different services or functions separately in a more isolated environment, not depending on any environment or other part of the system.
单元测试是整个测试服务的小组成部分,我们在其中尝试在更隔离的环境中分别测试系统的功能单元,例如不同的服务或功能,而不依赖于任何环境或系统的其他部分。
Integration tests are one level up and here we integrate different parts/units of the system together and test if they are being integrated properly and working smoothly. Having multiple units connected here makes the process slower than unit tests.
集成测试是一个更高的层次,在这里我们将系统的不同部分/单元集成在一起,并测试它们是否正确集成并且工作顺利。 在这里连接多个单元会使过程比单元测试慢。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/885c2245c92a1c36638d9af985a9f8bc.png)
And finally, end-to-end testing refers to the mechanism where we test the actual flow a user does in the system. Here, our testing client will be treated as a user and does everything e.g. interacting over the pieces, clicking buttons, scrolling pages, navigating around different URLs, etc.
最后,端到端测试是指我们测试用户在系统中执行的实际流程的机制。 在这里,我们的测试客户端将被视为用户,并会执行所有操作,例如在各个部分进行交互,单击按钮,滚动页面,在不同的URL上导航等。
The testing client works like a user, and after taking each step, it checks whether the output/behavior is okay in terms of user perspective. This process is the slowest among others and more end-to-end integrated over different parts of the system.
测试客户端像用户一样工作,并且在执行每个步骤之后,它都会从用户角度检查输出/行为是否正常。 此过程是最慢的过程,并且在系统的不同部分上集成了更多的端到端。
There exist different types of tools, frameworks to do end-to-end testing. Some of them are being used for ages e.g. Selenium but in recent times we have got some popular and dev-friendly tools in the ecosystem to serve our needs on test automation.
存在进行端到端测试的不同类型的工具和框架。 其中一些已经使用了很长时间,例如Selenium,但是最近我们在生态系统中获得了一些流行且易于开发的工具,可以满足我们对测试自动化的需求。
Let’s look into some of these tools/frameworks.
让我们研究其中一些工具/框架。
TestCraft (TestCraft)
For a small company with limited resources, it is difficult to maintain an additional team for quality assurance and testing. TestCraft is the type of tool where we don’t need to write any code, and anyone can use its interface for creating a testing scenario for a specific flow.
对于资源有限的小公司,很难维持额外的团队进行质量保证和测试。 TestCraft是一种工具,不需要编写任何代码,任何人都可以使用其接口来为特定流程创建测试场景。
This awesome codeless tool which is based on Selenium for running regression and continuous tests clearly breaks the software testing bottlenecks for small organizations. TestCraft also comes with AI-powered automation overcoming changes in the app which gives immense velocity to a team by saving time.
这个强大的无代码工具基于Selenium来运行回归和连续测试,显然打破了小型组织的软件测试瓶颈。 TestCraft还具有AI驱动的自动化功能,可以克服应用程序中的更改,从而通过节省时间为团队提供了巨大的速度。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/4b4de3d6efd538fe1ea3ada0132a2cb5.png)
Anyone who doesn’t have coding skills can sign up on TestCraft and create tests by using their drag-and-drop interface and run them on different browsers and environments, simultaneously.
任何不具备编码技能的人都可以在TestCraft上注册并使用其拖放界面创建测试,并同时在不同的浏览器和环境中运行它们。
Maintaining these tests is easier via TestCraft because it creates dynamic test models that update automatically for reflecting the changes to the app.
通过TestCraft维护这些测试更加容易,因为它会创建动态更新的测试模型,这些模型会自动更新以反映应用程序的更改。
Finally, integrating TestCraft with CI/CD pipeline is also very smooth and easy. It enables the teams to achieve continuous testing while pushing code to different test environments and production.
最后,将TestCraft与CI / CD管道集成在一起也非常顺利和容易。 它使团队能够实现连续测试,同时将代码推送到不同的测试环境和生产环境。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/c688aaa80b4c643ed6e26efdf168fd40.png)
柏(Cypress)
Cypress is an open-source modern web automation test framework to make the testing process easier and it’s more than just an end-to-end test automation tool. It can be used to interact with different front-end apps built with React.
赛普拉斯(Cypress)是一个开放源代码的现代Web自动化测试框架,它使测试过程更加容易,并且不仅仅是一个端到端的测试自动化工具。 它可用于与使用React构建的不同前端应用程序进行交互。
Cypress comes with its own test-runner which is easier for debugging when a test fails. Here is a sample cypress test that you can check and when it runs it looks something like this.
赛普拉斯具有自己的测试运行器,当测试失败时,调试器更易于调试。 这是一个示例赛普拉斯测试,您可以检查一下它的运行时间,它看起来像这样。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/fcfe6942a7f1f81205433b879b2786f6.png)
As Cypress runs in the browser, it is easy for it to interact with the DOM and easily check the updates in real-time. It has built-in features like retries and polling which helps to test the modern data-heavy applications.
赛普拉斯在浏览器中运行时,很容易与DOM交互并轻松地实时检查更新。 它具有诸如重试和轮询之类的内置功能,可帮助测试大量现代数据的应用程序。
Installing Cypress in any environment is a piece of cake because it can be installed using NPM and no additional thing is required, and that’s the reason that integrating cypress in CI/CD pipeline is also very snappy!
在任何环境中安装赛普拉斯都是小菜一碟,因为可以使用NPM进行安装,而无需任何其他操作,这就是将赛普拉斯集成到CI / CD管道中也非常快捷的原因!
Cypress has a very low barrier to entry, anyone can jump in and start writing tests.
赛普拉斯的进入门槛非常低,任何人都可以加入并开始编写测试。
Selenium Webdriver (Selenium Webdriver)
Selenium is a classic tool for test automation, so many organizations still use this to do their test-automation. Selenium executes remotely, not like cypress which runs inside the browser, it sends all the underlying remote commands across the network to the webdriver.
Selenium是用于测试自动化的经典工具,因此许多组织仍使用此工具来进行测试自动化。 Selenium是远程执行的,与在浏览器中运行的cypress不同,它会通过网络将所有基本的远程命令发送到webdriver。
By using Selenium we can write our tests in any language. We can integrate Selenium with our backend system and use the same operating system to execute the commands. The main feature that everyone loves about Selenium it, Its testing support across different browsers.
通过使用Selenium,我们可以用任何语言编写测试。 我们可以将Selenium与我们的后端系统集成在一起,并使用相同的操作系统来执行命令。 每个人都喜欢Selenium it的主要功能,它对不同浏览器的测试支持。
The standalone Selenium IDE is very good for developers to work with, also it has cross-browser support! This is useful for visual UI testing and also when we test the responsiveness of an application.
独立的Selenium IDE非常适合开发人员使用,并且具有跨浏览器支持! 这对于视觉UI测试以及我们测试应用程序的响应能力很有用。
Finding visual bugs is easier when we run tests with the Visual Grid, by applying Applitools Root Cause Analysis feature. Also, the Selenium IDE runner can be integrated with CI/CD pipelines.
通过应用Applitools根本原因分析功能,当我们使用Visual Grid运行测试时,查找可视化bug更加容易。 而且,Selenium IDE运行器可以与CI / CD管道集成。
Selenium supports parallel test execution by Grid and which eventually helps us to save execution time and also it consumes fewer hardware resources. It is easier to add this to existing servers.
Selenium支持Grid的并行测试执行,最终可以帮助我们节省执行时间,并且消耗更少的硬件资源。 将其添加到现有服务器更容易。
结论 (Conclusion)
There are a lot of tools in the test-automation ecosystem, but it’s always up to the developers and managers to analyze the requirements of their system and which tool/framework is best suited for the team and the system itself.
测试自动化生态系统中有很多工具,但是开发人员和管理人员始终需要分析他们的系统需求,以及哪种工具/框架最适合团队和系统本身。
If a team starts thinking about integrating automation testing, I would suggest trying codeless tools. This can help the team better understand how the whole automation testing fits in their development pipeline and decide based on that. Test automation can give the development team enough confidence before deploying something in production.
如果团队开始考虑集成自动化测试,则建议尝试使用无代码工具。 这可以帮助团队更好地了解整个自动化测试如何适应他们的开发流程,并据此做出决定。 测试自动化可以使开发团队在生产中部署某些东西之前有足够的信心。
翻译自: https://medium.com/swlh/end-to-end-testing-frameworks-introduction-db35177653a1
框架 端到端 智能问答