简体   繁体   English

UI级别测试和API级别测试有什么区别?

[英]What's difference between UI level testing and API level testing?

I got this question while interviewing some companies.我在采访一些公司时遇到了这个问题。 I don't think I answer the question well.我觉得我不能很好地回答这个问题。 However, based on my understanding:但是,根据我的理解:

The UI level testing is more about the what end user will see and would be better to use for acceptance testing. UI 级别测试更多的是关于最终用户将看到的内容,并且更适合用于验收测试。

The API level test is good for performance testing, since it's easier to simulate multiple users to access the resource at the same time. API 级别测试非常适合性能测试,因为它更容易模拟多个用户同时访问资源。 And, it's easier to look at where the problem will be.而且,更容易查看问题出在哪里。

Can anyone give me more detail about that?谁能给我更多的细节? And when should we choose to use which type of testing??我们什么时候应该选择使用哪种类型的测试? Thanks a lot.非常感谢。

UI stands for User Interface. UI代表用户界面。 UI allows the user to interact with the application. UI 允许用户与应用程序交互。

UI testing refers to testing graphical user interfaces, such as how user interacts with the application, testing application elements like fonts, layouts, buttons, images, colors, etc. Basically, UI testing concentrates on the look-and-feel of an application. UI 测试是指测试图形用户界面,例如用户如何与应用程序交互,测试应用程序元素,如字体、布局、按钮、图像、颜色等。基本上,UI 测试集中在应用程序的外观和感觉上。

For more details on API testing, see:有关 API 测试的更多详细信息,请参阅:

http://www.guru99.com/gui-testing.html

API is an acronym for Application Programming Interface. API 是应用程序编程接口的首字母缩写词。 API enables communication between two separate software systems. API 支持两个独立软件系统之间的通信。 A software system implementing an API contains functions/sub-routines which can be executed by another software system.实现 API 的软件系统包含可由另一个软件系统执行的函数/子例程。

API testing is checking API of a Software System. API 测试是检查软件系统的 API。 In order to check the API , it needs to be called from the calling software .为了检查 API,需要从调用软件调用它。 Necessary test environment, database, server, application setup needs to be prepared before doing API Testing.在进行 API 测试之前,需要准备必要的测试环境、数据库、服务器、应用程序设置。

API testing is focused on the functionality of the business logic (such as a calculating total price) and it is entirely different from UI testing. API 测试侧重于业务逻辑的功能(例如计算总价),它与 UI 测试完全不同。 It mainly concentrates on the business logic layer of the software architecture.它主要集中在软件架构的业务逻辑层。 This testing won't concentrate on the look and feel of an application.此测试不会集中在应用程序的外观和感觉上。

For more details on API testing, see:有关 API 测试的更多详细信息,请参阅:

http://www.guru99.com/api-testing.html http://www.guru99.com/api-testing.html

Eric埃里克

In few words:简而言之:

UI testing is testing between users (humans in most cases) and front end or client side (aka presentation logic) of the application such as a browser. UI 测试是在用户(在大多数情况下是人类)和应用程序(例如浏览器)的前端或客户端(又名表示逻辑)之间进行的测试。

API testing is testing between backend or server side of the application (aka business logic) and backend of another application. API 测试是在应用程序的后端或服务器端(也称为业务逻辑)与另一个应用程序的后端之间进行测试。

Testing at the API layer enables the robust, low-noise regression tests that are essential for continuous testing. API 层的测试可实现稳健、低噪声的回归测试,这对于持续测试至关重要。 It also helps you zero in on problems that might not be evident from the UI level — for example, an error in writing the expected values to the database.它还可以帮助您将在 UI 级别上可能不明显的问题归零——例如,将预期值写入数据库时​​出错。

GUI Testing--testing on visible elements in pages or screens called as Gui testing.some other names to GUI are Sites testing/ front end testing/ screens testing. GUI 测试——对页面或屏幕中的可见元素进行测试,称为 Gui 测试。GUI 的其他一些名称是站点测试/前端测试/屏幕测试。

API testing --Testing on invisible services functionalities called as API testing. API 测试——对称为 API 测试的隐形服务功能进行测试。 other names to API are Services testing/ middleware Testing/SOA testing. API 的其他名称是服务测试/中间件测试/SOA 测试。

End-to-End Testing --testing related to integration of a site and a service is called as End-to-End testing.端到端测试——与站点和服务集成相关的测试称为端到端测试。 other names are Inter System testing/ interoperability testing.其他名称是系统间测试/互操作性测试。

In everyday testing, basicly there are three uses for API testing from the testers' point of view.在日常测试中,从测试人员的角度来看,API测试基本上有三种用途。

  1. When an application is brand new, and the backend is ready/being developed, and there is no GUI yet, that is when API is tested.当一个应用程序是全新的,并且后端已经准备好/正在开发中,并且还没有 GUI 时,即测试 API 的时候。 Also when the new functionality is newly developed, and is not yet deployed to the GUI ready code base.此外,当新功能是新开发的,并且尚未部署到 GUI 就绪代码库时。 This is usually the phase of the project that most, and highest priority business requirements are implemented in the code.这通常是项目中大多数、最高优先级的业务需求在代码中实现的阶段。
  2. When you encounter a API call error in your browser's DevTools, it could be usefull to test different API resources.当您在浏览器的 DevTools 中遇到 API 调用错误时,测试不同的 API 资源可能很有用。
  3. When the tester reports a defect, in the defect ticket, the developers post in the result of new fix, or operations the result of the fix/configuration in the environment, as a quick check of the isolated functionality.当测试人员报告缺陷时,开发人员会在缺陷单中发布新修复的结果,或在环境中操作修复/配置的结果,作为对隔离功能的快速检查。

But in general, once a GUI is ready, usually API testing in not needed, at least for testers.但一般来说,一旦 GUI 准备就绪,通常不需要进行 API 测试,至少对于测试人员来说是这样。 Of course for developers, it is useful to test new functionalities, as a higher level testing (integration testing) after unit tests.当然对于开发人员来说,测试新功能很有用,作为单元测试之后的更高级别的测试(集成测试)。

Instead of going into a long explanation, where you can find volumes written on the Internet, let me give you a couple of additional keywords.与其进行冗长的解释,您可以在 Internet 上找到所写的卷,让我给您几个额外的关键字。 For UI testing, also look at FUNCTIONAL and EXPLORATORY testing.对于 UI 测试,还可以查看 FUNCTIONAL 和 EXPLORATORY 测试。 For API, also look at UNIT and AUTOMATED testing.对于 API,还要查看 UNIT 和 AUTOMATED 测试。

I find this resource useful http://www.stickyminds.com/testandevaluation.asp?Function=FEATUREDETAIL&ObjectId=17275我发现这个资源很有用http://www.stickyminds.com/testandevaluation.asp?Function=FEATUREDETAIL&ObjectId=17275

Pick the one your boss will give you a promotion for.选择一个你的老板会给你升职的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM