Week 3 & 4 Flashcards
What is software testing
process of evaluating a software solution to ensure it behaves as expected
What is a bug
a bug or defect is a fault of either errors in software or hardware causing a system to fail
why do we test
Finding defects
ensuring quality
validating requirements
improving user experience
With proper testing can we ensure no bugs
Nah bro, shit isn’t that simple
can never be 100% but using proper testing methodology we can get close.
What is Test Driven Development
TDD is a development approach where test are written before any implementation of code.
First plan how you can verify you results meets a goal before any UML , source code etc.
what is the cycle involved in TDD
Red green refactor cycle
red = write a failing test, it will fail initially because of no code.
green = implement minimal code to pass the test
refactor = improve design, readability, maintainability etc while making tests cases still pass.
Which methodology does TDD fall under
It is iterative
after code is refactored, cycle repeats adding more test cases
TDD pros
improved code quality - write modular and readable code
reduced bugs - continuously testing and catching early
faster feedback - rapid feedback and address issues faster
better documentation - tests serve as documentation by showing intended behaviour and examples of usage
wie se testcase
particular choice of input and expected output
whats a test
finite collection of test cases
What is white box testing
Testing the internal structure, design and code
done by dev team - need to understand the code and algorithms
What is black box testing
testing the system from perspective of end users
done by end users
so we cannot completely test systems, so how do we test.
basically that correct behaviour on critical parts represent correct behaviour on untested parts.
is acceptance tests white or black? hehe
its black box
don’t need to understand working of code
What are the broad testing seen in a logical organisation of testing
Unit testing
Integration testing
system testing
Unit testing?
smallest possible parts of a system are tested individually and independently
white
what is integration testing
Testing how components of a system interact with each other
white
what is system testing and its 4 applications
System testing involves testing the entire system
white
Functional testing
Quality testing - non functional stuff
black
Acceptance testing
Installation testing - works when deployed
what is coverage
helps us measure the degree of which the software program is tested
Test coverage - specification testing like acceptance tests
Code coverage - testing code like unit tests
Do all tests weigh the same
No, testing can be prioritised because some tests can likely reveal more faults than others
What are some testing techniques to achieving high coverage
Black
equivalence testing
boundary testing
white
control flow testing
state based testing
what is equivalence testing
dividing possible inputs into equivalence groups such that the program is expected to behave the same with inputs from the same group
we can do this because we assume we dont have shit programmers like muzzi that hard code for inputs. So mistakes likely affect a whole class of input values
e,g. input must be a 4 digit so we split < > = 4
we have valid and invalid groups
what is boundary testing
special case of equivalence testing where we test the boundary values of ranges.
e.g we code for mark between 0 and 100 but input like 101 cooks us.
what is control flow testing
we draw flow graphs representing the logic of the code
nodes = statements
edges = transitions between statements
these graphs help us measure coverage
what types of coverage can we measure with control flow testing
Statement coverage - every statement run at least once
Edge coverage - every branch is traversed at least once
Condition coverage - every condition tested with true or false at least once
Path coverage - every distinct path through the program traversed at least once
NB 100% statement coverage does not mean 100% edge coverage as we might have if statement. with it always true you get statement coverage but since not tested when false its not full edge coverage.
What is state based testing
testing software by defining a set of abstract states and checking if it behaves as expected when changing between states
components include:
States - condition of object attributes
Events - input given to system
Actions - the output following an event
Transitions - change in states
Guard - condition associated with a even which determines if a transition is triggered or not
types of state based coverage
event coverage - every event tested
state coverage - every state visited
action coverage - every action triggered
what are control faults
refers to errors in control flow logic
missing or incorrect transitions
missing or incorrect actions
sneak path - event is accepted when it shouldn’t
trap door - accepting undefined events
deadlocks - permanent blocking of system
How do we unit testing with regards to testing it in isolation
This is done by creating mock objects
Test driver - simulates part of a system to invoke operation on the unit such as calling the function
Test stub - simulates parts of the system that the unit needs to interact with.
what’s the convention for naming test cases
method name _ starting state _ expected result
e.g. checkKey_anyState_invalidKeyRejected()
what are assert statments
using in unit testing
assertTrue(4 == (2 * 2));
assertEquals(expected, actual);
What are the different types of Integration testing
Big bang
Top down
Bottom up
Sandwich
What is big bang integration testing and why we shouldn’t dala
Where all units are linked at once and test
Faults only identified after whole system is implemented
might miss bugs and hard to isolate them
hard to ensure all cases are tested
What is bottom up testing
lowest level subsystems tested first and integrated components only tested once what it relies on is tested.
Bottom up pros and cons
Pros:
dont need stubs
disjoint systems can be tested simultaneously
lower level operations are usually critical to higher level ones so testing that first is usually a priority
Cons:
Drivers are needed
Some higher level components like UI can be the source of many bugs and thus found late.
if you have alot of lower level components, bottom up can almost seem like big bang
what is top down testing
highest levels are tested first and work it way down
Top down Pros and Cons
Pros:
no need for drivers
easier to write functional requirement test cases
can deal with major design flaws earlier
Cons:
alot of stubs needed
low level can only be tested once higher level are implemented
What is sandwich testing
combination of top down and bottom up
Sandwich Pros and Cons
Pros:
low and high level tested simultaneously
easier to test larger systems
Cons:
Can be expensive
Need more devs, drivers and stubs
Not suitable for systems with highly independent subsystems as this approach may force these parts to be tested together even tho they are not relevant to each other
What is front end component testing
Involves testing components of UI like buttons, drop downs and other elements in ISOLATION.
what type of testing does front-end component testing encompass
Unit
Integration
Snapshot - comparing rendered component output to detect UI changes
End-to-End - testing whole app from user view
Accessibility - people with disabilities
Visual regression - detecting unintended visual changes
Performance testing- responsiveness and efficiency
Component Storybook - way to render and test UI features in isolation
What is horizontal integration testing
focuses on testing layers of a system with new layers incrementally added to the last
e.g. top down, bottom up, sandwich
what is vertical integration testing
focuses on testing user stories, so testing components needs for a particular user story
What is continuous integration
Continuous Integration (CI) is a software development practice where developers frequently integrate or add their code changes to a shared repository (usually multiple times a day).
Builds and tests are automated to ensure it works
what are types of quality testing
stress testing - bots to moer servers load
volume testing - big data
compatibility testing - older versions of software
Timing testing - response time
Security testing - attempt to hack
recovery testing - responding to erros, lack of data, handling restarts and loadshedding cut offs etc.
alpha vs beta testing
alpha is acceptance testing done in developer environment where beta is done in target environment.