01-06-2015
Black Box Software
Testing
1
By Muhammad Soban & Muhammad Umair
ď‚§ Black box testing is a software testing techniques in which
functionality of the software under test (SUT) is tested
without looking at the internal code structure,
implementation details and knowledge of internal paths
of the software.
ď‚§ This type of testing is based entirely on the software
requirements and specifications.
Introduction Black Box Testing
2
ď‚§ In Black Box Testing we just focus on inputs and output of
the software system.
ď‚§ The above Black Box can be any software system you
want to test. For example : an operating system like
Windows, a website like Google ,a DBMS like Oracle or
even your own custom application.
Black Box Testing
3
ď‚§ Black box testing tends to find different kinds of errors than
white box testing
ď‚§ Missing functions
ď‚§ Usability problems
ď‚§ Performance problems
ď‚§ Concurrency and timing errors
ď‚§ Initialization and termination errors
ď‚§ Unlike white box testing, black box testing tends to be
applied later in the development process
Black Box Testing
4
Equivalence
Partitioning
Boundary
Value Analysis
Error Guessing
Black Box Testing Techniques
5
ď‚§ Typically the universe of all possible test cases is so large
that you cannot try them all
ď‚§ You have to select a relatively small number of test cases
to actually run
ď‚§ Which test cases should you choose?
ď‚§ Equivalence partitioning helps answer this question
Equivalence Partitioning
6
ď‚§ Partition the test cases into "equivalence classes"
ď‚§ Each equivalence class contains a set of "equivalent" test
cases
ď‚§ Two test cases are considered to be equivalent if we expect
the program to process them both in the same way (i.e., follow
the same path through the code)
ď‚§ If you expect the program to process two test cases in the
same way, only test one of them, thus reducing the number of
test cases you have to run
Equivalence Partitioning
7
ď‚§ First-level partitioning: Valid vs. Invalid test cases
Equivalence Partitioning
8
Valid Invalid
ď‚§ Partition valid and invalid test cases into equivalence
classes
Equivalence Partitioning
9
ď‚§ If an oracle is available, the test values in each
equivalence class can be randomly generated. This is
more useful than always testing the same static values.
ď‚§ Oracle: something that can tell you whether a test passed or
failed
ď‚§ Test multiple values in each equivalence class. Often
you’re not sure if you have defined the equivalence
classes correctly or completely, and testing multiple values
in each class is more in-depth than relying on a single
value.
Equivalence Partitioning
10
ď‚§ Create a test case for at least one value from each
equivalence class
Equivalence Partitioning
11
ď‚§ When designing test cases, you may use different
definitions of “equivalence”, each of which will partition
the test case space differently
 Example: int Add(n1, n2, n3, …)
ď‚§ Equivalence Definition 1: partition test cases by the number of inputs (1, 2,
3, etc.)
ď‚§ Equivalence Definition 2: partition test cases by the number signs they
contain (positive, negative, both)
ď‚§ Equivalence Definition 3: partition test cases by the magnitude of
operands (large numbers, small numbers, both)
ď‚§ Etc.
Equivalence Partitioning
12
Equivalence Partitioning Examples
13
Input Valid Equivalence Classes Invalid Equivalence Classes
A integer N such that:
-99 <= N <= 99
[-99, -10]
[-9, -1]
0
[1, 9]
[10, 99]
< -99
> 99
Malformed numbers
{12-, 1-2-3, …}
Non-numeric strings
{junk, 1E2, $13}
Empty value
Phone Number
Area code: [200, 999]
555-5555
(555)555-5555
555-555-5555
200 <= Area code <= 999
Invalid format 5555555,
(555)(555)5555, etc.
Area code < 200 or > 999
Area code with non-numeric
characters
ď‚§ When choosing values from an equivalence class to test, use the
values that are most likely to cause the program to fail
ď‚§ Errors tend to occur at the boundaries of equivalence classes rather
than at the "center"
ď‚§ If (200 < areaCode && areaCode < 999) { // valid area code }
ď‚§ Wrong!
ď‚§ If (200 <= areaCode && areaCode <= 999) { // valid area code }
ď‚§ Testing area codes 200 and 999 would catch this error, but a center value like 770
would not
ď‚§ In addition to testing center values, we should also test boundary
values
ď‚§ Right on a boundary
ď‚§ Very close to a boundary on either side
Boundary Value Analysis
14
ď‚§ Create test cases to test boundaries of equivalence
classes
Boundary Value Analysis
15
Boundary Value Analysis Examples
16
Input Boundary Cases
A number N such that:
-99 <= N <= 99
-100, -99, -98
-10, -9
-1, 0, 1
9, 10
98, 99, 100
Area code: [200, 999] Area code: 199, 200, 201
Area code: 998, 999, 1000
ď‚§ Numeric values are often entered as strings which are
then converted to numbers internally [int x = atoi(str);]
ď‚§ This conversion requires the program to distinguish
between digits and non-digits
ď‚§ A boundary case to consider: Will the program accept /
and : as digits?
Boundary Value Analysis Examples
17
Char
ASCII
/ 0 1 2 3 4 5 6 7 8 9 :
47 48 49 50 51 52 53 54 55 56 57 58
ď‚§ Based on intuition, guess what kinds of inputs might cause the
program to fail
ď‚§ Create some test cases based on your guesses
ď‚§ Intuition will often lead you toward boundary cases, but not always
ď‚§ Some special cases aren't boundary values, but are mishandled by
many programs
ď‚§ Try exiting the program while it's still starting up
ď‚§ Try loading a corrupted file
ď‚§ Try strange but legal URLs: hTtP://Www.bYu.EDU/
Error Guessing
18
ď‚§ Functional testing
ď‚§ This black box testing type is related to functional requirements of
a system e.g. login system working properly. It is done by
software testers.
ď‚§ Non-functional testing
ď‚§ This type of black box testing is not related to testing of a specific
functionality , but non-functional requirements such as
scalability, usability, performance e.g. system under Low memory
conditions
Types of Black Box Testing
19
Types of Functional Black Box Testing
20
ď‚§ Individual components are tested to ensure that they
operate correctly
ď‚§ The size of a single module is small enough that we can
locate an error fairly easily
ď‚§ It is usually performed by the developer.
Unit Testing(White Box Testing)
21
ď‚§ Incorrect initialization
ď‚§ Precision inaccuracy
ď‚§ Improper loop termination
ď‚§ Improperly modified loop variables
ď‚§ Incorrect arithmetic precedence
ď‚§ Comparison of different data types
ď‚§ Incorrect logical operators or precedence
ď‚§ Incorrect comparison of variables
ď‚§ Incorrect symbolic representation of an expression
Test cases in unit testing should uncover
errors
22
23
ď‚§ A Stub is a small program routine
that substitutes for a longer
program, possibly to be loaded
later or that is located remotely
 A Driver is nothing more than a “main
program” that accepts test-case data,
passes such data to the component (to
be tested), and prints relevant results
ď‚§ Drivers and stubs represent
overhead. That is, both are
software that must be written but
that is not delivered with the final
software product.
Unit Test Procedure
ď‚§ Unit-tested modules are combined into subsystems, which
are then tested.
ď‚§ The goal here is to see if the modules can be integrated
properly
Integration Testing
24
Integration Testing: Incremental
Approach
25
ď‚§ First combine only two components together and test them.
Remove the errors if they are there, otherwise combine another
component to it and then test again, and so on until the whole
system is developed
Integration Testing: Top-Down
26
ď‚§ Modules are integrated by moving
downward through the control hierarchy
beginning with the main control module.
ď‚§ Depth-first integration:
M1, M2, and M5 would be integrated first.
Next, M8 or M6 would be integrated. Then,
the central and right-hand control paths
are built.
ď‚§ Breadth-first integration:
M2, M3, and M4 would be integrated first.
The next control level M5, M6, and so on
follows.
Integration Testing: Bottom-Up
27
ď‚§ Begins construction and testing with
the components at the lowest level in
the program structure.
1) Low-level components are combined
into clusters (sometimes called builds)
that perform specific software sub-
functions.
2) A driver (a control program for
testing) is written to coordinate
test case input and output.
3) The cluster is tested.
4) Drivers are removed and clusters are
combined moving upward in the
program structure.
Test
Case
ID
Test Case Objective Test Case Description Expected Result
1 Check the interface link
between the Login and
Mailbox module
Enter login
credentials and click
on the Login button
To be directed to
the Mail Box
2 Check the interface link
between the Mailbox and
Delete Mails Module
From Mail box select
the an email and
click delete button
Selected email
should appear in
the Deleted/Trash
folder
Integration Test Case:
28
ď‚§ System testing is the testing of a complete and fully
integrated software product
ď‚§ The testing process is concerned with finding errors that
result from unexpected interactions between subsystems
and system components
ď‚§ It is also concerned with validating that the system meets
its functional and non-functional requirements
System Testing
29
ď‚§ Alpha testing refers to the system testing carried out by the
test team within the development organization
ď‚§ Beta testing is the system testing performed by a selected
group of friendly customers
ď‚§ Acceptance testing is the system testing performed by the
customer to determine whether to accept or reject the
delivery of the system
Three main kinds of system testing
30
Installation
Testing
Load Testing
Interoperability
Testing
Types of Non-Functional Black Box Testing
31
ď‚§ Check that software application is
successfully installed and it is
working as expected after
installation
ď‚§ Make sure that users do not have
any trouble when installing your
software
Installation Testing
32
ď‚§ Required disk space is1MB, then make sure exactly 1MB
ď‚§ Test disk space requirement on different file system format. Like FAT16 will
require more space than efficient NTFS or FAT32 file systems
ď‚§ Try to automate the routine to test the number of files to be written on disk
ď‚§ Verify registry changes on successful installation
ď‚§ Forcefully break the installation process in between and check system
recovers to its original state without any issues
Installation Testing Tips With Some Broad
Test Cases
33
ď‚§ If test cases are distributed from Internet, test cases should
be included for
ď‚§ Bad network speed and broken connection
ď‚§ Firewall and security related
ď‚§ Size and approximate time taken
ď‚§ Concurrent installation/downloads
Installation Testing Tips With Some Broad
Test Cases
34
ď‚§ Determines a system's performance under real-life load
conditions
ď‚§ Load testing identifies the bottlenecks in the system under
various workloads and checks how the system reacts
when the load is gradually increased
Load Test
35
ď‚§ The maximum operating capacity of an application
ď‚§ Determine whether current infrastructure is sufficient to run the
application
ď‚§ Sustainability of application with respect to peak user load
ď‚§ Number of concurrent users that an application can support, and
scalability to allow more users to access it
ď‚§ Load testing is commonly used for the Client/Server, Web based
applications - both Intranet and Internet
Load testing usually identifies
36
ď‚§ Load Runner
ď‚§ Web Load
ď‚§ Astra Load Test
ď‚§ Rad view's Web Load
ď‚§ Studio, Rational Site Load
ď‚§ Silk Performer
Load Testing Tools
37
ď‚§ Interoperability testing involves testing whether a given
software program or technology is compatible with others
and promotes cross-use functionality
ď‚§ For example, major studies have been conducted to
determine how devices used for heart transplants interact
with various microwave technologies. In software
development, interoperability testing examines how
applications function with other applications or services
Interoperability Testing
38
ď‚§ Stress testing
ď‚§ Usability testing
ď‚§ Security testing
ď‚§ Recovery testing
ď‚§ Reliability Testing
ď‚§ Scalability testing
ď‚§ Availability Testing
ď‚§ Performance testing
ď‚§ Compatibility testing
ď‚§ Configuration Testing
ď‚§ Documentation testing
ď‚§ Maintainability Testing
ď‚§ Localization testing and Internationalization testing
Other Non Functional Black Box Testing
39
(Dijkstra et al., 1972)
Testing can only show the
presence of errors, not their
absence
40

Black box software testing

  • 1.
    01-06-2015 Black Box Software Testing 1 ByMuhammad Soban & Muhammad Umair
  • 2.
    ď‚§ Black boxtesting is a software testing techniques in which functionality of the software under test (SUT) is tested without looking at the internal code structure, implementation details and knowledge of internal paths of the software. ď‚§ This type of testing is based entirely on the software requirements and specifications. Introduction Black Box Testing 2
  • 3.
    ď‚§ In BlackBox Testing we just focus on inputs and output of the software system. ď‚§ The above Black Box can be any software system you want to test. For example : an operating system like Windows, a website like Google ,a DBMS like Oracle or even your own custom application. Black Box Testing 3
  • 4.
    ď‚§ Black boxtesting tends to find different kinds of errors than white box testing ď‚§ Missing functions ď‚§ Usability problems ď‚§ Performance problems ď‚§ Concurrency and timing errors ď‚§ Initialization and termination errors ď‚§ Unlike white box testing, black box testing tends to be applied later in the development process Black Box Testing 4
  • 5.
  • 6.
    ď‚§ Typically theuniverse of all possible test cases is so large that you cannot try them all ď‚§ You have to select a relatively small number of test cases to actually run ď‚§ Which test cases should you choose? ď‚§ Equivalence partitioning helps answer this question Equivalence Partitioning 6
  • 7.
    ď‚§ Partition thetest cases into "equivalence classes" ď‚§ Each equivalence class contains a set of "equivalent" test cases ď‚§ Two test cases are considered to be equivalent if we expect the program to process them both in the same way (i.e., follow the same path through the code) ď‚§ If you expect the program to process two test cases in the same way, only test one of them, thus reducing the number of test cases you have to run Equivalence Partitioning 7
  • 8.
    ď‚§ First-level partitioning:Valid vs. Invalid test cases Equivalence Partitioning 8 Valid Invalid
  • 9.
    ď‚§ Partition validand invalid test cases into equivalence classes Equivalence Partitioning 9
  • 10.
     If anoracle is available, the test values in each equivalence class can be randomly generated. This is more useful than always testing the same static values.  Oracle: something that can tell you whether a test passed or failed  Test multiple values in each equivalence class. Often you’re not sure if you have defined the equivalence classes correctly or completely, and testing multiple values in each class is more in-depth than relying on a single value. Equivalence Partitioning 10
  • 11.
    ď‚§ Create atest case for at least one value from each equivalence class Equivalence Partitioning 11
  • 12.
     When designingtest cases, you may use different definitions of “equivalence”, each of which will partition the test case space differently  Example: int Add(n1, n2, n3, …)  Equivalence Definition 1: partition test cases by the number of inputs (1, 2, 3, etc.)  Equivalence Definition 2: partition test cases by the number signs they contain (positive, negative, both)  Equivalence Definition 3: partition test cases by the magnitude of operands (large numbers, small numbers, both)  Etc. Equivalence Partitioning 12
  • 13.
    Equivalence Partitioning Examples 13 InputValid Equivalence Classes Invalid Equivalence Classes A integer N such that: -99 <= N <= 99 [-99, -10] [-9, -1] 0 [1, 9] [10, 99] < -99 > 99 Malformed numbers {12-, 1-2-3, …} Non-numeric strings {junk, 1E2, $13} Empty value Phone Number Area code: [200, 999] 555-5555 (555)555-5555 555-555-5555 200 <= Area code <= 999 Invalid format 5555555, (555)(555)5555, etc. Area code < 200 or > 999 Area code with non-numeric characters
  • 14.
    ď‚§ When choosingvalues from an equivalence class to test, use the values that are most likely to cause the program to fail ď‚§ Errors tend to occur at the boundaries of equivalence classes rather than at the "center" ď‚§ If (200 < areaCode && areaCode < 999) { // valid area code } ď‚§ Wrong! ď‚§ If (200 <= areaCode && areaCode <= 999) { // valid area code } ď‚§ Testing area codes 200 and 999 would catch this error, but a center value like 770 would not ď‚§ In addition to testing center values, we should also test boundary values ď‚§ Right on a boundary ď‚§ Very close to a boundary on either side Boundary Value Analysis 14
  • 15.
    ď‚§ Create testcases to test boundaries of equivalence classes Boundary Value Analysis 15
  • 16.
    Boundary Value AnalysisExamples 16 Input Boundary Cases A number N such that: -99 <= N <= 99 -100, -99, -98 -10, -9 -1, 0, 1 9, 10 98, 99, 100 Area code: [200, 999] Area code: 199, 200, 201 Area code: 998, 999, 1000
  • 17.
    ď‚§ Numeric valuesare often entered as strings which are then converted to numbers internally [int x = atoi(str);] ď‚§ This conversion requires the program to distinguish between digits and non-digits ď‚§ A boundary case to consider: Will the program accept / and : as digits? Boundary Value Analysis Examples 17 Char ASCII / 0 1 2 3 4 5 6 7 8 9 : 47 48 49 50 51 52 53 54 55 56 57 58
  • 18.
    ď‚§ Based onintuition, guess what kinds of inputs might cause the program to fail ď‚§ Create some test cases based on your guesses ď‚§ Intuition will often lead you toward boundary cases, but not always ď‚§ Some special cases aren't boundary values, but are mishandled by many programs ď‚§ Try exiting the program while it's still starting up ď‚§ Try loading a corrupted file ď‚§ Try strange but legal URLs: hTtP://Www.bYu.EDU/ Error Guessing 18
  • 19.
    ď‚§ Functional testing ď‚§This black box testing type is related to functional requirements of a system e.g. login system working properly. It is done by software testers. ď‚§ Non-functional testing ď‚§ This type of black box testing is not related to testing of a specific functionality , but non-functional requirements such as scalability, usability, performance e.g. system under Low memory conditions Types of Black Box Testing 19
  • 20.
    Types of FunctionalBlack Box Testing 20
  • 21.
    ď‚§ Individual componentsare tested to ensure that they operate correctly ď‚§ The size of a single module is small enough that we can locate an error fairly easily ď‚§ It is usually performed by the developer. Unit Testing(White Box Testing) 21
  • 22.
    ď‚§ Incorrect initialization ď‚§Precision inaccuracy ď‚§ Improper loop termination ď‚§ Improperly modified loop variables ď‚§ Incorrect arithmetic precedence ď‚§ Comparison of different data types ď‚§ Incorrect logical operators or precedence ď‚§ Incorrect comparison of variables ď‚§ Incorrect symbolic representation of an expression Test cases in unit testing should uncover errors 22
  • 23.
    23  A Stubis a small program routine that substitutes for a longer program, possibly to be loaded later or that is located remotely  A Driver is nothing more than a “main program” that accepts test-case data, passes such data to the component (to be tested), and prints relevant results  Drivers and stubs represent overhead. That is, both are software that must be written but that is not delivered with the final software product. Unit Test Procedure
  • 24.
    ď‚§ Unit-tested modulesare combined into subsystems, which are then tested. ď‚§ The goal here is to see if the modules can be integrated properly Integration Testing 24
  • 25.
    Integration Testing: Incremental Approach 25 ď‚§First combine only two components together and test them. Remove the errors if they are there, otherwise combine another component to it and then test again, and so on until the whole system is developed
  • 26.
    Integration Testing: Top-Down 26 ď‚§Modules are integrated by moving downward through the control hierarchy beginning with the main control module. ď‚§ Depth-first integration: M1, M2, and M5 would be integrated first. Next, M8 or M6 would be integrated. Then, the central and right-hand control paths are built. ď‚§ Breadth-first integration: M2, M3, and M4 would be integrated first. The next control level M5, M6, and so on follows.
  • 27.
    Integration Testing: Bottom-Up 27 ď‚§Begins construction and testing with the components at the lowest level in the program structure. 1) Low-level components are combined into clusters (sometimes called builds) that perform specific software sub- functions. 2) A driver (a control program for testing) is written to coordinate test case input and output. 3) The cluster is tested. 4) Drivers are removed and clusters are combined moving upward in the program structure.
  • 28.
    Test Case ID Test Case ObjectiveTest Case Description Expected Result 1 Check the interface link between the Login and Mailbox module Enter login credentials and click on the Login button To be directed to the Mail Box 2 Check the interface link between the Mailbox and Delete Mails Module From Mail box select the an email and click delete button Selected email should appear in the Deleted/Trash folder Integration Test Case: 28
  • 29.
    ď‚§ System testingis the testing of a complete and fully integrated software product ď‚§ The testing process is concerned with finding errors that result from unexpected interactions between subsystems and system components ď‚§ It is also concerned with validating that the system meets its functional and non-functional requirements System Testing 29
  • 30.
    ď‚§ Alpha testingrefers to the system testing carried out by the test team within the development organization ď‚§ Beta testing is the system testing performed by a selected group of friendly customers ď‚§ Acceptance testing is the system testing performed by the customer to determine whether to accept or reject the delivery of the system Three main kinds of system testing 30
  • 31.
  • 32.
    ď‚§ Check thatsoftware application is successfully installed and it is working as expected after installation ď‚§ Make sure that users do not have any trouble when installing your software Installation Testing 32
  • 33.
    ď‚§ Required diskspace is1MB, then make sure exactly 1MB ď‚§ Test disk space requirement on different file system format. Like FAT16 will require more space than efficient NTFS or FAT32 file systems ď‚§ Try to automate the routine to test the number of files to be written on disk ď‚§ Verify registry changes on successful installation ď‚§ Forcefully break the installation process in between and check system recovers to its original state without any issues Installation Testing Tips With Some Broad Test Cases 33
  • 34.
    ď‚§ If testcases are distributed from Internet, test cases should be included for ď‚§ Bad network speed and broken connection ď‚§ Firewall and security related ď‚§ Size and approximate time taken ď‚§ Concurrent installation/downloads Installation Testing Tips With Some Broad Test Cases 34
  • 35.
    ď‚§ Determines asystem's performance under real-life load conditions ď‚§ Load testing identifies the bottlenecks in the system under various workloads and checks how the system reacts when the load is gradually increased Load Test 35
  • 36.
    ď‚§ The maximumoperating capacity of an application ď‚§ Determine whether current infrastructure is sufficient to run the application ď‚§ Sustainability of application with respect to peak user load ď‚§ Number of concurrent users that an application can support, and scalability to allow more users to access it ď‚§ Load testing is commonly used for the Client/Server, Web based applications - both Intranet and Internet Load testing usually identifies 36
  • 37.
    ď‚§ Load Runner ď‚§Web Load ď‚§ Astra Load Test ď‚§ Rad view's Web Load ď‚§ Studio, Rational Site Load ď‚§ Silk Performer Load Testing Tools 37
  • 38.
    ď‚§ Interoperability testinginvolves testing whether a given software program or technology is compatible with others and promotes cross-use functionality ď‚§ For example, major studies have been conducted to determine how devices used for heart transplants interact with various microwave technologies. In software development, interoperability testing examines how applications function with other applications or services Interoperability Testing 38
  • 39.
    ď‚§ Stress testing ď‚§Usability testing ď‚§ Security testing ď‚§ Recovery testing ď‚§ Reliability Testing ď‚§ Scalability testing ď‚§ Availability Testing ď‚§ Performance testing ď‚§ Compatibility testing ď‚§ Configuration Testing ď‚§ Documentation testing ď‚§ Maintainability Testing ď‚§ Localization testing and Internationalization testing Other Non Functional Black Box Testing 39
  • 40.
    (Dijkstra et al.,1972) Testing can only show the presence of errors, not their absence 40

Editor's Notes

  • #4 Can be applied to software “units” (e.g., classes) or to entire programs External behavior is defined in API docs, Functional specs, Requirements specs, etc.
  • #5 Recover Password (UI easy to use, organized and logical) (Running times, Memory, Network, Disk usage) Database connection not closed
  • #9 Number valid Strings invalid
  • #10 Range of numbers Categories of strings
  • #11 The oracle might be a program (separate from the system under test) which takes the same input and produces the same output documentation that gives specific correct outputs for specific given inputs a documented algorithm that a human could use to calculate correct outputs for given inputs a human domain expert who can somehow look at the output and tell whether it is correct or any other way of telling that output is correct.