TS 68 JavaEditorFiles

Test Specification: Working with documents in Java editor

Author: Roman Strobl & Max Sauer & Petr Dvorak & Jiri Prox
Version: 6.8
Introduction: This document serves as a test specification for editor module. It covers main editor features concerning creating/opening/closing files and general subjects concerning the way editor handles documents (r/o, line-endings, tabs, cloning...). This specification does NOT cover editing files and operations concerning working with individual file in editor and features concerning a single editor's tab. Please use a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project to perform some steps of this test specification.

Contents


Test suite: Creating a New File

Purpose: Tests if it is possible to create a new file in a project and if editor's tabs are correctly focused.
Setup: Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project.

  1. New file
    1. Invoke File|New File... from the main menu
    2. Select Java category and Java Class file type
    3. Click Next, fill in some class name and click Finish
    4. Create a few more Java classes (repeat these steps a few more times)
    • EXPECTED RESULT: Whenever a new file is created it is opened in editor and focused.



Test suite: Opening Files in Editor

Purpose: This suite checks if is possible open files in Editor. There are more possibilities how to open file - they are described below.
Setup: Close all opened projects. Use files from File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project in following test cases.

  1. Open external file
    1. Open external file (file that is not a part of any NB project) from main menu action File|Open File...
    • EXPECTED RESULT:
      - File must be opened in editor.
      - There is a lot of limitations, because the file is not part of any project. (no classpath is set)
      - These features must work: Syntax coloring, Code Completion for JDK classes, Code Folding
      - These features won't work: Code Completion for non JDK classes, Compile/run the class
  1. Open file from project that is not opened
    1. Open OpenFileBasic.java with File|Open File... menu. This class can be found in sample project archive under sampleEdirorFiles/src/test/opening directory
    • EXPECTED RESULT:
      - File must be opened in editor and all java-related stuff must work: Code Completion, Code Folding, compilation, running, etc.
      - This action does not open the project where the class belongs to.
  1. Open a file in Projects view and close it
    1. Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project
    2. Expand test.opening package under Source Packages node in Project view and double click the OpenFile.java source file
    3. Don't modify this file in editor
    4. Invoke popup menu above editor's tab and choose Close All Documents item
    • EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
  1. Open a file in Files view and close it
    1. Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project if it is not opened yet
    2. Expand nodes in Files view and double click on the OpenFile.java source file
    3. Don't modify this file in editor
    4. Invoke popup menu above editor's tab and choose Close All Documents item
    • EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
  1. Open a file from main menu and close it
    1. Select File|Open File from the main menu and find OpenFile.java file used in previous case
    2. Open it
    3. Don't modify the opened file
    4. Invoke popup menu above editor's tab and choose Close All Documents item
    • EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
  1. Opening a file that is already opened in editor
    1. Expand nodes in Projects view and double click OpenFile.java source file
    2. Double click OpenFileBasic.java source file in Projects view
    3. Double click OpenFile.java source file in Projects view
    4. Invoke popup menu above editor's tab and choose Close All Documents item
    • EXPECTED RESULT:
      - The document that was just opened (double-clicked) must be opened and focused in editor
      - All opened documents must be closed after you perform the last step
  1. Clone opened document ("Fake Editor Split")
    1. Open a java class (for example OpenFile.java from the sample project)
    2. Right click on editor's tab and choose Clone Document
    3. Move the cloned document to the bottom of the screen
    4. Try to open more files (use files under test.dummy package, for example)
    5. Move opened files from the top window to the bottom one and vice versa (move files between fake splits)
    6. Try to close all documents one by one
    • EXPECTED RESULT:
      - Editor should split into two views
      - It should be possible to drag & drop editor tabs from top editor to the bottom one
      - When closing the documents, the split should disappear when all documents are in the top or bottom part




Test suite: Line Endings

Setup: Use a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project
Note: Default line endings:

  1. Upon creation of a new file, EOL's from your OS are used by default.
  2. Upon opening of an existing file, then the default EOL is read from the first line of this file.

Note: The Unix line ending is \n (CR - 0x0D), the Windows uses \r\n (CR/LF - 0x0D 0x0A) and the Mac uses \r (CR - 0x0A).

  1. Line endings - new files
    1. Create new Java file
    • EXPECTED RESULT: Check line endings of the new file in any binary editor (for example "mc" in Linux, press F3 to view the file and then F4 to switch to HEX mode).
  1. Line endings - existing Java files
    1. Open a file with Unix EOL's (NewCanvasActionUnix.java under test.eols package)
    2. Type some new lines
    3. Open a file with windows EOL's (NewCanvasActionWin.java under test.eols package)
    4. Type some new lines
    5. Open a file with Mac EOL's (NewCanvasActionMac.java under test.eols package)
    6. Type some new lines
    7. Save files
    • EXPECTED RESULT: Check line endings in any binary editor for all files. The type of line endings must be preserved
  1. Manipulating file with not native EOL
    1. Open java file with non native EOL (example: If you use Windows, then open file with Unix line endings)
    2. Try to manipulate this file - move from package to package, copy, use hints and code templates to generate code
    • EXPECTED RESULT: Line endings are not changed, the code is not corrupted by any action.



Test suite: Read-Only Files

  1. Open read-only file
    1. Open a read-only file in editor
    2. Try to type some characters inside
    • EXPECTED RESULT:
      - It is not possible to make any changes in read-only file
      - Read-only status is indicated by italics font in the editor's tab
  1. Make file read only
    1. Open any read/write file in editor
    2. Make some changes inside
    3. Make file read only (outside IDE)
    4. Save file
    • EXPECTED RESULT: Saving should not be possible, a warning should be displayed, telling the user that the file has become read only.
  1. Read only file from JDK
    1. Open JDK class (you can use "Go To Type" dialog)
    • EXPECTED RESULT: JDK class is read-only and no change can be done in the file



Test suite: Closing Modified Files

Purpose: This suite checks if a dialog shows up when user attempts to close a modified file.
Setup: Close all opened projects except for the sample project and close all opened files.

  1. Close a modified file (Save)
    1. Open OpenFile.java and modify it
    2. Modify flag (bold font) must by used in editor tab
    3. Close file with the X on editor's tab
    4. Confirm your changes by clicking Save
    • EXPECTED RESULT:
      - Modify flag must show up after you modify a file.
      - A dialog asking for confirmation must show up after the fourth step.
      - The file must be saved (check it on hard disk) and editor tab must be closed.
  1. Close a modified file (Discard)
    1. Open OpenFile.java and modify it
    2. Close the sample file using Ctrl+W shortcut
    3. Choose Discard in the dialog to discard your changes
    • EXPECTED RESULT:
      - Editor tab should be closed.
      - All changes are lost (check the file on hard disk)
  1. Close a modified file (Cancel)
    1. Open OpenFile.java and modify it
    2. Close the sample file using main menu action Window|Close Window
    3. Choose Cancel
    • EXPECTED RESULT:
      - Nothing happens - a file remains opened and it is not saved
      - A star next to file name must remain in editor tab
  1. Persistence of opened files
    1. Open several classes from the project
    2. Try to remember which files are opened
    3. Close IDE
    4. Start IDE
    • EXPECTED RESULT:
      - Files that were opened before closing IDE are opened in the editor after IDE restart
      - The projects that were opened are reopened as well, but their nodes are collapsed (because of performance)




Test suite: Tab Focus

  1. Switching editor tabs
    1. Open two Java source files in editor and focus one of them (move mouse cursor to editor pane and click)
    2. Repeatedly switch to next file and return to previous one by clicking on editor tabs
    3. Use next tab action (Ctrl+PgUp/PgDown) to switch to next file
    4. Use Ctrl+Tab to switch to next file
    • EXPECTED RESULT: Tabs should be switched intuitively and focus should remain in editor window.
  1. Closing editor tabs
    1. Open at least two java files in the Editor Window
    2. Close one of them (using Ctrl+F4)
    • EXPECTED RESULT: Focus should be moved to another opened Editor tab.




Test suite: Select Document Node in Project/Files/Favorites

  1. Menu "Navigate"
    1. Verify functionality for every Navigate|Select in ... main menu item:
    2. Have a document focused in the IDE
    3. Use Select in Projects command or use shortcut Ctrl+Shift+1
      → the file is selected in Projects
    4. Use Select in Files command or use shortcut Ctrl+Shift+2
      → the file is selected in Files
    5. Use Select in Favorites command or use shortcut Ctrl+Shift+3
      → the file is selected in Favorites
    • EXPECTED RESULT: Node corresponding to opened editor is selected in Project/Files/Favorites view
  1. Same name test - Projects view
    1. Close all projects and create a new project
    2. Create files Main.java and Main.html in one package
    3. Open Main.java and call Select in Project
    4. Open Main.html and call Select in Project
    5. Try to repeat previous steps
    • EXPECTED RESULT: The right node is always selected in Projects view
  1. Same name test - Files view
    1. Close all projects and create a new project
    2. Create files Main.java and Main.html in one package
    3. Open Main.java and call Select in Files
    4. Open Main.html and call Select in Files
    5. Try to repeat previous steps
    • EXPECTED RESULT: The right node is always selected in Files view
  1. Same name test - Favorites view
    1. Close all projects and create a new project
    2. Create files Main.java and Main.html in one package
    3. Open Main.java and call Select in Favorites
    4. Open Main.html and call Select in Favorites
    5. Try to repeat previous steps
    • EXPECTED RESULT: The right node is always selected in Favorites 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