Podcast
Questions and Answers
What happens during the Requirements phase? (Select all that apply)
What happens during the Requirements phase? (Select all that apply)
- Interviews with stakeholders (correct)
- Produce a design document
- Craft user stories and use cases (correct)
- Identifying the software languages to use
What happens during the Design phase? (Select all that apply)
What happens during the Design phase? (Select all that apply)
- Produce a design document (correct)
- Determine acceptable software performance
- Start coding
- Layout the architecture of the program (correct)
Which of the following are examples of Non-functional Testing? (Select all that apply)
Which of the following are examples of Non-functional Testing? (Select all that apply)
- Integration Testing
- Unit Testing
- Scalability Testing (correct)
- Performance Testing (correct)
Given the following scenario, identify if it would best be tested manually or with an automated system: You are a game developer and received an angry email from a customer saying they fell through the ground when trying to climb a particular hill.
Given the following scenario, identify if it would best be tested manually or with an automated system: You are a game developer and received an angry email from a customer saying they fell through the ground when trying to climb a particular hill.
Which of the following are reasons testing is important? (Select all that apply)
Which of the following are reasons testing is important? (Select all that apply)
A Fault is a mistake.
A Fault is a mistake.
A Failure occurs because of a 'bug' in the code: a fault.
A Failure occurs because of a 'bug' in the code: a fault.
An Error is a deviation from the expected behavior.
An Error is a deviation from the expected behavior.
What caused the deadly situation with the Therac-25 machine?
What caused the deadly situation with the Therac-25 machine?
Which of the following are examples of Functional Testing? (Select all that apply)
Which of the following are examples of Functional Testing? (Select all that apply)
Unit Testing is when the smallest component of a software system is verified to produce the expected behavior.
Unit Testing is when the smallest component of a software system is verified to produce the expected behavior.
Each unittest test case must include at least one ________.
Each unittest test case must include at least one ________.
Identify the 4 elements to a testing framework.
Identify the 4 elements to a testing framework.
What is the testing framework we use in this course?
What is the testing framework we use in this course?
You can create a test class by right-clicking on the name of the function/class.
You can create a test class by right-clicking on the name of the function/class.
Mocks contain predefined data that is returned when called, but do not imitate behavior.
Mocks contain predefined data that is returned when called, but do not imitate behavior.
___ simulate the behavior of a service and its actions can be verified.
___ simulate the behavior of a service and its actions can be verified.
Given the following code snippet, what goes in the blank? from unittest.mock import Mock
mock = Mock()
Set return_value
mock.abs.______ = '7'
Given the following code snippet, what goes in the blank? from unittest.mock import Mock
mock = Mock()
Set return_value
mock.abs.______ = '7'
Given the following code snippet, what is the output of the print statement? mock = Mock()
mock.func('Hello World')
mock.func('Greetings Planet')
print(mock.func.call_args)
Given the following code snippet, what is the output of the print statement? mock = Mock()
mock.func('Hello World') mock.func('Greetings Planet')
print(mock.func.call_args)
If we wanted to use a mock to trigger an exception, what would we use in the blank? # Mock file reader to control its behavior
open = Mock()
def load_file():
Does absolutely nothing other than raise the desired exception
content = open('temp_file.txt')
if content.length != 0:
return content
return None
class TestCase(unittest.TestCase):
def test_read_file(self):
Test for IOError
open.______ = IOError
This is a context manager that allows us to test for exceptions
with self.assertRaises(IOError):
load_file()
If we wanted to use a mock to trigger an exception, what would we use in the blank? # Mock file reader to control its behavior
open = Mock()
def load_file():
Does absolutely nothing other than raise the desired exception
content = open('temp_file.txt') if content.length != 0: return content return None
class TestCase(unittest.TestCase): def test_read_file(self):
Test for IOError
open.______ = IOError
This is a context manager that allows us to test for exceptions
with self.assertRaises(IOError): load_file()
If we want to override the behavior of an imported item, we need to use patch.
If we want to override the behavior of an imported item, we need to use patch.
Which of the following is called before each test case in a TestCase object?
Which of the following is called before each test case in a TestCase object?
Which of the following is called after all the test cases in a TestCase Object are run (not after each test)?
Which of the following is called after all the test cases in a TestCase Object are run (not after each test)?
The @classmethod used with setUpClass() and tearDownClass() is called a modifier.
The @classmethod used with setUpClass() and tearDownClass() is called a modifier.
Why not just put all the set up steps within each step? It is because we want to keep our code __ ? (3 letters)
Why not just put all the set up steps within each step? It is because we want to keep our code __ ? (3 letters)
Given the following requirements, which would Boundary Testing suggest as good test cases? Valid Password - At least 8 characters - No more than 20 characters - At least 1 special character - At least 1 digit
Given the following requirements, which would Boundary Testing suggest as good test cases? Valid Password - At least 8 characters - No more than 20 characters - At least 1 special character - At least 1 digit
Branch Coverage subsumes Statement Coverage.
Branch Coverage subsumes Statement Coverage.
What is the input domain for the following? The following my_abs function takes a value and returns the absolute value of the passed in val. def my_abs(val): if(val > 0): return val else return -val
What is the input domain for the following? The following my_abs function takes a value and returns the absolute value of the passed in val. def my_abs(val): if(val > 0): return val else return -val
Imagine you are following Test Driven Development and have written your first test for fizz_buzz: def test1(self): input = 1 expected = '1' self.assertEqual(fizz_buzz(input), expected). Using what you know about the steps of TDD fill in the missing line below: def fizz_buzz(num): __________.
Imagine you are following Test Driven Development and have written your first test for fizz_buzz: def test1(self): input = 1 expected = '1' self.assertEqual(fizz_buzz(input), expected). Using what you know about the steps of TDD fill in the missing line below: def fizz_buzz(num): __________.
When using Continuous Integration, every commit to master should be built and tested.
When using Continuous Integration, every commit to master should be built and tested.
To whom does the following piece of advice apply? "If you identify a roadblock, provide a detour"
To whom does the following piece of advice apply? "If you identify a roadblock, provide a detour"
The purpose of Acceptance Testing is for ______ to 'sign off' on if the software meets their expectations.
The purpose of Acceptance Testing is for ______ to 'sign off' on if the software meets their expectations.
Study Notes
CS 362 Study Notes
-
Requirements Phase
- Craft user stories and use cases to capture the software needs.
- Conduct interviews with stakeholders for insights and specifications.
-
Design Phase
- Develop the architectural layout of the software program.
- Generate a design document to outline the software's structure and elements.
-
Non-Functional Testing Examples
- Scalability Testing evaluates how well a system handles growth.
- Performance Testing assesses speed, responsiveness, and stability under load.
-
Testing Methodology
- Situations like game glitches are best tested manually to observe real-time interactions and anomalies.
-
Importance of Testing
- Ensures safety and compliance in critical applications (Life and Death).
- Enhances customer satisfaction, leading to repeat business.
- Reduces financial expenses through the early detection of issues.
- Saves development time by pinpointing problems before they escalate.
-
Concept of Faults and Failures
- A fault refers to a defect in the code; it is not necessarily a mistake.
- A failure is the observable manifestation of a fault, highlighting its impact on program operations.
-
Error Definition
- An error denotes a deviation from the expected behavior and reflects potential software bugs.
-
Therac-25 Incident
- The technician's rapid input of commands contributed to a tragic error in radiation dosage.
-
Functional Testing Examples
- Regression Testing ensures that new code doesn't adversely affect existing functionalities.
- Unit Testing focuses on testing individual parts of the codebase.
-
Unit Testing Details
- Validates the smallest components for expected outcomes, ensuring code integrity.
- Each unit test must include at least one assertion to verify expected results.
-
Elements of a Testing Framework
- Key components include test runner, test case, test fixture, and test suite for structured testing.
-
Testing Framework Used
- Unittest is the framework adopted in this course for structured testing processes.
-
Test Class Creation
- Create a test class through interactive methods like right-clicking the function/class.
-
Mocks in Testing
- Stubs provide predefined responses; mocks simulate behavior and allow for verification of actions.
- The variable
return_value
is used to set return values in mocks.
-
Testing Output
- The output from mock calls tracks the last function call made, aiding in debugging.
-
Triggering Exceptions with Mocks
- Utilize
side_effect
to throw exceptions in testing scenarios to simulate errors.
- Utilize
-
Using Patch
- Patching is necessary to override behaviors of imported modules during tests.
-
Testing Environment Setup
setUp()
runs before each test, whiletearDownClass()
executes after all tests in a class.
-
Code Cleanliness in Testing
- Following the DRY (Don't Repeat Yourself) principle minimizes redundancy in setup code.
-
Boundary Testing in Black Box Testing
- Suggested test cases include minimum and maximum valid input scenarios for password validation.
-
Branch and Statement Coverage
- Branch Coverage encompasses Statement Coverage, providing a thorough testing methodology.
-
Input Domain for Functions
- The
my_abs
function operates on real numbers, returning their absolute values.
- The
-
Test Driven Development (TDD) Steps
- TDD emphasizes writing tests before code, exemplified by defining expected outputs first.
-
Continuous Integration Principle
- Every commit to the master branch must undergo building and testing to ensure robustness.
-
Code Review Guidance
- The advice to provide a detour during roadblocks specifically applies to the Code Reviewer role.
-
Role of Acceptance Testing
- Acceptance Testing allows stakeholders to confirm that the software meets their needs and expectations.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on the various phases of software development with this CS 362 flashcard quiz. Learn about the Requirements and Design phases, including tasks like crafting user stories and laying out architecture. Perfect for students in software engineering or those preparing for exams.