Nickson
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # TEST DESIGN TECHNIQUES ###### tags: `ISTQB` `SQA` the chapter explores the **three categories of test case design techniques:** - specification-based - structure-based - experience-based. ## THE TEST DEVELOPMENT PROCESS The specification of test cases is the second step in the fundamental test process (FTP) defined in Chapter 1. ![](https://i.imgur.com/Gg6P1qP.png) The design of tests comprises **three main steps:** 1. Identify test conditions. 2. Specify test cases. 3. Specify test procedures. ### A test condition :::info :star: **Definition** ***An*** item or event of a component or system that could be verified by <span style="color:red;">***one or more</span> test cases***, for example a function, transaction, feature, quality attribute or structural elemen. ::: - In other words, a test condition is some characteristic of our software that we can check with a test or a set of tests. ### A test case :::info :star: **Definition** ***A*** set of *input values, execution preconditions, expected results and execution postconditions*, developed for ***a particular objective or test condition***, such as to exercise a particular program path or to verify compliance with a specific requirement. ::: - In other words, a test case: 1. gets the system to some starting point for the test (execution preconditions) 2. then applies a set of input values that should achieve a given outcome (expected result) 3. and leaves the system at some end point (execution postcondition). :::spoiler For example We have to define what state the system is in when we start so that it is ready to receive the inputs and we have to decide what state it is in after the test so that we can check that it ends up in the right place. 我們必須在啟動時定義系統所處的狀態,以便準備接收輸入,並且必須在測試後確定係統所處的狀態,以便我們可以檢查它是否位於正確的位置。 ::: ### A test procedure specification :::info :star: **Definition** ***A*** sequence of actions for the execution of ***a*** test. ::: So, going back to our three step process above, we: 1. decide on a test condition, which would typically be a small section of the specification for our software under test; 2. design a test case that will verify the test condition; 3. write a test procedure to execute the test, that is get it into the right starting state, input the values, and check the outcome. ### Mapping relation example ```graphviz digraph condiction_case_procedure_execution{ rankdir="LR" // 'A' test condiction can be verified by 'one or more' test cases. "a specificaion1" ->{ "a test condiction1" "a test condiction2" } "a specificaion2" ->{ "a test condiction3" "a test condiction4" } "a test condiction1" ->{ "a test case1-1" "a test case1-2" "a test case1-3" } "a test condiction2" ->{ "a test case2-1" "a test case2-2" } "a test condiction3" ->{ "a test case3-1" "a test case3-2" } "a test condiction4" ->{ "a test case4-1" "a test case4-2" } // 'A' test procedure specification – a sequence of actions for the execution of 'a' test. "a test case1-1" ->"a test procedure\n specification1-1" "a test case1-2" ->"a test procedure\n specification1-2" "a test case1-3" ->"a test procedure\n specification1-3" "a test case2-1" ->"a test procedure\n specification2-1" "a test case2-2" ->"a test procedure\n specification2-2" "a test case3-1" ->"a test procedure\n specification3-1" "a test case3-2" ->"a test procedure\n specification3-2" "a test case4-1" ->"a test procedure\n specification4-1" "a test case4-2" ->"a test procedure\n specification4-2" // A test execution schedual collects a set of tests or test procedure specifications. { "a test procedure\n specification1-1", "a test procedure\n specification1-3", "a test procedure\n specification2-1", "a test procedure\n specification2-2", "a test procedure\n specification3-1", "a test procedure\n specification4-2" }->"a test execution schedual" } ``` - according to the project condition In some situations it may be appropriate to produce very little documentation and in others a very formal and documented process may be appropriate. 在某些情況下,生成很少的文檔可能是適當的,在其他情況下,非常正式且有文檔記錄的過程可能是合適的。 Safety-critical systems, for example, will normally require a more formal test process. - In preparation for execution the test execution the test execution schedule collects together all the tests and sequences them, **taking into account any priorities** (highest priority tests would be run first) and any **dependencies between tests**. ### THE IDEA OF TEST COVERAGE **it provides a quantitative assessment of the extent and quality of testing.** - important 2 reason - It provides a quantitative measure of the quality of the testing that has been done by measuring what has been achieved. - It provides a way of estimating how much more testing needs to be done. Using quantitative measures we can set targets for test coverage and measure progress against them. If we apply coverage measures to testing based on priorities, which are themselves based on the risks addressed by individual tests, we will have a reliable, objective and quantified framework for testing. ### CATEGORIES OF TEST CASE DESIGN TECHNIQUES - The test case design techniques three categories - Black-box specification-based - based on specification or model of a system or proposed. - black-box techniques are based on an analysis of the test basis documentation, including both functional and non-functional aspects. They do **not use** any information regarding the **internal structure of the component or system** under test. - White-box structure-based - based on structure of a component or system - experience-based techniques - test case from the tester’s experience ### SPECIFICATION-BASED (BLACK-BOX) TECHNIQUES The main thing about specification-based techniques is that **they derive test cases directly from the specification or from some other kind of model of what the system** should do. :::spoiler 如果定義的好的益處 If a test basis is well defined and adequately structured we can easily identify test conditions from which test cases can be derived. ::: The most important point about specification-based techniques is that - specifications or models do not (and should not) define how a system should achieve the specified behaviour when it is built - it is a specification of the required (or at least desired) behaviour. :::danger If they have misunderstood the specification or chosen to change it in some way without telling anyone then their implementation will deliver behaviour that is different from what the model or specification said the system behaviour should be. Our test, based solely on the specification, will therefore fail and we will have uncovered a problem. ::: :::info :star: **If there is no specification at all** the tester may have to build a model of the proposed system, perhaps by interviewing key stakeholders to understand what their expectations are. ::: #### five specification-based techniques for the Foundation Certificate - Equivalence partitioning. - Boundary value analysis. - Decision table testing. - State transition testing. - Use case testing. #### Equivalence partitioning - Input partitions - Equivalence partitioning is based on a very simple idea: it is that in many cases the inputs to a program can be ‘chunked’ into groups of similar inputs. **For example, a program that accepts integer values can accept as valid any input that is an integer(i.e. a whole number) and should reject anything else (such as a real number or a character).** :::spoiler example If we imagine a program that separates numbers into two groups according to whether they are positive or negative the total range of integers could be split into three ‘partitions’: the values that are less than zero; zero; and the values that are greater than zero. ::: :::info **excercise 4.1** Suppose you have a bank account that offers variable interest rates: 0.5 per cent for the first £1,000 credit; 1 per cent for the next £1,000; 1.5 per cent for the rest. If you wanted to check that the bank was handling your account correctly what valid input partitions might you use? ::: :::success Answer: split three partitions: 0~1000 ,1001~2000 , over 2001 ::: :::info **excercise 4.2** A mail-order company selling flower seeds charges £3.95 for postage and packing on all orders up to £20 value and £4.95 for orders above £20 value and up to £40 value. For orders above £40 value there is no charge for postage and packing. If you were using equivalence partitioning to prepare test cases for the postage and packing charges what valid partitions would you define? What about non-valid partitions? The answer can be found at the end of the chapter. ::: :::success Answer: split three partitions: 1~20 , 21~40 , over 40 non-valid: 0 , negative ::: #### Boundary value analysis **One thing we know about the kinds of mistakes that programmers make is that errors tend to cluster around boundaries.** >For example, if a program should accept a sequence of numbers between 1 and 10, the most likely fault will be that values just outside this range are incorrectly accepted or that values just inside the range are incorrectly rejected. :::info For this variant, which is the one documented in BS 7925-2, we include one more value at each boundary when we use boundary value analysis: **the rule is that we use the boundary value itself and one value (as close as you can get) either side of the boundary.** ::: :::info **BS 7925-2**: the software component testing standard. Publisher: IEEE ::: :::info **Exercise 4.3** A system is designed to accept scores from independent markers who have marked the same examination script. Each script should have 5 individual marks, each of which is out of 20, and a total for the script. Two markers’ scores are compared and differences greater than three in any question score or 10 overall are flagged for further examination. Using equivalence partitioning and boundary value analysis identify the boundary values that you would explore for this scenario. ::: :::success **Equivalence partitioning Answer:** each scores 0 - 20 total 0 - 100 different 0 - 3 and over 3 total different 0-10 and over 10 **Boundary analysis Answer:** each score -1 0 1 and 19 20 21 total -1 0 1 and 99 100 101 different -1 0 1 and 2 3 4 total different -1 0 1 and 9 10 11 ::: #### Decision table testing Specifications often contain business rules to define the functions of the system and the conditions under which each function operates. **As testers we need to be able to assure ourselves that every combination of these conditions that might occur has been tested**, so we need to capture all the decisions in a way that enables us to explore their combinations. The mechanism usually used to capture the logical decisions is called a decision table. ![](https://i.imgur.com/wzLojRs.png) **we do not enter every possible combination of conditions into our decision table**, but restrict it to those combinations that correspond to business rules – **this is called a limited entry decision table** to distinguish it from a decision table with all combinations of inputs identified. **DECISION TABLE TESTING – EXAMPLE 4.3** A supermarket has a loyalty scheme that is offered to all customers. Loyalty cardholders enjoy the benefits of either additional discounts on all purchases (rule 3) or the acquisition of loyalty points (rule 4), which can be converted into vouchers for the supermarket or to equivalent points in schemes run by partners. Customers without a loyalty card receive an additional discount only if they spend more than £100 on any one visit to the store (rule 2), otherwise only the special offers offered to all customers apply (rule 1). ![](https://i.imgur.com/dHexdto.png) **From the decision table we can determine test cases by setting values for the conditions and determining the expected output**, for example from rule 1 we could input a normal customer with a £50 transaction and check that no discount was applied. The same customer with a £150 transaction (rule 2) should attract a discount. **Thus we can see that each column of the decision table represents a possible test case.** :::info **Exercise 4.4** A mutual insurance company has decided to float its shares on the stock exchange and is offering its members rewards for their past custom at the time of flotation. Anyone with a current policy will benefit provided it is a ‘with-profits’ policy and they have held it since 2001. Those who meet these criteria can opt for either a cash payment or an allocation of shares in the new company; those who have held a qualifying policy for less than the required time will be eligible for a cash payment but not for shares. Here is a decision table reflecting those rules. ![](https://i.imgur.com/TCKfUqQ.png) ::: What expected result would you expect to get for the following test case? Billy Bunter is a current policy holder who has held a ‘with-profits’ policy since 2003. :::success Billy可以拿到現金,但不會拿到股票 ::: #### State transition testing in other words, **behaviour depends on current state and past state, and it is the transitions that trigger system behaviour.** It will be no surprise to learn that this technique is known as state transition testing or that the main diagram used in the technique is called a state transition diagram. ![](https://i.imgur.com/bNXT9M1.png) **which is the symbol for a state.** A state is just what it says it is: the system is ‘static’, in a stable condition from which **it will only change if it is stimulated by an event of some kind**. For example, a TV stays ‘on’ unless you turn it ‘off’; a multifunction watch tells the time unless you change mode. ![](https://i.imgur.com/pb77EaW.png) **which is the symbol for a transition, that is a change from one state to another.** **The state change will be triggered by an event (e.g. pressing a button or switching a switch).** The transition will be labelled with the event that caused it and any action that arises from it. So we might have ‘mode button pressed’ as an event and ‘presentation changes’ as the action. <style> .blue { color: blue; } </style> >STATE TRANSITION DIAGRAM – EXAMPLE 4.4 A hill-walker’s watch <span class="blue">has two modes: Time and Altimeter</span>. **In Time mode, pressing the Mode switch causes the watch to switch to Alt mode; pressing Mode again returns to Time mode. While the watch is in Alt mode the Set button has no effect.** >When the watch is in Time mode pressing the Set button transitions the watch into Set Hrs, from which the Hrs display can be incremented by pressing the Set button. >If the Mode switch is pressed while the watch is in Set Hrs mode the watch transitions to Set Mins mode, in which pressing the Set button increments the Mins display. If the Mode button is pressed in this mode the watch transitions back to Time mode (Figure 4.1). Note that not all events have an effect in all states. Where an event does not have an effect on a given state it is usually omitted, but it can be shown as an arrow starting from the state and returning to the same state to indicate that no transition takes place; this is sometimes known as a ‘null’ transition or an ‘invalid’ transition. ![](https://i.imgur.com/J88a07o.png) ![](https://i.imgur.com/HtinBOG.png) :::info Exercise 4.5 In the state transition diagram in Figure 4.2, which of the sequences of transitions below would be valid? a. ABCDE b. FEABC c. ABCEF d. EFADC ![](https://i.imgur.com/l1P5BX8.png) ::: :::success b FEABC ::: #### Use case testing **Use cases are one way of specifying functionality as business scenarios or process flows.** They capture the individual interactions between ‘actors’ and the system. **An actor represents a particular type of user** and the use cases capture the interactions that each user takes part in to produce some output that is of value. Test cases based on use cases at the business process level, often called scenarios, are particularly useful in exercising business rules or process flows and will often identify gaps or weaknesses in these that would not be found by exercising individual components in isolation. **This makes use case testing very effective in defining acceptance tests because the use cases represent actual likely use.** Well-defined use cases can therefore be an excellent basis for system level testing, and they can also help to uncover integration defects caused by incorrect interaction or communication between components. >**USE CASES** In a use case diagram (e.g. Figure 4.3) each type of user is known as an actor, and an actor stands for all users of the type. Use cases are activities carried out for that actor by the system. This is, in effect, a high-level view of requirements. The diagram alone does not provide enough detail for testing, so we need some textual description of the processes involved as well. ![](https://i.imgur.com/rrHfURX.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully