Testing Flashcards

1
Q

Describe the difference between unit testing and integration testing.

A

Unit testing involves testing individual components or units of code in isolation to ensure they function as expected. Integration testing, on the other hand, focuses on testing interactions between these units to verify that they work together correctly as a whole system.

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

What is regression testing, and why is it important?

A

Regression testing involves retesting previously tested software to ensure that recent code changes have not adversely affected existing functionality. It helps prevent the reintroduction of defects or bugs and ensures that the software continues to perform as expected after modifications are made.

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

What is smoke testing, and when is it performed?

A

Smoke testing, also known as build verification testing, is a preliminary test performed on a new build of software to ensure that basic functionality works correctly and the build is stable enough for further testing. It helps identify critical issues early in the development process and ensures that subsequent testing efforts are not wasted on unstable builds.

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

Explain the concept of black-box testing.

A

Black-box testing is a testing technique where testers evaluate the functionality of a software application without knowing its internal implementation details. Testers focus on inputs and outputs, examining how the software behaves based on specified requirements, user interactions, and environmental conditions.

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

Describe the principles of behavior-driven development (BDD).

A

Behavior-driven development (BDD) is an agile software development approach that focuses on defining system behavior from the perspective of end-users or stakeholders. It involves creating scenarios or specifications in natural language using Given-When-Then syntax to describe desired behavior, facilitating collaboration between developers, testers, and business stakeholders.

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

Explain the concept of acceptance testing.

A

Acceptance testing is a type of testing performed to validate that a software application meets specified acceptance criteria and satisfies business requirements. It typically involves end-to-end testing of the entire system to ensure it functions as expected and delivers the intended value to users or stakeholders.

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

Describe the difference between stress testing and load testing.

A

Stress testing involves testing the software application under extreme conditions, such as high load, excessive data volume, or limited system resources, to assess its stability and robustness under adverse conditions. Load testing, on the other hand, involves testing the software’s performance under normal or expected load levels to ensure it can handle concurrent user interactions and transactions efficiently.

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

What are some popular testing frameworks available for Python, and what are their key features?

A

Some popular testing frameworks for Python include unittest, pytest, and nose. Unittest is the built-in testing framework in Python, while pytest and nose offer additional features such as simplified test discovery, fixtures, parameterization, and plugin support, making them flexible and powerful choices for testing Python code.

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

How do you write a simple unit test using the unittest framework in Python?

A

To write a simple unit test using the unittest framework, you typically define a test case class that inherits from unittest.TestCase and write test methods within it. Each test method should start with the word “test” and contain assertions to verify expected behavior.

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

Explain the concept of mocking in Python testing and when it is used.

A

Mocking in Python testing involves replacing real objects or functions with simulated versions (mock objects) to isolate the code being tested and control its behavior. Mocking is used to simulate interactions with external dependencies, such as databases, APIs, or external services, allowing developers to test code in isolation without relying on these dependencies.

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

What are fixtures in pytest, and how do they facilitate testing in Python?

A

Fixtures in pytest are functions that provide setup and teardown logic for tests, allowing developers to define reusable test contexts and resources. Fixtures can be used to initialize test data, set up environment configurations, or establish connections to external services, improving test organization and readability.

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

How do you perform parameterized testing in pytest, and what are its benefits?

A

Parameterized testing in pytest allows developers to run the same test logic with multiple input values, reducing duplication and improving test coverage. It can be achieved using the pytest.mark.parametrize decorator to specify test parameters and values, making tests more expressive and versatile.

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