0

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).
  • index.js (which runs the server).

Could anyone help me out by saying which directories & files needs which type of testing (Unit, Integration, Functional)?

Thank you.

  • 1
    This is a pretty common question. You may find more answers here: [1](https://stackoverflow.com/questions/3670729/what-is-the-difference-between-integration-testing-and-functional-testing), [2](https://stackoverflow.com/questions/555899/the-agile-way-integration-testing-vs-functional-testing-or-both), [3](https://stackoverflow.com/questions/5357601/whats-the-difference-between-unit-tests-and-integration-tests), [4](https://stackoverflow.com/questions/10752/what-is-the-difference-between-integration-and-unit-tests) – GOTO 0 Jun 06 '20 at 12:55

1 Answers1

1
  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. 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.
  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. I would suggest to write not to many of these and cover only main scenarios.
mangesh
  • 419
  • 4
  • 16