简体   繁体   English

单元、集成和功能测试

[英]Unit, Integration and Functional Testing

I am working on Test Case and I would like to get clarity about which are the directories & files that come under,我正在研究测试用例,我想弄清楚哪些是目录和文件,

  1. Unit Testing.单元测试。
  2. Integration Testing.集成测试。
  3. Functional Testing.功能测试。

My application architecture is as follows,我的应用架构如下,

  • controllers (which controls the respective action by calling service file from services directory).控制器(通过从服务目录调用服务文件来控制相应的操作)。
  • models (model for data tables).模型(数据表的模型)。
  • routes (for routing).路线(用于路由)。
  • services (a layer that communicates with model).服务(与模型通信的层)。
  • db (holds migration for the database). db(保存数据库的迁移)。
  • index.js (which runs the server). index.js(运行服务器)。

Could anyone help me out by saying which directories & files needs which type of testing (Unit, Integration, Functional)?谁能帮助我说出哪些目录和文件需要哪种类型的测试(单元、集成、功能)?

Thank you.谢谢你。

  1. Unit tests: As the name suggests these tests cover separate units in your code, so each function/file should have it's own separate unit test(s).单元测试:顾名思义,这些测试涵盖了代码中的单独单元,因此每个函数/文件都应该有自己单独的单元测试。 Also you don't use real network and database for these tests, they are stubbed/mocked.此外,您没有为这些测试使用真实的网络和数据库,它们被存根/模拟。
  2. Integration tests: These test working of different modules in integration with each other.集成测试:这些测试不同模块相互集成的工作。 Looking at your architecture, index.js and services seem to be the main modules and controllers, models and routes seem to be helper modules.查看您的架构,index.js 和服务似乎是主要模块,控制器、模型和路由似乎是辅助模块。 So you would be writing tests for index.js and services against a real database and network with configurations same as your application in real life.因此,您将针对真实数据库和网络编写 index.js 和服务的测试,其配置与您在现实生活中的应用程序相同。
  3. Funtional tests: These tests mimick end user experience and they are also called End to End test.功能测试:这些测试模仿最终用户体验,也称为端到端测试。 These tend to be complex to write and not robust as the application changes over time.随着应用程序随着时间的推移而发生变化,这些往往编写起来很复杂并且不健壮。 This entails writing something like selenium tests where all the browser clicks are automated and it is ensured everyhting displays as expected.这需要编写类似 selenium 测试,其中所有浏览器点击都是自动化的,并确保所有内容都按预期显示。 I would suggest to write not to many of these and cover only main scenarios.我建议不要写很多这些,只涵盖主要场景。

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

相关问题 单元测试和集成测试 - Unit testing and Integration testing webdriverio 5用于单元测试和功能测试 - webdriverio 5 for unit testing and functional testing nodeclipse中是否有任何单元测试集成? - Is there any unit testing integration in nodeclipse? 功能/集成测试NodeJS ReST API实现 - Functional/integration testing a NodeJS ReST API implementation 单元测试与Express.js应用程序的集成测试 - Unit testing vs Integration testing of an Express.js app 如何用NodeJ中的模拟实现功能单元测试sinon? - How to implement functional unit testing sinon with mocks in NodeJs? 如何将依赖项注入 Firebase/Google Cloud Functions? (单元和集成测试) - How to inject dependencies into Firebase/Google Cloud Functions? (unit & integration testing) 如何在 Node.js 中使用 Hapi 区分集成测试和单元测试? - How do I separate between integration testing and unit testing using Hapi in Node.js? 单元/集成测试Express REST API,猫鼬,摩卡,sinon,chai,supertest - Unit/Integration testing Express REST API, mongoose, mocha, sinon, chai, supertest 在C#Web应用程序中进行持续集成的VSTS上的TypeScript单元测试 - TypeScript Unit-Testing on VSTS with Continuous Integration in a C# Web Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM