01 Intro
01 Intro
Fall 2024
First…
• Lecture is recorded!
• CCI auto-records all in-person class sections, which occasionally surprises
someone in week 6
Why Are We Here?
• (in this class)
• Many/most of you will go on to write software professionally
• You will be expected to produce software that (mostly) works as
expected
• How do you do that?
• What is “expected”?
• What is “works”?
• What is “mostly”?
Introduction
• Software Testing is a critical element of developing quality software
systems
• It is a systematic approach to judging quality and discovering bugs
• This course presents the theory and practice of software testing
• Topics covered include:
• Black-box and white-box testing, and related test data generation techniques
• Tools for software testing
• Performance testing basics
• Security testing basics
Course Objectives (Officially)
• Understand the concepts and theory related to software testing
• Understand the relationship between black-box and white-box
testing, and know how to apply as appropriate
• Understand different testing techniques used for developing test
cases and evaluating test adequacy
• Learn to use automated testing tools in order to measure code
coverage
Course Objectives (Unofficially)
• Give you a toolbox of approaches to thinking about software quality
• Make sure you understand their trade-offs, to pick the right tool for
the job
• Give you a preview of software quality techniques that are seeing
increasing adoption or increasing relevance
• Including just a taste more speculative techniques
Course Trivia
• Instructor: Dr. Colin S. Gordon
• Email: [email protected]
• Office: 1174
• Office Hours:
• TBD
• By appointment (do not hesitate to do this!)
Why Am I Teaching This Class?
• Because I’m obsessed with things not working
Why Am I Teaching This Class?
Over time, I’ve wondered about:
• “Why doesn’t my garbage collector work?”
• “Why doesn’t my OS kernel work?”
• “Why don’t (any) concurrent programs work?”
• “Why doesn’t my compiler work?”
• Now I wonder about lots of things, but mostly about general
approaches to prevent or detect software defects
Teaching Assistant
• Binh Le ([email protected]) &
Raunaq Malhotra ([email protected])
• TA Hours:
• 6-8pm Tuesdays (Raunaq)
• 6-8pm Wednesdays (Binh)
• 4-6pm Thursdays (Binh)
• If you have slides from prior runs, please delete them
• They’re out of date
• They sometimes result in people emailing *last year’s TAs* for help…
??? Textbook
• The originally intended text was Effective
Software Testing (2021) by Mauricio Aniche
• Roughly half the course is well-covered by
this book
• The other half of the course is not well-
covered by any generalist testing book
• Some material will only be in the lecture
notes
• Library link in syllabus; not the official text
due to… software bugs
Logistics
• Submissions either through BBLearn or Gradescope – TBD!
• Please make sure you hand in all files!
• Need help?
• Office hours: TAs or professor
• General questions about course material, assignments: Discord
• Other questions, like trouble specific to your code: don’t share in Discord!
• Email both the TAs and professor! This improves response time.
• Discord is just for our section of SE320
Lecture Logistics
• Questions during lecture?
• Raise hand
• Can just talk! “Excuse me, can you explain…”
• Please try to avoid eating during lecture if possible
• Generally distracting to peers
• Sometimes really is necessary if your schedule is extreme
Intended Audience
• This course is intended for undergraduate students in Software Engineering
and Computer Science
• If you’re from another major (DS, IS, Math, Game Design, etc.), welcome!
• Pre-requisite: CS260 Data Structures, CS181 Software Engineering
• If you’re here without one of these, email me ASAP
• If you need to brush up on Java, do so now
• Your first assignment goes out next week, though only uses basic Java
• Every year someone who needs to do this, and knows it, doesn’t do it and sets
themselves up for a rough term.
• This includes Java generics.
Attendance
• The University requires attendance
• But, DO NOT come to class if you’re sick!
• I realize these are conflicting messages. But really:
• By default come to class
• If you’re feeling under the weather, be responsible and stay home
• Drop me an email and I’ll make sure you can access the lecture recordings
Grading (Tentative!)
• 5 Assignments(80%)
• Assignment 1 (20%): Open/Closed-box Review & Extension
• Assignment 2 (20%): Design by Contract, Property-Based Testing, & Coverage
• Assignment 3 (20%): Object-Oriented Testing with Mocks (Mockito)
• Assignment 4 (10%): Performance Testing
• Assignment 5 (10%): GUI Testing with Selenium
• Final Report (20%)
Term Grades
• Points-to-letter conversion in the syllabus
• I do not intend to curve the course, homework, or final
Grading Rules
• All grades are final
• There will be no extra credit assignments
• All late work will receive a reduced grade
• -10% per week late
• Maximum of 2 weeks late (after that, no credit)
• Last two assignments are close to the end of the term, and therefore have reduced
late periods
• If you hand in before the deadline, you may not hand in again after
• No extensions will be given beyond the end of the term
• No collaboration is permitted during the exam, and assignments are
individual
Extensions
• I generally prefer not to grant extensions
• But:
• If you have a good reason (e.g., presenting at a conference, student research
competition, interview) and give sufficient notice, I’m open to extensions.
• The tentative deadlines (on Thursdays) are on the syllabus right now.
• If you ask for a last-minute extension for something you would have known about for
a while, you’ll not get an extension
• Of course there are always emergencies.
• My view is that there are many good reasons an extension may be needed,
and I don’t want you to be penalized for unexpected life events. If you think
you have a legitimate reason, ask! The worst I’ll say is no.
Extensions
• To give you a little wiggle-room: you have one no-questions-asked 3
day extension on any homework assignment.
• You use it by simply informing me that you’re planning to use it.
• No permission required!
• Applies to any assignment, even at end of term, and the late policy
starts from the end of the 3 days.
Academic Honesty
• The University’s academic honesty policy is in effect in this course.
Please consult the student handbook for details.
• Higher order bit: Do not hand in work that is not your own, or not
solely your own (modulo help from the professor and TA)
• If you’re not sure if something is cheating, ASK FIRST!
• You’re welcome to help each other understand assignments, but you
shouldn’t be working out pseudocode / test inputs together.
• Cheating is easier to catch than you think
• Even first-time TAs catch it
Validation
How do we ensure the software requirements satisfy the
system’s intended use?
In other words…
Are we building the product correctly?
Are we building the correct product?
Software
A software product is composed of more than just code:
• Administrator manuals
• End-user guides
• Training materials
• Data (databases, audio, video, localization. . . )
When we talk about validating software, we really mean all of these
things.
Software (cont.)
We’ll focus on just the software component: It’s the most technically
challenging.
In the real world, these other components matter as much or more
than the software, and they are not trivial! Respect the work it takes to
do those well!
• Can a non-technical user distinguish between incorrect
documentation, unusable interfaces, and broken functionality?
Who is “We”?
I’ve been speaking for some time now about things “we” can do. . .
who is this “we”?
• It’s not the royal “we”
• It’s not the academic “we”
• It’s US! As developers and testers. . .
Personnel Roles in Software
• Historically, software
development has been rigidly
structured
• Separate roles for manager,
architect, programmers, testers,
…
• Increasingly not the case
• *Especially* in smaller teams and
startups!
• So what’s a tester now?
You May Be A Tester If…
• Your job requirements include identifying software defects
• Your job requirements include producing working code
• Your job requirements include producing secure code
• Your job requirements include. . . code.
Today
This is most of a development team
How Important Is Software Testing?
Note
Doesn’t say eliminate all bugs. This would be wildly
unrealistic for the foreseeable future.
Software Engineering Process &
Testing Recap
Discussion
• What is software engineering?
• Where/when does testing occur in the software
development process?
Development Styles
• Code and Fix
• Waterfall
• Spiral
• Agile
• Scrum
• XP
• Test-Driven Development
• Behavior-Driven Development
Waterfall
Spiral
Corporate
Agile
A Grain of Salt
• Between Waterfall, Spiral, Agile, XP, Scrum, TDD, BDD, and dozens of
other approaches:
• Everyone says they do X
• Few do exactly X
• Most borrow main ideas from X and a few others, then adapt as needed to
their team, environment, or other influences
• But knowing the details of X is still important for communication, planning,
and understanding trade-offs
• Key element of success: adaptability
• The approaches that work well tend to assume bugs and requirements
changes will occur, so plan on revisiting old code
The Original Waterfall Picture
Key Sentence
I believe in this concept, but the implementation described
above is risky and invites failure.
Waterfall Improved
Agile, TDD, Waterfall, Whatever: Same Goals
• Testing has the same goals in any process:
• Check that software behavior matches the spec
• Software needs to do the right thing at release
• Software needs to do (part of) the right thing for intermediate goals and
client check-ins
• Make sure software is a solid basis for further development
• Could be next test in TDD
• Could be next sprint in general agile approaches
• Could be next release if you do literal waterfall
Testing Vocabulary
An Overview of Testing
• We’ve already mentioned many types of testing in passing
• Unit tests
• Integration tests
• System tests
• Usability tests
• Performance tests
• Functional tests
• Nonfunctional tests
• What do these (and more) all mean?
• How do they fit together?
• To talk about these, we need to set out some terminology
Errors, Defects, and Failures
• Many software engineers use the following language to
distinguish related parts of software issues:
• An error is a mistake made by the developer, leading them to
produce incorrect code
• A defect is the problem in the code.
• This is what we commonly call a bug.
• A failure occurs when a defect/bug leads the software to exhibit
incorrect behavior
• Crashes
• Wrong output
• Leaking private information
Errors, Defects, and Failures (cont.)
• Not every defect leads to a failure!
• Some silently corrupt data for weeks and months, and maybe
eventually cause a failure
• Some teams use a distinct term for when a mistake leads to
incorrect internal behavior, separately from external behavior
• Some failures are not caused by defects!
• If you hold an incandescent light bulb next to a CPU, random bits
start flipping. . . .
Forcing Failures with a Light Bulb