Testing Flashcards

1
Q

What is a unit test?

A

It focuses on testing a single, isolated piece of functionality, like a function, method, or class, to ensure it behaves as expected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an integration test?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False: Unit tests are typically faster to run than integration tests.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: Unit tests are usually written to test __________.

A

individual functions or methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In a Node.js backend, which testing framework is commonly used for unit tests?

A

Jest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a common tool for integration testing in a Node.js environment?

A

Supertest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A) Increased code coverage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: Integration tests can help identify issues that unit tests might miss.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the primary goal of unit testing?

A

To ensure that individual components work correctly in isolation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the term ‘mocking’ refer to in unit testing?

A

Mocking refers to creating simulated objects or functions to mimic the behavior of real ones in a controlled way.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Fill in the blank: Integration tests often require a __________ environment to simulate real-world usage.

A

more complex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between black-box testing and white-box testing?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Multiple Choice: Which testing type is generally more focused on the application’s architecture? A) Unit Testing B) Integration Testing C) Both

A

B) Integration Testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: Unit tests should be written after the code is implemented.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a common practice for organizing unit tests in a Node.js project?

A

Organizing them in a dedicated ‘tests’ or ‘__tests__’ directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Fill in the blank: Integration tests often require a __________ database setup.

A

real or test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a key disadvantage of unit tests?

A

They do not test the interactions between components.

18
Q

Multiple Choice: What is the purpose of test coverage tools? A) To run tests B) To measure how much of the code is tested C) To mock dependencies

A

B) To measure how much of the code is tested

19
Q

What is the role of a test runner in Node.js testing?

A

A test runner executes tests and reports the results.

20
Q

True or False: Integration tests can be run independently of unit tests.

A

True

21
Q

What is the typical execution time difference between unit tests and integration tests?

A

Unit tests are typically executed in milliseconds, while integration tests can take seconds or longer.

22
Q

Fill in the blank: Both unit tests and integration tests are essential for __________ quality assurance.

A

software

23
Q

What is a common practice to follow when writing unit tests?

A

Writing tests that are independent and can run in any order.

24
Q

Multiple Choice: Which testing type is best for catching regressions? A) Unit Testing B) Integration Testing C) Both

A

C) Both

25
Q

What does ‘test-driven development’ (TDD) involve?

A

Writing tests before writing the code that needs to be tested.

26
Q

What is a key advantage of integration testing?

A

It helps ensure that different parts of the application work together as intended.

27
Q

What is the main focus of unit tests?

A

Unit tests focus on testing the logic of individual components in isolation, without involving external dependencies.

28
Q

What is the main focus of integration tests?

A

Integration tests focus on ensuring that different parts of the system, such as controllers, services, and databases, collaborate and integrate seamlessly.

29
Q

What is the purpose of end-to-end (E2E) tests?

A

E2E tests validate the entire application workflow, ensuring it works as a whole from a user’s perspective.

30
Q

What do functional tests ensure?

A

Functional tests ensure that specific features or functions of the software meet the requirements.

31
Q

What are acceptance tests?

A

Acceptance tests verify that the software meets business requirements and satisfies end-user needs.

32
Q

What is the focus of performance tests?

A

Performance tests evaluate the speed, responsiveness, and stability of the application under various conditions.

33
Q

What is the purpose of load testing (a type of performance test)?

A

Load testing checks how the application performs under expected levels of traffic.

34
Q

What is stress testing?

A

Stress testing evaluates the application’s behavior under extreme or breaking-point conditions.

35
Q

What do regression tests aim to prevent?

A

Regression tests ensure that new changes or updates do not break existing functionality.

36
Q

What are smoke tests?

A

Smoke tests quickly verify basic functionality to determine if the application is stable enough for further testing.

37
Q

What is the difference between sanity tests and smoke tests?

A

Sanity tests focus on validating specific fixes or small changes, while smoke tests check the overall stability.

38
Q

What do UI tests focus on?

A

UI tests validate the appearance and behavior of user interface elements.

39
Q

What is the purpose of security tests?

A

Security tests identify vulnerabilities and ensure the application is protected from threats like SQL injection or XSS attacks.

40
Q

What do compatibility tests ensure?

A

Compatibility tests ensure the application works across different browsers, devices, and operating systems.

41
Q

What are alpha and beta tests?

A

Alpha tests are conducted in a controlled environment by internal teams, while beta tests involve real users before the public release.