Testing Flashcards
What is a unit test?
It focuses on testing a single, isolated piece of functionality, like a function, method, or class, to ensure it behaves as expected
What is an integration test?
An integration test is a type of software testing that evaluates the interaction between different modules or services to ensure they work together as expected.
True or False: Unit tests are typically faster to run than integration tests.
True
Fill in the blank: Unit tests are usually written to test __________.
individual functions or methods
In a Node.js backend, which testing framework is commonly used for unit tests?
Jest
What is a common tool for integration testing in a Node.js environment?
Supertest
Multiple Choice: Which of the following is a benefit of unit testing? A) Increased code coverage B) Identifying integration issues C) Testing user interface
A) Increased code coverage
True or False: Integration tests can help identify issues that unit tests might miss.
True
What is the primary goal of unit testing?
To ensure that individual components work correctly in isolation.
What does the term ‘mocking’ refer to in unit testing?
Mocking refers to creating simulated objects or functions to mimic the behavior of real ones in a controlled way.
Fill in the blank: Integration tests often require a __________ environment to simulate real-world usage.
more complex
What is the difference between black-box testing and white-box testing?
Black-box testing focuses on input and output without knowledge of internal code, while white-box testing involves understanding the internal workings of the application.
Multiple Choice: Which testing type is generally more focused on the application’s architecture? A) Unit Testing B) Integration Testing C) Both
B) Integration Testing
True or False: Unit tests should be written after the code is implemented.
False
What is a common practice for organizing unit tests in a Node.js project?
Organizing them in a dedicated ‘tests’ or ‘__tests__’ directory.
Fill in the blank: Integration tests often require a __________ database setup.
real or test