How to Design, Plan, and Execute Tests
Testing is not science, testing is art. Testing is similar to programming where many terms and definitions exist, as well as many approaches can be used to solve the same problem.
The terms of this document are intentionally not fixed up strongly but often kept vague due to the different meaning across the industry. Their meaning and usage should still be clear.
Garbage in, garbage out!
Let's try something together
Nifty UI for a Trivial Task
As simple as it seems...
Now with localization!
Localization adds complexity quickly.
Now we see the code
/**
* Square of a number transported via a string
*
* @param s the input
* @param locale the locale to use
* @return
* the square of the input as localized string or
* "N/A" of the input was invalid
*/
public static String squareIt(final String s, final Locale locale)
{
final NumberFormat stringParser = NumberFormat.getInstance(locale);
final NumberFormat formatter = DecimalFormat.getInstance(locale);
try
{
// convert to double
final Number number = stringParser.parse(s);
final double x = number.doubleValue();
// square it
final double result = x * x;
// string it again
return formatter.format(result);
}
catch(ParseException e)
{
return "N/A";
}
}
We just went from black box to gray box to white box.
A Simple View on a Complex Challenge
Software testing is a process of executing a program or application with the intent of finding the software bugs.
It can also be stated as the process of validating and verifying that a software program or application or product:
- Meets the business and technical requirements that guided it’s design and development
- Works as expected
- Can be implemented with the same characteristic.
Software testing is an investigation conducted to provide stakeholders with information about the quality of the software product or service under test.
...can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.
Test techniques include the process of executing a program or application with the intent of finding software bugs (errors or other defects), and verifying that the software product is fit for use.
[1] http://istqbexamcertification.com/what-is-software-testing/
[2] https://en.wikipedia.org/wiki/Software_testing
But what is quality? We just used that word?!
The totality of features and characteristics of a product or service that bear on its ability to meet stated or implied needs.
We define quality as conformance to requirements. Requirements must be clearly stated. Measurements determine conformance... non-conformance detected is the absence of quality.
Quality as term stays vague.
Let's combine all definitions into one nice little sentence.
Testing consists of all activities that increase our confidence that the system will do what it should do and won't do what it shouldn't.
As result of testing, the behavior aka the state is frozen in time.
Keep it in mind, because it will direct your testing into two directions, while other definitions typically leave one out.
Let's Try Something Together
For no apparent reason, we got a new and better java.util.Math.max
replacement.
/**
* Returns the greater of two int values. That is, the result is the argument
* closer to the value of Integer.MAX_VALUE.
* If the arguments have the same value, the result is that same value.
*
* @param a argument one
* @param b argument two
* @return the larger of a and b
*/
public int max(int a, int b);
Dead simple, but still we will get plenty of test cases.
Your boss dropped by and said that it has to be float
not int
.
/**
* Returns the greater of two float values. That is, the result is the argument
* closer to the value of Float.MAX_VALUE.
* If the arguments have the same value, the result is that same value.
*
* @param a argument one
* @param b argument two
* @return the larger of a and b
*/
public float max(float a, float b);
Don't question your boss` decision and yes, we can go really esoteric.
What Input is needed
The input to development and testing
...a requirement is a singular documented physical or functional need that a particular design, product or process aims to satisfy.
It is a broad concept that could speak to any necessary (or sometimes desired) function, attribute, capability, characteristic, or quality of a system for it to have value and utility to...
Requirements are also an important input into the verification process, since tests should trace back to specific requirements. Requirements show what elements and functions are necessary for the particular project.
https://en.wikipedia.org/wiki/Requirement
Requirements are just half the truth, especially with standard processes and even more in e-commerce
Test areas are often not reflected in requirements. These are the typical test areas for e-commerce testing (list is incomplete and unsorted):
Test areas are an unspecified and open topic. Yes, we could fill up an entire training just talking about requirements and how to write them...
Basic Testing Knowledge
Let's start with test types and areas first
All this is topic, reach, and how to test at once. Don't overthink that. The books can drive you nuts here.
Really, don't ride the books, if you want to keep things simple and elegant. Testing is about results and not about terminology.
Removing one common misunderstanding first
Test Type != Test Execution
Areas again, because they match requirements nicely
This list is not complete.
What knowledge can you apply to write and execute tests?
Of course, there is something in between - the gray box test. Know some internal aspects, but approach as black box first, when no further testing is possible, reach into the white box.
This is not a rule to follow, just an aspect to know.
What are test cases and how much expressive are they?
A test case is a specification of the inputs, execution conditions, testing procedure, and expected results that define a single test to be executed to achieve a particular software testing objective... to verify compliance with a specific requirement.
Of course, there is plenty of wiggle room here.
Remember our x2 application?
INPUT | 2 | 5 | 7 | 12 |
---|---|---|---|---|
Expected RESULT | 4 | 25 | 49 | 144 |
The longer the test case, the more boring the maintenance.
There are many variations possible and often is defined by policies.
All about what format you can use to state a test case
Scenario: Positive natural numbers
Given that the application is open
When I enter <Input>
And click the "Calculate" button
Then "The Square of X is <Result>" is displayed
|Input| Result|
| 2| 4|
| 3| 9|
| 10| 100|
| 1211|1,466,521|
These are just examples.
What is a test plan, what should it contain and how much planning is needed?
A document describing the scope, approach, resources and schedule of intended test activities.
It identifies amongst others test items, the features to be tested, the testing tasks, who will do each task, degree of tester independence, the test environment, the test design techniques and entry and exit criteria to be used, and the rationale for their choice,and any risks requiring contingency planning [ISQTB].
Once again, the dosage is important.
How to Compose a Test Plan and Write Tests
based on a Login Example
A More Complex Example
A simple login functionality for an application
Of course, we are simplifying things here.
Ask these questions first before your start anything
This list is incomplete of course.
Just to know where we are overall to assess urgency and reach
The sooner the better.
Assess if we are black box only and possibly user view only
Which requirements exist? Mix this with state and you get priorities
Too long to list all of them here.
What we know but have not stated
Tab
should move to next fieldEnter
should trigger login processWell... writing down implicit requirements is kind of odd...
Shall we and can we automate?
Automation captures state
Is there anything other that we might have to consider?
There are certainly more connected features.
How do we get to our feature and how does the test fit into that?
Too late is always bad. Requirement reviews can produce quite some feedback. Not necessarily because of incorrect rather missing requirements.
Where can we test and what can we see?
If we cannot test freely, we might have to cut down on test coverage.
Not all test data is created equal
One of the examples where a feature alone is worthless.
View it from the Test Concept Side
Separate the test by what you can do or see
This is more a question to shape the view than to come up with new test cases.
Use the guidance of test processes and areas to thing about poaaible tests
Our large exercise.
Use goals to focus better
Mostly, everything you planned should pass of course.
Use importance to focus better
Some things can be done in parallel, not all.
Just a Few Things that Might Help
Things to keep in mind
There is more...
Let's discuss what we have learned