TS 68 EditorUtilities

Editor - Utilities Test Specification

Author: Jiri Prox
Version: 6.8
Last update: Date: 10.8.2009
Introduction: This test specification covers several features from Editor module, which are not included to the basic specification. It does not cover features which are related to basic code editing and navigating in editor but it focus on advanced features which provides advanced functionality (printing ...) or make basic editing easier (code templates, macros, code generating)
Comments: There is not provided any sample project, any j2se project will be enough to go through this testspec.


Contents


Test suite: Print to HTML

Purpose:
Setup:

  1. Menu Print to HTML
    1. Check main menu File|Print to HTML.
    • EXPECTED RESULT: Name of menu is "Print to HTML", mnemonic is on 'H'. Enabled only when a file is selected in Explorer window. Verify this.
  1. Default values
    1. Open a java file.
    2. Invoke "Print to HTML" dialog.
    • EXPECTED RESULT: Default file location is in your home directory. ( e.g. /home/pf120623/Test.java )
      Colors used are the same as those in Editor. It is not possible to have different colors for html printing and editor.
      Option "Print only selected text" is enabled only if piece of code is selected in the editor. In this case, it is selected by default.
      Option "Show line numbers" is enabled is line numbers are visible in editor.
      Option "Open generated HTML in browser" is enabled for all time and not selected by default.
  1. Select Location
    1. Open Print to HTML dialog.
    2. Type a path of file to text field. E.g. /tmp/test.html
    3. Click to [...] button -> File chooser dialog
    4. Click Cancel in file chooser dialog
    5. Click to [...] button anyway -> File chooser dialog
    6. Change path. E.g. /var/tmp/test2.html and confirm file chooser dialog by Open.
    7. Confirm Print to HTML dialog by Ok button.
    • EXPECTED RESULT: The path shouldn't be changed after step 4. (must be /tmp/test.html)
      The path should be changed in step 6. There should be created new file /var/tmp/test2.html
  1. Select Only selected text
    1. Select some rows of code in the Editor.
    2. Open Print to HTML dialog and confirm it.
    • EXPECTED RESULT: The checkbox "Print only selected text" should be enabled and selected. There should be a html file created, containing only selected text. Check this in HTML browser.
  1. Select Open generated HTML in browser
    1. Open Print to HTML dialog.
    2. Select option "Open generated HTML in browser"
    3. Confirm the dialog with Ok button
    • EXPECTED RESULT: File should be generated and opened in default HTML browser.
  1. Select show line numbers
    1. Enable Show line numbers in the Editor from Options* dialog or from popup menu over the gutter.
    2. Open "Print to HTML" dialog and confirm it by Ok button.
    • EXPECTED RESULT: Check generated HTML file in web browser. Line numbers must be present.


Test suite: Java Macros

Purpose:
Setup:

  1. Create Macro
    1. Start macro recording (Ctrl+J S or from editor toolbar)
    2. Write some text in editor, move cursor and try to invoke some formatting actions (Shift Line, Comment etc.)
    3. Finish recording macro (Ctrl+J E or in editor toolbar)
    4. Inside appeared dialog, type new macro's name and choose some keybindings for it.
    5. Open java source file into editor and try using new macro's keybinding.
    • EXPECTED RESULT: Macro should be added to the list and properly works.
  1. Create Macro in Options
    1. Open Tools|Options|Editor|Macros
    2. Click to Add button and create new macro
    3. Set shortcut for the new macro
    • EXPECTED RESULT: The new macro is created and works in the editor. In the list of macros there are some default macros and macros created in previous testcases.
  1. Change macro shortcut
    1. Open Tools

Test suite: Search

Purpose: This suite tests inline search.
Setup: Opened any file in editor

  1. Open/Close bar
    1. Press Ctrl-F to open search bar
    2. Click on the cross symbol in the left part of the bar
    3. Open bar again and put focus back in editor (click to the editor)
    • EXPECTED RESULT: Incremental Search bar is opened, focus is automatically transfered to the Find textfield. In both steps 2) and 3) the bar is closed.
  1. Search forward
    1. Press Ctrl-F to open search bar
    2. Enter string which occurs several times in the actual file
    3. Press Next button several times (or Enter if focus is in textfield)
    • EXPECTED RESULT: When typing the matching text is highlighted in editor. After pressing Next button, next matching text is selected. The search continues from the top of document if end is reached.
  1. Search backwards
    1. Press Ctrl-F to open search bar
    2. Enter string which occurs several times in the actual file
    3. Press Previous button several times (or Shift-Enter if focus is in textfield)
    • EXPECTED RESULT: When typing the matching text is highlighted in editor (as in previous testcase). After pressing Previous button, previous matching text is selected.
  1. Search - matching case & initial value
    1. Press Ctrl-F to open search bar
    2. Check Match Case checkbox
    3. Perform search and close bar
    4. Reopen the bar again
    • EXPECTED RESULT: Search respect the case when checkbox is selected. After reopening search bar the Find textfield contains last value, and the Match Case checkbox is in the same state as it was before.
  1. Search - negative testcase
    1. Press Ctrl-F to open search bar
    2. Enter text which does not occur in document
    • EXPECTED RESULT: Warning that searched text cannot be found is displayed (in status bar of editor) and text in Find textfield is red
  1. Search - other options
    1. Press Ctrl-F to open search bar
    2. Try functionality of each checkbox in the bar separately
    • EXPECTED RESULT: Each checkbox is working right (the same results as in Find/Replace suite)
  1. Search - resize
    1. Press Ctrl-F to open search bar
    2. Resize the main window to make search bar exceed the window size
    3. Make the window big enough to contain whole search bar
    • EXPECTED RESULT: The new button (double arrow) is added and the checkboxes which doesn't fit into the window are added to the menu which shows after clicking on the new button


Test suite: Find/Replace Test

Purpose: This suite tests the find dialog.
Setup: Opened any file in editor and focus should be on editor window.

  1. Replace Dialog Open Close
    1. Open find dialog from main menu (Alt+E|E or with mouse).
    2. Press the Esc key.
    3. Open find dialog (Ctrl+H).
    4. Click on the Help button and wait till help is opened.
    5. Close help (use small cross on window).
    6. Click on the Close button.
    • EXPECTED RESULT: Dialog must be opened and then closed. The Help window must by closed, too.
  1. Find Selection Repeated
    1. Select a piece of text, and invoke replace dialog (Ctrl+H).
    2. Immediately press "Find" button.
    3. Select another piece of text, invoke replace dialog (Ctrl+H).
    4. Immediately press "Find" button.
    • EXPECTED RESULT: When replace dialog is opened, the "Find What" input line should contain selected piece of code. After pressing "Find" button, appropriate text should be found.
  1. Replace Dialog Combo Box
    1. Perform three searches (for three different words/texts).
    2. Invoke the replace dialog (Ctrl+H).
    3. The line "Find What:" is a combo box. Try to use it.
    4. When you select a word from combo box, perform "Find" on it.
    • EXPECTED RESULT: The combo box should contain all texts you were searching for. These texts should be fully functional, including searching for these texts.
  1. No Find - Unselected All Options
    1. Open replace dialog.
    2. Unselect all checkboxes in the dialog.
    3. Type some word which is not contained in editor (e.g. foo).
    4. Press the Find button.
    • EXPECTED RESULT: Status line of editor should have red background and should contain text 'foo' not found.
  1. Find - Option Match Case
    1. Open replace dialog (in the same file as previous case).
    2. Select only Match Case.
    3. Type a word which editor contains, but change case in the searched word e.g. use Private (we are searching for "private" modifier in source file) -> message "Private" not found in status bar.
    4. Open the dialog anyway and type exactly the word private.
    5. Press the Find button.
    • EXPECTED RESULT: Word "private" should be found.
  1. Find - Option Match Whole Words Only
    1. Open replace dialog.
    2. Unselect all checkboxes.
    3. Select Match Whole Words Only.
    4. Type word which editor contains (this word should be typed 1. from beginning of a row and separated witch space or 2. separated witch space character on both sides or 3. space in front of word and ended with end of row).
    5. Press the Find button.
    • EXPECTED RESULT: First occurrence of the word should be found so that it fulfills all three conditions from action 4.
  1. Find - Option Highlight Search
    1. Open replace dialog.
    2. Unselect all checkboxes.
    3. Select only Highlight Search.
    4. Type any word which exists in editor multiple times.
    5. Press the Find button.
    • EXPECTED RESULT: All occurrences of searched word should be highlighted.
  1. Find - Option Incremental Search
    1. Open replace dialog.
    2. Unselect all checkboxes.
    3. Select only Incremental Search.
    4. Type any word which exists in editor - durring typing editor tries to find strings (it is jumping to strings) and highlights them.
    5. Press the Find button.
    • EXPECTED RESULT: Editor should jump to string which you wrote to the dialog and such strings should be highlighted.
  1. Find - Option Backward Search
    1. Open replace dialog.
    2. Unselect all checkboxes.
    3. Select only Backward Search.
    4. Type any word which contained editor, the word should be positioned in front of the cursor.
    5. Press the Find button.
    • EXPECTED RESULT: The first occurrence in backward direction should be found.
  1. Find - Option Wrap Search
    1. Open replace dialog.
    2. Unselect all checkboxes.
    3. Select Wrap Search only.
    4. Type any word which exists in editor, all matched words should be in front of the cursor.
    5. Press the Find button.
    • EXPECTED RESULT: First occurrence of the searched work should be found in editor. The following messages should be displayed: "End of document reached, continuing search from beginning.".
  1. Find - Next/Previous
    1. Open the replace dialog.
    2. Unselect all checkboxes.
    3. Type a word (the word should occur in the editor 2-3 times).
    4. Press the Find button.
    5. Close find dialog. Try pressing "Find Next" (F3) and "Find Previous" (Shift+F3).
    • EXPECTED RESULT: The searched word should be found forwards and backwards from current position.
  1. Find - Selection Without Dialog
    1. Select a word in editor (the word should occur in the editor 2-3 times).
    2. Use "Find Selection" (only shortcut Ctrl-F3, no menu).
      Caution: this shortcuts are mapped to system in Linux/KDE. You must change the shortcut in IDE or in OS if this is your case.
    3. Find Next (F3)
    4. Try search for a different word (Ctrl-F3 on different word).
    • EXPECTED RESULT: Each selected word must be searched.(without dialog)
  1. Find - Search Selected Text
    1. Select several lines of text in which you will perform search.
    2. Open replace dialog, The "search in selection" checkbox should be automatically checked. Search for some word which can be found in the selection.
    3. Repeat the search to find all occurrences of the word in selected text.
    • EXPECTED RESULT: All occurrences of the word are found inside of the selected text. All words which are found are highlighted and status bar contains a message about successful search. If the word exists outside selection too, it is not found.
  1. Find - Search Selected Text Negative
    1. Select several lines of text in which you will perform search.
    2. Open replace dialog, check "find in selection" and try to search for several words which are not inside of the selection but exist somewhere in the source code.
    • EXPECTED RESULT: None of the words outside selection should be found.
  1. Find - Regular Expressions - Simple
    1. Open file testRegexpSimple.java from samples.
    2. Open replace dialog, select regexp search and search for expression:
      [[AA | aA]][[HH | hH]][[OO | oO]][[JJ | jJ]][09]{1,3} 
    • EXPECTED RESULT: There are lines in the file with "ok" on the right side. Strings on these lines should be found. Lines with "not ok" on right side should be skipped.
  1. Find - Regular Expressions - Complex
    1. Open file testRegexpComplex.java from samples.
    2. Open replace dialog, select regexp search and search for expression: a?B*c{2} dDe{1,}\.F{1,2}\s ^g
    • EXPECTED RESULT: There are lines in the file with "ok" on the right side. Strings on these lines should be found. Lines with "not ok" on right side should be skipped.


Test suite: Replace Test

Purpose: This suite tests the replace dialog.
Setup: Opened any file in editor

  1. Replace Dialog Open
    1. Open replace dialog (Ctrl+H, Alt+E|E or with mouse).
    2. Click on the Help button and wait till help is opened.
    3. Close help (use small cross on window).
    4. Click on the Close button.
    • EXPECTED RESULT: Replace dialog and it's help should be opened and closed.
  1. Replace Selection Repeated
    1. Select a piece of text, and invoke replace dialog (Ctrl+H).
    2. Immediately press "Find" or "Replace" button.
    3. Select another piece of text, invoke replace dialog (Ctrl+H).
    4. Immediately press "Find" or "Replace" button.
    • EXPECTED RESULT: When replace dialog is opened, the "Find What" input line should contain selected piece of code. After pressing "Find" (resp. "Replace") button, approriate text should be found (resp. replaced).
  1. Replace Dialog Combo Box
    1. Perform three replacements (for three different words/texts).
    2. Invoke the replace dialog (Ctrl+H).
    3. The lines "Find What:" and "Replace With:" are combo boxes. Try to use them.
    4. When you select words from combo boxes, perform "Replace" on it.
    • EXPECTED RESULT: The combo box in line "Find What:" should contain all texts you were searching for. The combo box in line "Replace With:" should contain all texts by which you were replacing found texts. These texts should be fully functional, including searching for and replacing these texts.
  1. Replace All
    1. Select a word in editor. This word should occur in the editor 2-3 times.
    2. Open Replace dialog (Ctrl+H).
    3. Type some word to Replace With line.
    4. Press Replace All button.
    5. Close Replace dialog.
    • EXPECTED RESULT: All strings equal to selected word should be replaced by word typed in Replace With line (depends on options setting - case sensitivity, etc.) .
  1. Replace in Selection Only
    1. Select several lines of text in which you will perform replace.
    2. Open replace dialog, check "search in selection" and replace some word which can be found in the selection.
    3. Repeat the action to replace all occurences of the word in selected text.
    • EXPECTED RESULT: All occurrences of the word are found inside of the selected text. All words which are found are replaced and status bar contains a message about successfull search. If the word exists outside selection too, it is not found and thus it is not replaced.
  1. Replace undo
    1. Perform any replace
    2. Pres undo
    • EXPECTED RESULT: All changed are taken back in one step.


Test suite: Line tools

Purpose: This suite tests tool for manipulating with whole line or several lines.
Setup: Opened any file in editor

  1. Move one line
    1. Put caret in document
    2. Press Alt-(Shift)-Up / Alt-(Shift)-Down (Netbeans 6.0 use Shift, NB 5.5 don't)
    • EXPECTED RESULT: Actual line is moved one line up/down
  1. Move selection
    1. Put caret in document
    2. Select several lines
    3. Press Alt-Up / Alt-Down
    • EXPECTED RESULT: Whole selected block (including the lines which are not selected whole but at least partially) is moved
  1. Copy line
    1. Put caret in document
    2. Press Ctrl-Shift-Up / Ctrl-Shift-Down
    • EXPECTED RESULT: The actual line is duplicated below/above current line
  1. Copy block
    1. Put caret in document
    2. Select several lines
    3. Press Ctrl-Shift-Up / Ctrl-Shift-Down
    • EXPECTED RESULT: The whole selection (including whole partly selected lines) is duplicated below/above current selected block


Test suite: Bookmarks

Purpose:
Setup: Opened any file in editor

  1. Adding bookmarks
    1. Put caret at any line in document
    2. Press Ctrl-Shift-M
    3. use contex menu in gutter -> Bookmarks | Toggle Bookmark
    4. use button in editor toolbar (tooltip: Toggle Bookmark)
    • EXPECTED RESULT: Bookmark is added to current line or is removed if there is one already
  1. Navigating among bookmarks
    1. Place several bookmarks in a file
    2. Press Ctrl-Shift-Comma/Ctrl-Shift-Period
    3. Use gutter context menu - Bookmarks | Next Bookmark / Bookmarks | Previous Bookmark
    4. Use buttons in editor toolbar
    • EXPECTED RESULT: Caret cycle through bookmarked lines
  1. Bookmark persistence
    1. Place several bookmarks in a file
    2. Switch files
    3. Close/Reopen file
    4. Restart IDE
    • EXPECTED RESULT: Bookmark should stay intact
  1. Moving bookmark
    1. Put bookmark in the document
    2. Go to previous line and press enter or delete it
    • EXPECTED RESULT: Bookmark moved to mark the same line of code (e.g. is moved to next line if a new line is added before if and vice versa)
  1. Remove all bookmarks
    1. Put several bookmarks in the document
    2. Go to options dialog - Keymap
    3. Select action Other | Clear Document Bookmarks and assign free shortcut to it
    4. In the editor call assigned shortcut
    • EXPECTED RESULT: All bookmarks in current document are removed


Test suite: Error stripe

Purpose: Error stripe is stripe right to the editor, it provides quick status of the opened file (small color box at the top of the error stripe) and highlights significant lines (lines with error, bookmark, caret position). It also provides quick navigation to the highlighted lines.
Setup: Opened any java file in editor

  1. File is OK
    1. Open java file without any errors or warnings.
    2. Remove all bookmarks, breakpoints, mark occurrences etc...
    • EXPECTED RESULT: The status box is green, the error stripe
  1. File with errors
    1. Open java file from the previous testcase
    2. Add code with warning (e.g. override toString method w/o @Override annotatino)
    3. Add another warning (e.g unused import)
    4. Add some code with error
    5. Remove all warnings/errors
    • EXPECTED RESULT: When file contains warning the status box is yellow, in the error stripe is yellow mark. When there is error in the file the status box is red and there is red mark in the errors stripe. Whenever mouse is hovering over the status box the info about status is shoew (e.g. "1 error(s) 2 warning(s)"). After removing the
  1. Caret position
    1. Open file which is longer than editor window
    2. Try scroll to beginning and end of the document (by arrows, pg up/down and scroll wheel)
    • EXPECTED RESULT: The caret symbol in error stripe (thin line with little square in the middle) moves to proper places when scrolling. When the caret is in the beginning of the document the symbol is in the top of error stripe, when the caret is at the end, the symbol is at the bottom.
  1. Error stripe navigation
    1. Open java file
    2. Put several bookmarks in the file and/or use mark occurrences feature
    3. Click on marks in error stripe
    • EXPECTED RESULT: The file is scrolled to show related place in editor, when hovering over the mark the mouse cursor is changed to tooltip informs about the type of the mark
  1. Error stripe navigation
    1. Open java file
    2. Put bookmark in it
    3. Put break point in it
    4. Add code with warning
    5. Add code with error
    6. Change line, add line, remove some lines (if the document is under version control)
    7. Turn on mark occurrences and put cart over identifier with more occurrences
    • EXPECTED RESULT: All this actions adds mark in error stripe, these marks differ by color - errors are red, warnings yellow, bookmarks dark gray, changed lines blue, removed lines ping, new lines green, etc...


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