TS 61 JavaDoc

JavaDoc test specification

Author: Jiri Prox
Version: 6.1
Last update: 07/03/2008
Introduction: This is test specification for javadoc support in NetBeans. It describes various action displaying javadoc, action facilitating javadoc writing, javadoc hints, javadoc completion

Contents


Test suite: Javadoc in code completion

Purpose: This testsuite is focused on javadoc popup which is shown when code completion window is opened.
Setup:
Comments:

  1. Open javadoc window
    1. Put caret in the middle of identifier (e.g. Stri|ng s;)
    2. Press ctrl-space
    3. Put caret in the middle of identifier of class which comes from library with attached sources
    4. Put caret in the middle of identifier of class which comes from library with attached javadoc
    • EXPECTED RESULT: Code completion is opened, javadoc window for class String is shown. The content is taken from sources or from javadoc, depending on what is available
  1. Javadoc window navigation
    1. Repeat previous testcase
    2. Click on links in javadoc
    3. Use Back and Forward button in window header
    4. Try button Open Source and Open documentation in external web browser
    • EXPECTED RESULT: The navigation works like in web browser. The Open Source is enabled only when sources for current class are available. When pressed the class is opened in editor. Open documentation opens javadoc page in external web browser if javadoc for actual class is available. Otherwise the button is disabled
  1. Open only javadoc
    1. Repeat previous testcase but use Ctrl-Shift-Space instead of Ctrl-Space
    • EXPECTED RESULT: Only javadoc popup is opened
  1. Settings
    1. Open Advanced Options -> Editing -> Editor Setting -> Java Editor
    2. Change values for Auto Popup Javadoc Window, Background Color of Javadoc Popup, Javadoc preferred size
    • EXPECTED RESULT:New values are respected in editor

Test suite: Javadoc Index Search

Purpose:
Setup: Open project which uses library with attached javadoc.

  1. JDK class
    1. Open Javadoc index search (Shift-F1)
    2. Enter String and press enter
    3. Attach javadoc for default platform and repeat previous step
    • EXPECTED RESULT: If javadoc for platform is not attached, the search returns nothing (may return suitable elements from library). Once javadoc is attached, the result contains records for java.lang.String and other elements from JDK
  1. Editor context
    1. Put cursor or some identifier in editor
    2. Press Shift-F1
    • EXPECTED RESULT:Javadoc index search is opened, search for identifier under caret is performed
  1. Navigation
    1. Open index search and perform several queries
    2. Try buttons at right from the query field
    3. Try navigation button in the bottom part of window
    • EXPECTED RESULT: Each button has tooltip and works as expected
  1. External browser
    1. Double click on result item
    • EXPECTED RESULT: Javadoc is opened in external browser

Test suite: Show javadoc actions

Purpose: This suite test various ways how to get javadoc for given element
Setup: Open project using library with attached javadoc

  1. Show javadoc
    1. Put caret on some identifier in editor
    2. Call Show Javadoc action (from popupmenu or Alt-F1)
    • EXPECTED RESULT: Is source is available the javadoc is opened in external web browser, the page is scrolled to shown requested element. (e.g. when called on out on System.out.println() the page for java.lang.System is opened, scrolled to 'out' field)
  1. Show javadoc in navigaton
    1. Open any class
    2. Hover mouse over item in navigator
    3. Press Ctrl-F1
    • EXPECTED RESULT: Javadoc popup is shown when hovering over navigator item. (it's simple popup, no scrolling). When Ctrl-F1 is pressed, javadoc view is opened for actual element
  1. Javadoc view
    1. Open javadoc view
    2. Move cursor to several elements in editor
    • EXPECTED RESULT: Javadoc view show javadoc depending on current position of caret in the editor
  1. Inspect hierarchy/members
    1. Open Inspect hierarchy/members window (Alt-F12, Ctrl-F12)
    2. Browse through dialog
    • EXPECTED RESULT: The javadoc part of dialog always show correct contents

Test suite: Generating javadoc for project

Setup: Create new project and fill in some javadoc (even for private elements

  1. Create javadoc
    1. From context menu on project select generate javadoc
    • EXPECTED RESULT: javadoc is generated in dist folder. It is opened in browser as well if this option it turned on
  1. Create javadoc - setting
    1. Clean project if javadoc was generated in previous testcase
    2. Open project properties -> Documenting tab
    3. Check all checkboxes
    4. Fill in Window title and Additional Javadoc Options (e.g. -header "Some header" )
    5. Generate javadoc
    6. Try disabling some checkboxes are regenerate javadoc
    • EXPECTED RESULT: The javadoc is generated according the options (clean is needed between javadoc generation)
  1. Create javadoc - warnings
    1. Clean project if javadoc was generated in previous testcase
    2. Make some error in javadoc - e.g. missing argument of @see tag, etc..
    3. Generate javadoc for project
    • EXPECTED RESULT: The output window should contain some warning, clicking of warning open editor and scroll to related position in file

Test suite: Javadoc hints

Purpose: This suite test javadoc hints
Setup: Open any class in editor, turn on javadoc hint in Options -> Java Code -> Hints

  1. Generate javadoc
    1. Put caret on header of public method which does not have javadoc
    2. Use hint
    • EXPECTED RESULT: Javadoc stub is created, it has pre-filled @param, @throws and @return tags, matching the method header
  1. Correct javadoc - add
    1. Add parameter or exception to throws list in method which has correct javadoc
    2. Change return type from void to some type
    3. Use hint to correct javadoc
    • EXPECTED RESULT:Javadoc is updated
  1. Correct javadoc - remove
    1. Remove/rename some parameters, exceptions of change return type in the method header
    2. Apply hints which occurs in javadoc
    • EXPECTED RESULT: The related parts of javadoc is removed
  1. Hints settings
    1. Goto Options -> Java Code -> hints -> javadoc hints
    2. Change scope of both hints
    3. Change Show as value
    • EXPECTED RESULT: Hint are provided according to the selected scope and are show in the way specified by show as combobox

Test suite: Javadoc abbreviation

  1. Generating method javadoc
    1. Put cater before method w/o javadoc (using generics)
    2. Type "/**" and press enter
    • EXPECTED RESULT: Javadoc stub is created, it contains all parameters, exceptions from throws clause and @return tag if it's non-void method.
  1. Class javadoc
    1. Put caret before class wih generics
    2. Type "/**" and press enter
    • EXPECTED RESULT: Javadoc containing @author and @param tags is generated
  1. Negative testcase
    1. try use /** in inappropriate position (at the end of file, before other javadoc, inside method etc...)
    • EXPECTED RESULT: Empty stub is created

Test suite: Javadoc completion

Purpose: This suite is focused on completion in javadoc

  1. Param tag
    1. Put cursor inside empty javadoc for method public <T> T method(T i1, X i2) throws FileNotFoundException {
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "param"
    4. invoke javadoc completion
    • EXPECTED RESULT: The completion in step 2 provides all suitable tags (deprecated, exception, param, return, see, serialData, since, throws ). In step 4 all params are provided (i1,i2, <T>)
  1. Param tag for class
    1. Put cursor inside empty javadoc for class public class Test<X>{
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "param"
    4. invoke javadoc completion
    • EXPECTED RESULT: In step 2 following tags are provided: author, deprecated, param, see, serial, since, version. In step 4 the <X> parameter is provided
  1. Throws tag
    1. Put cursor inside empty javadoc for method public <T> T method(T i1, X i2) throws FileNotFoundException {
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "throws"/"exception"
    4. invoke javadoc completion
    • EXPECTED RESULT: All subclass of Exception are listed. The class present in throws clause are at the beginning of the list
  1. {@ tags
    1. Put cursor inside empty javadoc for method,class or field
    2. Type {@ and invoke javadoc completion if it isn't opened automatically
    • EXPECTED RESULT: The following tags are provided: code, docRoot, link, linkPlain, literal. In addition it it there is also tag inheritDoc for methods and tag value for fields. The {@link and {@linkPlain tags behaves like @see

Test suite: Javadoc - javasource features

Purpose: This suite describes features from java source module which were extender to work in javadoc
Setup: Open any class in editor,

  1. Add import
    1. In javaodc type "@see List"
    2. Call Fix Imports (ctrl-shift-I)
    • EXPECTED RESULT: Fix import dialog is opened, providing list of all classes named List in classpath. After confirm the correct class is imported.
  1. Add import 2
    1. Remove import of List added in previous testcase
    2. Put caret over List in javadoc
    3. Call Fast Fix Import (alt-shift-I)
    • EXPECTED RESULT: Fast Fix import dialog is opened, providing list of all classes named List in classpath. After confirm the correct class is imported.
  1. Unused import
    1. Add import for java.io.File
    2. Add {@link File} to the javadoc
    • EXPECTED RESULT: At first import is marked as unused, after adding the link tag, the import is not marked as unused any more
  1. Resolve symbol
    1. Remove import for File from previous testcase
    2. Write {@link File# in javadoc
    3. Invoke code completion (ctrl-space)
    4. Impot java.io.File
    5. invoke code completion (ctrl-space) behind {@link File#
    • EXPECTED RESULT: No suggestion is returned as first invocation of code completion. As second invocation members of java.io.File are returned.
  1. Mark Occurrences
    1. Add @see or {@link or {@linkPlain and name of some class
    2. Import the class if it isn't already imported
    3. Put caret over class identifier
    • EXPECTED RESULT: Mark Occurrences works - all occurrences of class under cursor are highlighted
  1. Rename class
    1. Create class Klass in package anotherPack
    2. In current file put somewhere in javadoc following text: @see Klass
    3. Add necessary import
    4. Rename class Klass to different name (check rename in comments)
    • EXPECTED RESULT: @see tag is updated to reflect actual name
  1. Ctrl-navigation
    1. Ctrl-click on class name or method in @see, {@link or {@linkPlain tag
    • EXPECTED RESULT: The source file is opened if available
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