Skip to content

Test Plan

Ye Zhihao edited this page Oct 20, 2019 · 28 revisions

Basic

  • The version of the extension is correct
  • The content of the Details page and the Changelog page is correct
  • The extension will be activated if the user opens a *.java file or triggers any of the extension's command

Set Checkstyle Configuration

  • Can set the Checkstyle configuration file in the file explorer by:
    • Right-click an *.xml file.
    • Select Set the Checkstyle Configuration File

Note: The menu item Set the Checkstyle Configuration File will not appear if the selected file is not an *.xml file

  • Can set the Checkstyle configuration file through the VS Code command Checkstyle: Set the Checkstyle Configuration File

    • Can list all the potential Checkstyle configuration files in the workspace.
    • Select Use URL will open a input box to let the user write HTTP URL
    • Select Browse... will open the file browser which can only select a single *.xml file.
    • Select Google's Style or Sun's Style will use the embeded Google style or Sun style
  • Can set the Checkstyle configuration file by manually editing the workspace folder setting java.checkstyle.configuration. A configuration file via HTTP url could be provided this way. (e.g. https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-8.18/src/main/resources/google_checks.xml)

  • After setting the configuration file correctly, a notification will pop up saying success

  • The setting will be saved to:

    • Workspace folder setting if there is(are) workspace folder(s) available
    • Global setting if there is no workspace folder available
  • Each time the java.checkstyle.configuration or java.checkstyle.properties setting changed, a synchronization with checkstyle java server will be performed:

    • If the configuration file is not set, the check code functionality is disabled, all checkstyle file diagnostics in problem panel is cleared.
    • If successful, the check code functionality will start to work according to the configuration specified by the client, and all checkstyle file diagnostics in the problem panel is refreshed according to the new configuration.
    • If error occurs during syncing (e.g. a config file with wrong format is provided), the check code functionality is disabled, all checkstyle file diagnostics in problem panel is cleared.

Set Checkstyle Version

  • Can Select the Checkstyle version by manually editing the workspace folder setting java.checkstyle.version, or through VS Code command Checkstyle: Set the Checkstyle Version:

    • Can list the built-in version provided by extension.
    • Can list all the downloaded version.
    • Can list the latest version, and it will be put at first. If there's network issue, latest version will not be specified.
    • Current used version will be appended with a checked(√) icon.
    • Select All supported version will open a list showing all the versions supported by extension. If there's network issue, a list with an only item Network error will be shown.
  • After a version is selected, it will be ensured to exist on the disk, i.e. if the specifed version does not exist, it will be downloaded.

    • If a version is downloaded, it will be added to the list as downloaded in command Checkstyle: Set the Checkstyle Version.
    • Downloaded version is saved to %APPDATA%/Code/User/globalStorage/shengchen.vscode-checkstyle/ as checkstyle-x.xx-all.jar.
    • If a built-in version is used, it will not be downloaded, and a built-in jar in ~/.vscode/extensions/shengchen.vscode-checkstyle-x.x.x/server/ is used instead.
  • If the version is not compatible with the configuration file, an error message box will pop up, prompting user to select another version or edit the configuration file. e.g. Use https://github.com/checkstyle/checkstyle/raw/master/src/main/resources/google_checks.xml as configuration, and choose an older version (7.x), this message will be shown.

  • Each time the java.checkstyle.version changed, a synchronization with checkstyle java server will be performed, just as what Setting Checkstyle Configuration do.

Set Third Party Checkstyle Module

  • Can Set the thir party Checkstyle modules version by manually editing the workspace folder setting java.checkstyle.modules.

  • Download sevntu.checkstyle at https://repo1.maven.org/maven2/com/github/sevntu-checkstyle/sevntu-checks/1.35.0/sevntu-checks-1.35.0.jar, add it to java.checkstyle.modules setting, then add additional checks to checkstyle configuration file according to checks listed in this link. You should see the checks come into effect as their name indicates.

    • E.g., SingleBreakOrContinueCheck will check that only one break or continue statement exists in a for loop.

Check Code with Checkstyle

  • Can manually check active document, a single file, or a batch of files in a folder:

    • Execute Check Code with Checkstyle in the command palette, then the active document (if it is a java file) gets checked.
    • Right click a java file, selecting Check Code with Checkstyle makes the file get checked.
    • Right click a folder, selecting Check Code with Checkstyle searches all the java files in the folder recursively, then batch check all the found java files.
  • The status bar will show bug sign if any of the file has problem diagnostics related to checkstyle. Clicking the bug sign will open the problem panel.

  • By default, the setting java.checkstyle.autocheck is true, which means the live-linting mode is enabled, where all the opening text documents get listened and automatically checked:

    • Opening a java file makes it get checked.
    • Changing a java file makes its diagnostics get refreshed once the content stops changing.
  • If java.checkstyle.autocheck is set to false, the extension can only trigger the check manually.

  • If the configuration file is not set, the check code functionality is totally disabled and will not perform any check.

Quick Fix

  • Can expand additional properties by setting the java.checkstyle.properties
  • ${workspaceFolder} should be resolved correctly in:
    • java.checkstyle.configuration
    • java.checkstyle.properties
    • java.checkstyle.modules

Output Channel

  • The extension's output channel should show logs if any unexpected errors happen, for example, invalid Checkstyle configuration file is set.

BI (For Endgame)

  • Telemetry goes to Prod