I have a Node.js application, and it already has Unit Tests and is using the Mocha framework for the same. It is checking the functions individually. These tests are integrated into the CI/CD pipeline in Bamboo, so if there is an error, it will stop the build job and alert the user who has pushed the change.

Now I have a requirement that I need to validate a JSON file, which is available on one of the S3 buckets. It downloads the file once the Node.js application is started in the local environment. I have unit tests to check whether the downloading functionality is working or not and it is working fine.

Now for the validation purpose, I am a little confused about whether I need to add it as a unit test or an integration test. I am new to QA and I would like to do it in the right way.

As of now, there are no integration tests are in place (no tests are checking the API endpoints). It will be helpful if someone can point me in the right direction. Also, it will be helpful if someone can suggest the framework I need to use with Node.js for writing integration tests.

  • How is this file content generated, by your application? Nov 26, 2022 at 8:13
  • @JoãoFarias This is downloaded from AWS S3. I have the code in app.js and so when the app is restarted, it will download the file every time. Nov 27, 2022 at 4:34

2 Answers 2


Whether you need to add the JSON file validation as a unit test or an integration test depends on the nature of the validation.

Unit tests check the functionality of individual units of code in isolation. If the validation of the JSON file is a part of the individual unit of code that downloads it, then it can be considered as a unit test.

Integration tests check how different units of code work together. If the validation of the JSON file depends on other components of the system and the application, then it can be considered as an integration test.

For writing integration tests with Node.js, you can use the following frameworks:

  1. Chai and Supertest - Chai is an assertion library, and Supertest is an HTTP testing library.

  2. Jest - A JavaScript testing framework that is used for unit and integration testing.

  3. Nightwatch.js - A complete end-to-end testing framework for web applications.

  4. Cypress - A JavaScript end-to-end testing framework for web applications.

Choose the one that fits best with your needs and requirements.


If your app downloads a file from S3, this would be an integration test as you are testing your app's intergration with S3.
Regarding the framework, you should use whatever framework you're already using for unit tests. Integration tests are different from unit tests from a logical/component perspective, not a technological one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.