Quality Assurance & Testing
Overview
What We’ll Cover
QA Basics
Soft Skills
Risk Analysis
QA Process & Products
Testing
Unit Testing
QA Basics
Why do companies hire QA?
To save money
To increase confidence
To have smoother releases
What is the return of investment for QA?
Happier customers
Less wasted time
Problems avoided
Fewer bugs on final project
QA Organization
- Solo QA
One (or just a few) for the whole organization, common with startups, small in-house teams
- QA Team
A team of several QA working for a dev department, common in “waterfall” based dev shops, or more traditional organizations
- Embedded QA
1-2 QA staff in a small dev team, usually between 1:2 and 1:4 QA:dev, common in more “agile” environments, or where there are several smaller products
What does QA do?
Prevent errors and defects
Test software (manually and programmatically)
Write documentation
Communicate and work with team to prevent and fix issues
V-Model
A way to looks at how testing integrates with software development life cycles
Illustrates how the work builds in layers
QA Soft Skills
Soft Skills
Personal attributes that enable effective interaction
As opposed to hard skills (like tech knowledge and ability)
Very important in QA since you have to ask lots of questions and deliver bad news
Build Understanding
Get ahead of issues, build your reputation first
Trustworthy
Patient
Reliable
Valuable
Breathe
When you find something scary:
It’s probably not as bad as you think.
Stay on track; the only way forward is through
These are the BEST opportunities for growth
Risk Analysis
What is it?
Figuring out where the potential problems are and how important they are.
What we figure out
How bad could it be?
Do we need eyes on that?
How to
Make a list of what ifs
Estimate level of risk (Cost * Likelihood)
Prioritize
QA Process & Products
QA Process
Planning
Testing
Communication (reporting)
Following up
Planning
Figuring out what needs to be tested
Product: Test Plan
Testing
Actually doing the testing, whether manually or with code
Products: Test Cases, Bug Reports, Code
Test Case
Bug Reports
The product most seen by those outside of QA
Clear description.
Steps to reproduce.
Expected & actual results.
Supporting items (screenshots, videos, logs)
Communication
Sharing test findings and the products with our teams
Super important to communicate well so that the right problems get looked at and fixed in a timely manner
Following Up
Making sure that things are fixed
This is an iterative process, so these last two steps are really important
Updating test cases, bug reports, and any other documentation as you go
Testing
The part of the whole process QA is best known for, and justifiably so.
What is testing?
At its core, checking to see if expectations are met.
QA doesn’t settle for that though; if there is a problem, we should isolate the root cause to prevent that issue in the future.
What do we test?
Most often, software
Documentation
Processes
etc.
Test Driven Development
Writing tests before the rest of our code.
This puts expectations first, so that we can write code that will pass tests, and thus meet expectations.
If our code passes the tests, then we can move on. Otherwise, we need to refactor our code until it passes.
Benefits of testing
You know exactly what you expect to happen right from the start. This reduces debugging time as it allows you to develop in a more isolated environment
Allows you to think through your logic beforehand and find any holes you may not have intended.
Types of Testing
Functional Testing
This is the type of testing most people think of
Most standard tests are functional
Ask the question Does it do what it should?
Exploratory Testing
Exploratory pretty much what it sounds like
Set a 15 minute timer and test away
No test cases no rules just getting used to the application you’re testing
Great way to find things you wouldn’t have thought of testing
Regression Testing
Or making sure what worked before still works
When you fix a bug you normally end up with a bug or two in places they didn’t exist before
Make sure that your regression tests are detailed
This is where automation becomes our best friend
Confirmation Testing
Part of following up
Did the bug fix work?
Non-Functional
Not concerned with whether software gives us the right outcome
Asks the question Does it do what it does well?
Should take both technical perspective and customer perspective into account
Order of Importance
Function first, then form
Make sure that everything is working the way it should
Just behind “does it get the job done” is “do I like how it does it?”
Customer will often pick the option that feels better, even if it doesn’t do quite as well.
Unit Tests
Intro
This is the type of testing that we’ll be focusing on. Unit tests are a type of functional test.
What are Unit Tests?
Testing the smallest pieces of an application
Code based
Why?
Find bugs EARLY
Prevent problems, especially as code is updated
Jest
Jest is a JavaScript testing library which allows us to perform unit tests.
Where to write tests
Using Jest, we can write tests in any js file as long as it meets one of these conditions
it ends with
.test.jsas inexample.test.jsit is contained in a folder called
__tests__as in__tests__/example.jsor__tests__/example.test.js
Parts of a unit test
- expect
Our main testing function
- Matchers
Used in conjunction with
expect, for example: toBe, toContain, etc.
expect(2).toEqual(2)
.not
You can .not with a matcher to expect the opposite of the matcher.
expect(2).not.toBe(3)
How to write a unit test
The test function is provided to us by Jest and is available globally
We provide
testwith two arguments: a description of our test (a string) and a callback functionThis callback function is our test!
//Import our functions to be tested
const { sum, sayHello } = require('../functions')
//We set up a unit test using the following syntax:
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
Describe
Used to group tests together
Individual tests should only test for one thing each
If a test expects multiple things and fails, you won’t know which part failed
When tests are grouped in a describe block, each test still runs individually
const myStr = 'pizza'
describe('myStr', () => {
test('should be type string', () => {
expect(typeof myStr).toBe('string')
}
test('should be equal to "pizza", () => {
expect(myStr).toEqual('pizza')
})
})
Running tests
We’ll set up a test script in our
package.jsonto run jestThen all we have to do is
npm run testWe’ll be able to see the results of our tests in the terminal
Summary
QA is an important part of software development
A big part of QA is good communication
Function over form, but both types of tests are important
Unit tests test individual functions
We’ll use the Jest package to write and run unit tests