Wednesday, August 15, 2007

Testing Concepts

Black-box testing and white-box testing are the two fundamental testing strategies. They are strategies, not technical or analytical methods.

Black-box tests are derived from the functional design specification, without regard to the internal program structure. Black-box testing tests the product against the end user, external specifications. Black-box testing is done without any internal knowledge of the product. It is important in practice to try to test, or at least write, detailed test plans for requirements and functional specifications tests without too much knowledge of the code. Understanding the code changes the way the requirements are seen and test design should not be “contaminated” by this knowledge too early.

Black-box testing will not test hidden functions (i.e., functions implemented but not described in the functional design specification), and the errors associated with them will not be found in black-box testing.

White-box tests require knowledge of the internal program structure and are derived from the internal design specification or the code. They will not detect missing functions (i.e., those described in the functional design specification but not supported by the internal specification or code).

BLACK-BOX METHODS FOR FUNCTION-BASED TESTS (page 83)

The following methods are commonly used:

· equivalence partioning

· boundary-value analysis

· error guessing.

The following are lesser-used methods:

· cause-effect graphing

· syntax testing

· state transition testing

· graph matrix.

Equivalence partitioning

Equivalence partitioning is a systematic process that identifies, on the basis of whatever information is available, a set of interesting classes of input conditions to be tested, where each class is representative of (or covers) a large set of other possible tests. If partitioning is applied to the product under test, the product is going to behave in much the same way for all members of the class.

The aim is to minimize the number of test cases required to cover these input conditions.

There are two distinct steps. The first is to identify the equivalence classes (ECs) and the second is to identify the test cases.

(1) Identifying equivalence classes

For each external input:

(i) If the input specifies a range of valid values, define one valid EC (within the range) and two invalid Ecs (one outside each end of the range).

Example: If the input requires a month in the range of 1-12, define one valid EC for months 1 through 12 and two invalid ECs (month<1>12).

(ii) If the input specifies the number (N) of valid values, define one valid EC and two invalid ECs (none, and more than N).

Example: If the input requires the titles of at least three but no more than eight books, then define one valid EC and two invalid ECs (<3>8 books).

(iii) If the input specifies a set of valid values, define one valid EC (within the set) and one invalid EC (outside the set).

Example: If the input requires one of the names TOM, DICK, or HARRY, then define one valid EC (using one of the valid names) and one invalid EC (using the name JOE).

(iv) If there is reason to believe that the program handles each valid input differently, then define one valid EC per valid input.

(v) If the input specifies a “must be” situation, define one valid EC and one invalid EC.

Example: If the first character of the input must be numeric, then define one valid EC where the first character is a number and one invalid EC where the first character is not a number.

(vi) If there is reason to believe that elements in an EC are not handled in an identical manner by the program, subdivide the EC into smaller ECs.

(2) Identifying test cases

(i) Assign a unique number to each EC.

(ii) Until all valid ECs have been covered by test cases, write a new test case covering as many of the uncovered ECs as possible.

(iii) Until all invalid Ecs have been covered by test cases, write a test case that covers one, and only one, of the uncovered invalid ECs.

(iv) If multiple invalid ECs are tested in the same test case, some of those tests may never be executed because the first test may mask other tests or terminate execution of the test case.

Equivalence partitioning significantly reduces the number of input conditions to be tested by identifying classes of conditions that are equivalent to many other conditions. It does not test combinations of input conditions.

Boundary-value analysis

Boundary-value analysis is a variant and refinement of equivalence partitioning, with two major differences:

First, rather than selecting any element in an equivalence class as being representative, elements are selected such that each edge of the EC is the subject of a test. Boundaries are always a good place to look for defects.

Second, rather than focusing exclusively on input conditions, output conditions are also explored by defining output ECs. What can be output? What are the classes of output? What should I create as an input to force a useful set of classes that represent the outputs that ought to be produced?

The guidelines for boundary-value analysis are:

· If an input specifies a range of valid values, write test cases for the ends of the range and invalid-input test cases for conditions just beyond the ends.

Example: If the input requires a real number in the range 0.0 to 90.0 degrees, then write test cases for 0.0, 90.0, -0.001, and 90.001.

· If an input specifies a number of valid values, write test cases for the minimum and maximum number of values and one beneath and beyond these values.

Example: If the input requires the titles of at least 3, but no more than 8, books, then write test cases for 2, 3, 8, and 9 books.

· Use the above guidelines for each output condition.

Boundary-value analysis is not as simple as it sounds, because boundary conditions may be subtle and difficult to identify. The method does not test combinations of input conditions.

Error guessing (page 87)

Error guessing is an ad hoc approach, based on intuition and experience, to identify tests that are considered likely to expose errors. The basic idea is to make a list of possible errors or error-prone situations and then develop tests based on the list. What are the most common error-prone situations we have seen before? Defects’ histories are useful. There is a high probability that defects that have been there in the past are the kind that are going to be there in the future.

Some items to try are:

· empty or null lists/strings

· zero instances/occurrences

· blanks or null characters in strings

· negative numbers

One of the studies done by Myers (1979) states that the probability of errors remaining in the program is proportional to the number of errors that have been found so far. This alone provides a rich source of focus for productive error guessing.

WHITE-BOX METHODS FOR INTERNALS-BASED TESTS

Once white-box testing is started, there are a number of techniques to ensure the internal parts of the system are being adequately tested and that there is sufficient logic coverage.

The execution of a given test case against program P will exercise (cover) certain parts of P’s internal logic. A measure of testedness for P is the degree of logic coverage produced by the collective set of test cases for P. White-box testing methods are used to increase logic coverage.

There are four basic forms of logic coverage:

(1) statement coverage

(2) decision (branch) coverage

(3) condition coverage

(4) path coverage.

White-box methods defined and compared

The following figure illustrates white-box methods. For example, to perform condition coverage, tests covering characteristics 1 and 3 are required. Tests covering 2 and 4 are not required. To perform multiple condition coverage, tests covering characteristics 1 and 4 are required. Such tests will automatically cover characteristics 1 and 2.

Statement coverage

Decision

coverage

Condition

coverage

Decision/

Condition

coverage

Multiple

Condition coverage

1. Each statement is

executed at least once

Y

Y

Y

Y

Y

2. Each decision takes on all possible outcomes at least once

N

Y

N

Y

implicit

3. Each condition in a decision takes on all possi-ble outcomes at least once

N

N

Y

Y

implicit

4. All possible combina-tions of condition out-comes in each decision occur at least once

N

N

N

N

Y

FIGURE: The white-box methods defined and compared. Each column in this figure represents a distinct method of white-box testing, and each row (1-4) defines a different test characteristic. For a given method (column), “Y” in a given row means that the test characteristic is required for the method. “N” signifies no requirement. “Implicit” means the test characteristic is achieved implicitly by other requirements of the method.

Exhaustive path coverage is generally impractical. However, there are practical methods, based on the other three basic forms, which provide increasing degrees of logic coverage.

Test Plan

Test Planning : Test Plan

1. The goal of software testing is to:
A: Debug the System.

B: Validate that the system behaves as expected.

C: Avoid Lawsuits

D: Execute the program with the intent of finding errors.

2. If no errors were found during testing:
A: the system was not tested completely.

B: The programmer is a perfect genius.

C: no errors were sought.

3. A Test Plan defines:

A: What is selected for testing.

C: Objectives and results.

B: Expected results.

D: Targets and misses.

4. Test Planning should begin:

A: At the same time that requirements definition begins.

B: When building starts.

C: When Code build is complete

D: After shipping the first version.

Why plan tests:
5. Documented tests are:

A: Repeatable.

C: Sensible.

B: Organized.

D: Manageable.

6. List three benefit factors in planned tests:
Repeatable, Controllable, Coverage.

7. The Test Plan is defined as an overall document providing direction for all testing activity.

True, False

8. The _____ answers What will be covered in test? And what will not be covered in the tests.

9. A _____ is a statement of what the tester is expected to accomplish or validate during testing activity.

10. Procedures for configuration management, version control, hardware and software configurations and other items such as defect tracking should be listed in _________ .

{http://school.discovery.com/quizzes8/paulmw/TP584.html}


  1. Test Scope
  2. Test Objectives
  3. Assumptions
  4. Risk Analysis
  5. Test Design
  6. Roles and Responsibilities
  7. Test Schedule and Resources
  8. Test Data Management
  9. Test Environment
  10. Communication Approach
  11. Test Tools

The data required for testing, the infrastructure requirements to manage the data as well as the methods for preparing test data, requirements, converters and sources.

What will be covered in the test? What will not be? Might include functional or structural requirements, API, infrastructure component or deliverable documentation.

A testing goal. It is a statement of what the tester is expected to accomplish or validate during a testing activity. These guide the development of test cases and procedures.

Details what types of tests must be conducted, what stages of testing are required and outlines the sequence and timing of tests.

This may include formal and informal meetings, working sessions, processes, tools and techniques such as escalation or posting testing state.

This includes Major Test activities, the sequence of tests, dependencies on other project activities and initial estimates for each activity. Includes people, tools and facilities.

These document test prerequisites. This may include skill level of test resources, budget, state of the application, tools available and or entrance or exit criteria.


Answers:

1. d

2. a

3. c

4. a

5. a

6. Repeatable, Controllable, Coverage.

7. True

8. Test Scope

9. Test Objective

10.Test environment

Vocabulary Answers:

H, A, B, E, J, G, C.

Interview

Testing is the evaluation of process it verify to specified specification and identified the difference between the actual and expected results.

Testing Life Cycle

Unlike SDLC (Software Development life cycle) there is STLC (software testing life cycle). Different Organizations have different names of phases in defining the life cycle. But broadly we can summarize as follows

A systematic approach to testing that normally includes these phases:

1. Risk Analysis

2. Planning Process

3. Test Design

4. Performing Test

5. Defect Tracking and Management

6. Quantitative Measurement

7. Test Reporting

1. Risk Analysis

A. Risk Identification

1. Software Risks - Knowledge of the most common risks associated with software development, and the platform you are working on.

2. Testing Risks - Knowledge of the most common risks associated with software testing for the platform you are working on, tools being used, and test methods being applied.

3. Premature Release Risk - Ability to determine the risk associated with releasing unsatisfactory or untested software products.

4. Business Risks - Most common risks associated with the business using the software.

5. Risk Methods - Strategies and approaches for identifying risks or problems associated with implementing and operating information technology, products, and processes; assessing their likelihood, and initiating strategies to test for those risks.

B. Managing Risks

1. Risk Magnitude - Ability to rank the severity of a risk categorically or quantitatively.

2. Risk Reduction Methods - The strategies and approaches that can be used to minimize the magnitude of a risk.

3. Contingency Planning - Plans to reduce the magnitude of a known risk should the risk event occur.CSTE Body of Knowledge
Skill Category 6

2. Test Planning Process

A. Pre-Planning Activities

1. Success Criteria/Acceptance Criteria - The criteria that must be validated through testing to provide user management with the information needed to make an acceptance decision.

2. Test Objectives - Objectives to be accomplished through testing.

3. Assumptions - Establishing those conditions that must exist for testing to be comprehensive and on schedule; for example, software must be available for testing on a given date, hardware configurations available for testing must include XYZ, etc.

4. Entrance Criteria/Exit Criteria - The criteria that must be met prior to moving to the next level of testing, or into production.

B. Test Planning

1. Test Plan - The deliverables to meet the test’s objectives; the activities to produce the test deliverables; and the schedule and resources to complete the activities.

2. Requirements/Traceability - Defines the tests needed and relates those tests to the requirements to be validated.

3. Estimating - Determines the amount of resources required to accomplish the planned activities.

4. Scheduling - Establishes milestones for completing the testing effort.

5. Staffing - Selecting the size and competency of staff needed to achieve the test plan objectives.

6. Approach - Methods, tools, and techniques used to accomplish test objectives.

7. Test Check Procedures (i.e., test quality control) - Set of procedures based on the test plan and test design, incorporating test cases that ensure that tests are performed correctly and completely.

C. Post-Planning Activities

1. Change Management - Modifies and controls the plan in relationship to actual progress and scope of the system development.

2. Versioning(change control/change management/configuration management) - Methods to control, monitor, and achieve change.

3. Test Design

A. Design Preparation

1. Test Bed/Test Lab - Adaptation or development of the approach to be used for test design and test execution.

2. Test Coverage - Adaptation of the coverage objectives in the test plan to specific system components.

B. Design Execution

1. Specifications - Creation of test design requirements, including purpose, preparation and usage.

2. Cases - Development of test objectives, including techniques and approaches for validation of the product. Determination of the expected result for each test case.

3. Scripts - Documentation of the steps to be performed in testing, focusing on the purpose and preparation of procedures; emphasizing entrance and exit criteria.

4. Data - Development of test inputs, use of data generation tools. Determination of the data set or sub-set needed to ensure a comprehensive test of the system. The ability to determine data that suits boundary value analysis and stress testing requirements.

4. Performing Tests

A. Execute Tests - Perform the activities necessary to execute tests in accordance with the test plan and test design (including setting up tests, preparing data base(s), obtaining technical support, and scheduling resources).

B. Compare Actual versus Expected Results - Determine if the actual results met expectations (note: comparisons may be automated).

C. Test Log - Logging tests in a desired form. This includes incidents not related to testing, but still stopping testing from occurring.

D. Record Discrepancies - Documenting defects as they happen including supporting evidence.

5. Defect Tracking and Correction

A. Defect Tracking

1. Defect Recording - Defect recording is used to describe and quantify deviations from requirements.

2. Defect Reporting - Report the status of defects; including severity and location.

3. Defect Tracking - Monitoring defects from the time of recording until satisfactory resolution has been determined.

B. Testing Defect Correction

1. Validation - Evaluating changed code and associated documentation at the end of the change process to ensure compliance with software requirements.

2. Regression Testing - Testing the whole product to ensure that unchanged functionality performs as it did prior to implementing a change.

3. Verification - Reviewing requirements, design, and associated documentation to ensure they are updated correctly as a result of a defect correction.

6. Acceptance Testing

A. Concepts of Acceptance Testing - Acceptance testing is a formal testing process conducted under the direction of the software user’s to determine if the operational software system meets their needs, and is usable by their staff.

B. Roles and Responsibilities - The software tester’s need to work with users in developing an effective acceptance plan, and to ensure the plan is properly integrated into the overall test plan.

C. Acceptance Test Process - The acceptance test process should incorporate these phases:

1. Define the acceptance test criteria

2. Develop an acceptance test plan

3. Execute the acceptance test plan

7. Status of Testing

Metrics specific to testing include data collected regarding testing, defect tracking, and software performance. Use quantitative measures and metrics to manage the planning, execution, and reporting of software testing, with focus on whether goals are being reached.

A. Test Completion Criteria

1. Code Coverage - Purpose, methods, and test coverage tools used for monitoring the execution of software and reporting on the degree of coverage at the statement, branch, or path level.

2. Requirement Coverage - Monitoring and reporting on the number of requirements exercised, and/or tested to be correctly implemented.

B. Test Metrics

1. Metrics Unique to Test - Includes metrics such as Defect Removal Efficiency, Defect Density, and Mean Time to Last Failure.

2. Complexity Measurements - Quantitative values accumulated by a predetermined method, which measure the complexity of a software product.

3. Size Measurements - Methods primarily developed for measuring the software size of information systems, such as lines of code, function points, and tokens. These are also effective in measuring software testing productivity.

4. Defect Measurements - Values associated with numbers or types of defects, usually related to system size, such as 'defects/1000 lines of code' or 'defects/100 function points'.

5. Product Measures - Measures of a product’s attributes such as performance, reliability, failure, usability,

8. Test Reporting

A. Reporting Tools - Use of word processing, database, defect tracking, and graphic tools to prepare test reports.

B. Test Report Standards - Defining the components that should be included in a test report.

C. Statistical Analysis - Ability to draw statistically valid conclusions from quantitative test results.