TS 65 Diff

Diff Test Specification for Editable Diff

Author: Peter Pis
Version: 1.1
Lastupdate: 2008/11/13
Introduction: Diff module provides ability to find and highlight differences between two files. This document describes how this module should be tested in order to verify all of its functionality.

Contents

Test suite: Diff sidebar (Inline diff)

Purpose: This suite tests functionality of inline diff in editor.
Setup: Open a project versioned in any version control system supported by NetBeans (Subversion, CVS, Mercurial) and open some .java file into the editor.

  1. Diff sidebar
    1. Invoke View from main menu and make sure that Show Diff Sidebar is checked.
    2. Insert several brand-new lines somewhere into the file.
    3. Delete some other lines, but not directly next to those new lines.
    4. Modify another line but not directly next to the lines mentioned above.
    • EXPECTED RESULT: All differences must be highlighted in a sidebar located before beginning of each line. New lines are marked green, line where are missing removed lines is marked with red triangle and modified lines are marked blue.
  2. Differences
    1. Move the mouse cursor to those colored marks and don't move it for a while. A hint should appear with message how many lines were added, deleted or changed.
    2. Click on any of those colored marks. Floating toolbar with four icons should appear.
    3. If the clicked mark was blue or red, there will be also blue or red area below the toolbar with original text before the change.
    4. Try using the up and down arrows. Every time you use either of them, you should jump to previous or next difference in that file.
    5. Click on the revert arrow (the third one in floating toolbar). The mark should disappear and the change should be reverted. Note that you can use undo action to redo the change.
    6. Click the diff icon (the fourth one) on the floating toolbar.
    • EXPECTED RESULT: New tab in editor should be opened. It will be described in detail in next suite.


Test suite: Editable diff

Purpose: This suite tests functionality of diff view in editor.
Setup: Open the diff tab as described in previous suite.

  1. Diff view
    1. The newly opened editor tab should contain a toolbar with arrows for navigating among differences and a split pane. It should have base revision of that file in the left pane and locally version of that file in the right pane. The left pane shouldn't be editable while the right one should be.
    2. It should have base revision of that file in the left pane and locally version of that file in the right pane.
    3. There should be also a label with two numbers divided by slash in above of the middle of the pane screen. The first number is currently displayed difference and the second is the total number of differences.
    • EXPECTED RESULT: The left pane shouldn't be editable while the right one should be. Verify that the right diff pane is a fully functional editor with semantic coloring, code completion, undo / redo, etc.
  2. Using the diff view
    1. The differences are again marked with three colors - new lines are marked green, deleted lines are marked red and modified lines are marked blue. If there are only some changes on lines and no new lines were added, only the changed words are marked blue on those lines.
    2. There is an arrow next to the first line of each difference with deleted or modified (blue or red) lines in the left diff pane. Similarly there is a red cross next to the first line of each difference with new (green) lines in the right diff pane. There is also a different arrow below the label with difference count.
    3. Use described arrow and cross for each type of difference.
    • EXPECTED RESULT: Verify that the marked lines in the right diff pane were reverted to the state they were before the change. Push the arrow below below the label with difference count. The result should be as if you would push all arrows and crosses to revert the whole file to the state it was before those changes.
  3. Navigating among difference
    1. Use arrows in the toolbar to navigate among the differences. They should be enabled only if there is more than one difference.
    2. Currently selected difference can be distinguished from the others by the bold boundary lines. You can also see the sequence number of the difference on the previously mentioned label.
    • EXPECTED RESULT: Verify that the "
      Go to next difference
      " arrow is disabled if you are on the last difference in file. Similarly the "{Go to previous difference}" arrow should be disabled if you are on the first difference.


Test suite: Diffing common files

Purpose: This suite tests functionality of diff used on two files not versioned by any versioning system.
Setup: No special setup is needed

  1. Diff to...
    1. Select file from the Projects view.
    2. Invoke Tools | Diff to... either from context or main menu.
    3. In upcoming dialog choose desired file and push Diff button.
    • EXPECTED RESULT: Verify that the diff view appeared. It should be the same diff view as described in one of previous suites with all its functionality. There should "UP", "DOWN" arrows for navigating among differences and buttons: "Refresh Diff" tooltip, "Swap", "Export..." and "Options..."
  2. Diff two files
    1. Select two files at once from the Projects view (Hold CTRL while clicking on these two files).
    2. Invoke Tools | Diff either from context or main menu.
    • EXPECTED RESULT: Verify that the diff view appeared. It should be the same diff view as described in one of previous suites with all its functionality. There should "UP", "DOWN" arrows for navigating among differences and buttons: "Refresh Diff" tooltip, "Swap", "Export..." and "Options..."
  3. Refresh Diff
    1. Externally modify and save one of the file (eg add new line).
    2. Now in the IDE push
      "Refresh Diff"
      button.
    • EXPECTED RESULT: New difference(s) is highlighted in the Diff viewer.
  4. Swap
    1. Push
      "Swap"
      button.
    • EXPECTED RESULT: Files are swapped in Diff viewer. Push
      "Swap"
      several times and make sure that files are swapped properly.
  5. Export...
    1. Push
      "Export..."
      button.
    2. "Export"
      dialog is displayed.
    3. It's a JFileChooser component, you should be able to explorer the filesystem. You can enter new name (diff.patch) for patch or use existing one.
    • EXPECTED RESULT: Enter new name into
      "Save As"
      field. Verify whether patch file was generated correctly. (base file is taken from the left panel of the Diff viewer). Now enter again the same name. You should be asked whether the existing file should be overwritten. If "NO" button is pushed then the content of the file shouldn't be changed. If "YES" is pushed then the content should be changed accordingly. Verify it.
  6. Options...
    1. Push
      "Options..."
      button.
    • EXPECTED RESULT:
      "Tools | Options | Miscellaneous | Diff"
      panel should be opened.


Test suite: Patch

Purpose: Verifies applying patch functionality.
Setup: No special setup needed.

  1. Applying Patch
    1. Select the base (that was in left panel of Diff viewer) file from within
      "Projects"
      view used for creation of the patch in previous Test Suite..
    2. Invoke Tools | Apply Diff Patch popup menu action, choose the patch file ("diff.patch") and push Patch.
    3. Confirm dialog - changes are assumed to be displayed.
    • EXPECTED RESULT: Diff viewer is opened with same differences as were in previous Test Suite when the patch was created. Verify also answering "NO" to dialog after applying changes. No Diff viewer should be displayed then.


Test suite: Conflict resolving

Purpose: Verifies conflict resolution.
Setup: CVS repository should be available. Import project into repository

  1. Create conflict
    1. Modify
      "Main.java"
      file and save it.
    2. Invoke Versioning | Checkout... from main menu and setup the same parameters as for SETUP of this Test Suite
      "Local Folder"
      location.
    3. Open the same project, modify
      "Main.java"
      class at the same line as in previous test suite, and commit it.
    4. Return to previous project, select the project root and invoke Versioning | Update Project with Dependencies popup menu action.
    • EXPECTED RESULT:
      "Warning"
      dialog about local conflicts should be displayed. Path to {"Main.java"} file should be indicated with red badges. This file should change its color to red too. Verify functionality of All, Local and Remote buttons in "CVS" tab.
  2. Resolve conflict
    1. Invoke CVS | Resolve conflicts... popup menu action on
      "Main.java"
      node.
    2. Merging tool must get opened in editor area highlighting the line with conflict. Left pane should read
      "Local Working File"
      , right pane {"Remote File"} and bottom should read "Result after merge".
    3. Select left modification (the working one) and push
      "Accept"
      button above its pane.
    4. Make sure that colors changed to blue or green and
      "Unresolved:"
      in top of the component says {"0 conflicts"}. Push "OK" button and confirm your decision.
    • EXPECTED RESULT: The data node should change back to
      "Main.java"
      and should have appropriate badge (blue badges for path). In addition, the merge tool must be closed.


Test suite: Diff Options

Purpose: This suite tests functionality of Diff Options
Setup: Open the diff tab as described in Diff sidebar suite.

  1. Invoking Options
    • Setup: Invoke
    1. Invoke Tools | Options from main menu.
    2. Push
      "Miscellaneous"
      button.
    3. Expand
      "Diff"
      node.
    • EXPECTED RESULT: There should be
      "Internal Diff"
      and {"External Diff"} radio buttons, "Ignore Leading and Trailing White Space", "Ignore Changes in Inner White Space" and "Ignore Changes In Case" check boxes and a textfield with "Browse" button on the same line.
  2. External Diff
    • Setup: Open Diff Options as was described in previous Case.
    1. Select the
      "External Diff"
      radiobutton. This should result in enabling {"Command";} textfield and "Browse" button. "Ignore Leading and Trailing White Space", "Ignore Changes in Inner White Space" and "Ignore Changes In Case" check boxes are disabled always for external diff.
    2. If you don't have path to external diff tool in your PATH variable, you can use the
      "Browse"
      button to specify its location.
    3. Confirm your choice by pressing
      "OK"
      button.
    • EXPECTED RESULT: Verify that the diff view you have opened doesn't change at all. It should mark the differences in the same way as the internal diff.
  3. Ignore Leading and Trailing White Space
    • Setup: Open Diff Options as was described in Invoking Options Case.
    1. Select
      "Internal Diff"
      option and check the {"Ignore Leading and Trailing White Space"} checkbox.
    2. Confirm your choice by pressing
      "OK"
      button.
    3. Make some leading and trailing spaces on some line and save the file.
    • EXPECTED RESULT: The line shouldn't be marked as different. Should you uncheck the
      "Ignore Leading and Trailing White Space"
      and made some leading or trailing spaces again, it should be marked as modified line.
  4. Ignore Changes in Inner White Space
    • Setup: Open Diff Options as was described in Invoking Options Case.
    1. Select
      "Internal Diff"
      option and check the {"Ignore Changes in Inner White Space"} checkbox.
    2. Confirm your choice by pressing
      "OK"
      button.
    3. Make some spaces between words on some line and save the file.
    • EXPECTED RESULT: The line shouldn't be marked as different. Should you uncheck the
      "Ignore Changes in Inner White Space"
      and made some spaces between words again, it should be marked as modified line.
  5. Ignore Changes In Case
    • Setup: Open Diff Options as was described in Invoking Options Case.
    1. Select
      "Internal Diff"
      option and check the {"Ignore Changes In Case"} checkbox.
    2. Confirm your choice by pressing
      "OK"
      button.
    3. Make some change of case only on some line and save the file.
    • EXPECTED RESULT: The line shouldn't be marked as different. Should you uncheck the
      "Ignore Changes In Case"
      and made change in case again, it should be marked as modified line.
  6. Color Options
    • Comments: Changes of colors don't affect colors of
      "Diff sidebar"
      !
    1. Invoke Tools | Options from main menu.
    2. Push
      "Fonts & Colors"
      button.
    3. Select the
      "Diff"
      tab.
    • EXPECTED RESULT: There should be table with colors for different types of differences on the second one. Verify that the changes have proper effect in
      "Diff view"
      .

}}
}}

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo