TS 73 Maven

Test Specification: Maven Support Test Specification

Author: Tomas Musil
Version: 7.26
Introduction: This document serves mostly as a test specification for Maven specific functionality in Netbeans IDE - it should cover all most important features of Maven functionality,however this test specification can't cover all scenarios with Maven,and it should be tested by specific components responsible engineers along with Ant scenarios.
Setup: To create and build Maven project, just use the Maven 3.x bundled with the IDE. Also, for J2EE projects, test in all cases JavaEE5, JavaEE6 and JavaEE7 projects.

Contents


Test suite: Maven projects

Purpose: Test creating different project archetypes
Setup: Test all J2EE project types for JavaEE5, JavaEE6 and JavaEE7.

  1. Create Java application
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven
    3. Select Java Application and push Next
    4. Type QuickstartPrj to the Project Name field and push Finish
    • EXPECTED RESULT:
      The project is created, the output contains message about "BUILD SUCCESS".
  2. Create Web Application
    1. Go to main menu File | New Project
    2. In New Project wizard select Maven > Maven Web Application and push Next
    3. Type WebAppPrj to the Project Name field and push Finish
    • EXPECTED RESULT:
      The project is created, the output contains message about "BUILD SUCCESS".
  3. Create EJB Module
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven > Maven EJB Module and push Next
    3. Type EJBModPrj to the Project Name field and push Finish
    • EXPECTED RESULT:
      The project is created, the output contains message about "BUILD SUCCESSFUL".
  4. Create Enterprise Application
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven > Maven Enterprise Application and push Next
    3. Type EntAppPrj to the Project Name field and push Next
    4. Push Finish
    • EXPECTED RESULT:
      Four projects are created (ear,ejb,pom and war), the output contains message about "BUILD SUCCESS".There's missing dependencies warning icon in Projects tab. Check that it can be resolved using "Show and resolve problem" action from context menu.
  5. Create NetBeans Module archetype
    1. Go to main menu File | New Project
    2. In New Project wizard select Maven > Maven Project and push Next
    3. Select Maven NetBeans Module Archetype and push Next
    4. Type NBModulePrj to the Project Name field and push Finish
    • EXPECTED RESULT:
      The project is created, the output contains message about "BUILD SUCCESSFUL".There's missing dependencies warning icon in Projects tab. Do build and this will disappear.
  6. Create NetBeans Platform Application archetype
    1. Go to main menu File | New Project
    2. In New Project wizard select Maven | NetBeans Platform Application and push Next
    3. Type NBAppPrj to the Project Name field, check to create sample module and push Finish
    • EXPECTED RESULT:
      Both projects "NBAppPrj - NetBeans Platform Application (pom)" and "NBAppPrj - sample NetBeans Module (nbm)" are created, the output contains message about "BUILD SUCCESSFUL".There's missing dependencies warning icon in Projects tab. Check that it can be resolved using "Show and resolve problem" action from context menu.
  7. New Archetype wizard
    1. Go to main menu File | New Project
    2. In New Project wizard select Maven > Project from archetype and push Next
    3. Type archetype name (or part) into search field (e.g. "hudson")
    4. Select appropriate archetype and proceed with creating new project
    • EXPECTED RESULT:
      Project from archetype is succesfully created.


Test suite: Clean, Build, Run, Debug maven project

Purpose: Test basic operation on the maven specific projects

  1. Clean project
    1. Invoke popup menu on QuickstartPrj
    2. Select Clean action
    • EXPECTED RESULT:
      In Files view there is missing "target" folder now .
  2. Build project
    1. Invoke popup menu on QuickstartPrj
    2. Select Build action
    • EXPECTED RESULT:
      In Files view there appears "target" folder - contains QuickstartPrj-1.0-SNAPSHOT.jar file.
  3. Run project
    1. Invoke popup menu on QuickstartPrj
    2. Select Run action
    3. IDE asks for selecting main class for execution - push Select Main Class button to select offered one
    • EXPECTED RESULT:
      Project is executed - "Hello World!" string is printed in output .
  4. Debug project
    1. Set up breakpoint in main method's the only body line
    2. Type some other System.out.println on the next line
    3. Invoke popup menu on QuickstartPrj
    4. Select Debug action
    • EXPECTED RESULT:
      Debugger stops at the breakpoint and then continues when pushing F7. Finally there are printed proper lines in output .


Test suite: Run, Debug, Profile, Test single file

Purpose: Test basic operations on single files in the maven specific projects

  1. Run file
    1. Invoke popup menu on WebAppPrj
    2. Select New > Servlet and enter name and package (MavenPrjServlet, org.mavenprj)
    3. Click Finish
    4. Select Run action on MavenPrjServlet
    5. Confirm Servlet Execution URI by clicking OK
    6. Select Glassfish v3 server in next window and click OK
    • EXPECTED RESULT:
      Project is deployed and servlet displayed in browser .
  2. Debug file
    1. Select Debug action on MavenPrjServlet
    • EXPECTED RESULT:
      Project is deployed in debug mode,Debugger window opened in IDE and servlet displayed in browser .
  3. Profile file
    1. Go to Profile menu and select Advanced Commands > Run Profiler Calibration.
    2. After it's finished,click on OK.
    3. Select Profile action on MavenPrjServlet
    4. Click on Run button.
    • EXPECTED RESULT:
      Project is deployed in Profile mode,Profiler window opened in IDE and servlet displayed in browser .
  4. Test file
    1. Select Test action on MavenPrjServlet
    2. Create new JUnit test for MavenPrjServlet (New > JUnit > Test For Existing Class , browse for MavenPrjServlet) and invoke Test action on it.
    • EXPECTED RESULT:
      In case of servlet, no tests are executed. In case of JUnit test in fails, since we didn't entered any paramaters.

Test suite: Project properties

Purpose: Test properties of maven project

  1. Test General properties
    1. Select project properties for QuickstartPrj (by calling Properties from popup on project node)
    2. Select General
    3. Set up each of the field and check that these values are changed properly in pom.xml
    • EXPECTED RESULT:
      The pom.xml of the project synchronizes with the changes made in the project properties.
  2. Test Sources properties
    1. Select Sources node in project properties
    2. Check that the Source/Binary format is 1.3 by default
    3. Change Source/Binary format to 1.5
    • EXPECTED RESULT:
      The change is propagated in pom.xml .
  3. Test Configurations properties
    1. Select Configurations
    2. Push Add... button and set up fields "Configuration Id:" together with "Activate profiles", check "persist for others to reuse" checkbox
    3. Push OK button
    • EXPECTED RESULT:
      In Files view there is created nb-configuration.xml and contains proper values .
  4. Test Compile on Save for app execution
    1. By default, CoS should be "Disabled"
    2. Test by running (multiple times) Maven project containing class with main method.
    • EXPECTED RESULT:
      Code is not run directly, without Maven.
  5. Test Compile properties
    1. Set up "Compile On Save:" to 'for both application and test execution'
    • EXPECTED RESULT:
      The nb-configuration.xml contains line with "<netbeans.compile.on.save>all</netbeans.compile.on.save>".
  6. Test Configurations
    1. Set up Configuration field in Run (select existing configuration)
    2. Check Configuration field in Actions and write test into Activate Profiles
    • EXPECTED RESULT:
      The file nbactions-<profilename>. xml is created at the same level as pom.xml - check it up in the Files view.
  7. Test Actions properties
    1. Select e.g 'Clean project' action in the list and change 'clean' goal and change it to 'install'
    2. Push OK button
    • EXPECTED RESULT:
      The change is written to the nbactions<profilename>.xml .
  8. Test Formatting properties
    1. Go to Formatting and select the radiobutton "Use project specific options"
    2. Set up different values for Tab Size, Right Margin and Indent spaces
    • EXPECTED RESULT:
      Values are stored in nb-configuration.xml and are used when editing pom.xml .

Test suite: Create templates in maven projects

Purpose: Test creating different templates in maven project

  1. Create package
    1. Create package in QuickstartPrj
    • EXPECTED RESULT:
      Package is created and is empty .
  2. Create JFrame form
    1. Create new JFrame form file in QuickstartPrj's newly crated package
    • EXPECTED RESULT:
      The JFrame is available and is properly generated and opened in editor window.
  3. Create XML document
    1. Create new XML Document file in QuickstartPrj's newly crated package
    2. Left everything set on default.
    • EXPECTED RESULT:
      The XML file is available and is properly generated and opened in editor window.
  4. Create new Java class
    1. Create new Java class file in QuickstartPrj's newly crated package
    • EXPECTED RESULT:
      The Java class file is available and is properly generated and opened in editor window.

Test suite: Refactoring

Purpose: Test main refactoring in maven project

  1. Rename package
    1. Rename java package created in previous test suite to sun.my.pack
    2. Select Refactor > Rename and click on Refactor.
    • EXPECTED RESULT:
      Rename succeeds, the code is compilable.
  2. Rename java class
    1. Rename java file created in previous test suite to MyClass
    2. Select Refactor > Rename and click on Refactor.
    • EXPECTED RESULT:
      The file is renamed and compilation/run works smoothly.
  3. Rename JFrame form
    1. Rename JFrame file created in previous test suite to MyFrame
    2. Select Refactor > Rename and click on Refactor.
    • EXPECTED RESULT:
      The file is renamed and compilation/run works smoothly.



Test suite: Project operations

Purpose: Test Delete, Move and Rename of Maven projects

  1. Rename project
    1. Rename WebAppPrj JEE5 Webapp (war) project to MavenWebAppPrj
    • EXPECTED RESULT:
      Rename succeeds, the project is compilable.
  2. Move project
    1. Move MavenWebAppPrj to another location
    • EXPECTED RESULT:
      The project is moved properly and compilation/run works smoothly.
  3. Delete project
    1. Delete MavenWebAppPrj
    • EXPECTED RESULT:
      The project is deleted but sources will remain.
  4. Delete project along with sources
    1. Do previous scenario with checkbox enabled
    • EXPECTED RESULT:
      The project is deleted along with its sources.

Test suite: Maven related options

Purpose: Test maven related optins

  1. Set up External Maven Home
    1. Go to Tools > Options > Java > Maven
    2. Set up the Maven external home by Browse button
    • EXPECTED RESULT:
      The used maven version can be checked by building of a project - it is written in the output like following line:
      NetBeans: Executing '/space/maven/2.0.9/apache-maven-2.0.9/bin/mvn install'.
  2. Set up Skip Tests
    1. Go to Tools > Options > Java > Maven
    2. Check Tests for any build executions not related to testing
    3. Build any project without tests
    • EXPECTED RESULT:
      No tests are run during project testing-check in Output tab.
  3. Set up Global Options
    1. Go to Tools > Options > Java > Maven
    2. Find Global Execution Options and click on Add button to the right
    3. Select --debug option
    4. Build project
    • EXPECTED RESULT:
      Check Output tab,that there's more detailed output from building.
  4. Set up frequency of download
    1. Go to Tools > Options > Java > Maven
    2. In On project Open section select First Open Only for all fields
    3. Create new Web App project
    • EXPECTED RESULT:
      There's now more actions done on project creation.
  5. Edit Custom Global Definitions
    1. Go to Tools > Options > Java > Maven
    2. Click on Custom Global Definitions button.
    • EXPECTED RESULT:
      Goals window should open.
  6. Set up frequency of index updates
    1. Go to Tools > Options > Java > Maven
    2. Set Index Update Frequency to On Every Startup
    3. Close IDE and reopen.
    • EXPECTED RESULT:
      Index shoud be updated on startup.Click on Index Now to invoke immediate index reload.
  7. Maven related editor hints
    1. Go to Tools > Options > Editor > Hints
    2. Set up the Language to "Apache Maven POM Files"
    3. Change the hints options - by managing this options,you can set the behaviour of editor for maven pom.xml files.
    • EXPECTED RESULT:
      Check all top-level checkboxes are set.

Test suite: Project libraries

Purpose: Test libraries in maven projects

  1. Add library
    1. Click on Dependencies node in projects view and invoke popup menu
    2. Select Add Dependency
    3. Filter the library - e.g. jfreechart (if Local repository is being currently transferred, wait please until it ends)
    • EXPECTED RESULT:
      The library should be added properly to the project. Show and Resolve problems / Download Libraries,if necessary . If problem remains,resolve it manually.
  2. Show Dependency Graph
    1. Click on Dependencies node in projects view and invoke popup menu (there should be at least one library under it)
    2. Select Show Dependency Graph
    • EXPECTED RESULT:
      Artifact Details / Graph is displayed in editor .
  3. Download Missing Dependencies
    1. Click on Dependencies node in projects view and invoke popup menu
    2. Select Download Missing Dependencies
    • EXPECTED RESULT:
      All dependencies are checked and the missing ones downloaded - if there's any minus badge on dependency, it should disappear .
  4. Download Javadoc
    1. Click on Dependencies node in projects view and invoke popup menu
    2. Select Download Javadoc
    • EXPECTED RESULT:
      All javadocs are downloaded .
  5. Download Sources
    1. Click on Dependencies node in projects view and invoke popup menu
    2. Select Download Sources
    • EXPECTED RESULT:
      All sources are downloaded .
  6. Check Always Show Non-Classpath Dependencies
    1. Create new Maven Enterprise Application from template.
    2. Click on Dependencies node in projects view (ear project) and invoke popup menu
    3. Select Always Show Non-Classpath Dependencies
    • EXPECTED RESULT:
      Non-classpath dependency should be displayed in the list as common one.
  7. Manually Install Artifact
    1. Click on any Library node in projects view and invoke popup menu
    2. Select Manually Install Artifact and select any library jar, you have available locally
    • EXPECTED RESULT:
      Library is added to the list . Show and Resolve problems / Download Libraries,if necessary . If problem remains,resolve it manually.
  8. Add Local Javadoc
    1. Click on any Library node in projects view and invoke popup menu
    2. Select Add Local Javadoc and select any javadoc, you have available locally
    • EXPECTED RESULT:
      javadoc is loaded .Show and Resolve problems / Download Libraries,if necessary .
  9. Remove Dependency
    1. Click on any Library node in projects view and invoke popup menu
    2. Select Remove Dependency
    • EXPECTED RESULT:
      Dependency should be removed.
  10. Exclude Dependency
    1. This option is available only for transitive dependencies
    2. Click on any Library node in projects view and invoke popup menu
    3. Select Exclude Dependency
    • EXPECTED RESULT:
      Dependency should be removed.
  11. View Artifact Details
    1. Click on any Library node in projects view and invoke popup menu
    2. Select View Artifact Details
    • EXPECTED RESULT:
      Artifact Details is opened in the editor .

}}

Test suite: Maven repository browser

Purpose: Test Maven repository browser functionality

  1. Invoke repository browser
    1. Start IDE with fresh userdir
    2. Go to Services window, expand Maven Repositories node
    • EXPECTED RESULT:
      The Maven Repository Browser node and has only local repo).
  2. Repository browser with remote repo
    1. Create new Maven java project
    2. Go to Services window, expand Maven Repositories node
    • EXPECTED RESULT:
      The Maven Repository Browser appears and has local repo as well as central repo registered).
  3. Update Indexes on local/remore repo
    1. Invoke Update Index on repo node popup
    • EXPECTED RESULT:
      Index gets updated.
  4. Add repository
    1. Invoke Add repository from popup on Maven repositories node
    2. Write TestingRepository for Name,TestRep for ID and select path to ~/TestRep folder (create it).
    3. Hit Add button.
    • EXPECTED RESULT:
      The repository is added.Try to add there any libraries and check it's visible in Repository Browser in IDE.
  5. Find in repository
    1. Invoke Find from popup on Maven repositories node, type "jfreechart"
    • EXPECTED RESULT:
      Check that the searched tree is the same as when Adding library to a project.
  6. Artifact details
    1. Doubleclick on some artifact from Cental repository (e.g. jfree.jfreechart v 1.0.13)
    • EXPECTED RESULT:
      Details of artifact are displayed in editor area, POM can be viewed.
  7. Download artifact
    1. Invoke Download action from popup on some artifact node from central repo
    • EXPECTED RESULT:
      Artifact is downloaded into local repo.
  8. Download sources/javadoc
    1. Find some artifact in central repo that has javadoc and sources available, download it
    2. From it's popup invoke Download Javadoc (Download Sources)
    • EXPECTED RESULT:
      Javadoc and sources can be downloaded.

Test suite: Edit pom.xml file

Purpose: Test pom.xml editor functionality

  1. Dependency graph
    1. Select "Graph" tab in editor multiview of opened POM file
    • EXPECTED RESULT:
      Dependency graph is displayed.
  2. Code Completion in pom.xml
    1. Switch to source tab
    2. Invoke code completion in section <dependencies>
    3. Select <dependency> from the code completion
    • {{result|EXPECTED RESULT:
      The dependency tag is written to the editor.
  3. Code Generation in pom.xml
    1. Invoke code generation either by Alt+Insert keyboard shortcut or from context menu > Insert Code
    2. Select <dependency>
    • EXPECTED RESULT:
      Add library window is displayed.
  4. Hints in pom.xml
    1. Go to pom.xml and make selected <dependency> tag
    2. The hint indicator appears in gutter
    3. Push Alt + Enter
    4. Push Enter
    • EXPECTED RESULT:
      Move Unmanaged to Dependency Management hint causes adding <dependencyManagement> section.
  5. POM Model tab
    1. With opening of pom.xml file, POM Model tab is opened in Navigator window
    2. Select any tag in the Model window and double-click on it
    • EXPECTED RESULT:
      Corresponding tags should be marked also in the editor.
  6. POM Inheritance tab
    1. Go to the previously created Enterprise Application project and open pom.xml file from (ear)
    2. Select POM Inheritance from dropdownlist in Navigator window
    3. Select other project then current one in the list and double-click.
    • EXPECTED RESULT:
      Corresponding project's pom.xml is opened in editor.
  7. Code completion based on index of local repo
    1. Start IDE with empty userdir
    2. Open some simple j2se maven project
    3. If Netbeans start downloading index of central repo, cancel it
    4. Open pom.xml
    5. Put carret inside <version> tag of JUnit dependency and invoke code completion
    • EXPECTED RESULT:
      Only JUnit version that are present in local repository should be offered in code completion. Check content of your local repo in Maven repository browser window.
  8. Hyperlinks in POM
    1. Open POM file that contains hyperlink (e.g. you can use pom.xml in webapp project)
    2. Navigate to some hyperlink, CTRL+click it
    • EXPECTED RESULT:
      You can jump to definition by CTRL+clicking on hyperlink. Otherwise you are shown in baloon popup value if you dot not perform click

Test suite: Functional tests

Purpose: Test scenarios for Maven usage
Setup: Test all J2EE project types for JavaEE5, JavaEE6 and JavaEE7.

  1. Two depending Java applications
    1. Create new Maven java application project (m1)
    2. Build it to install JAR into local repo
    3. Create another new Maven java application project (m2)
    4. Build it to install JAR into local repo
    5. Add to dependencies in (m2) dependency on (m1)
    6. Open predefined App.java in (m2) and try to use in code predefined App.java from (m1)
    7. Check also that Go to source works and opens App.java from (m1)
    • EXPECTED RESULT:
      Class from (m2) can be used and Go to source works. ".
  2. Find usages in local repo
    1. Build again (m2)
    2. Close (m2)
    3. Invoke Find usagas on App.java in (m1)
    • EXPECTED RESULT:
      Find usagas should find reference from (m2) jar in local repo.
  3. Build installers for NB application
    1. Create new Maven NetBeans Platform application project (Nbapp)
    2. Clean and build (on Nbapp-app)
    3. Switch to deployment profile
    4. Clean and build; installers are generated
    • EXPECTED RESULT:
      Installers are generated in deployment profile; all work fine. ".
  4. Create CRUD sample
    1. Create new CRUD sample application (Samples|Maven)
    2. Clean and build parent project
    3. Run 'crud-sample-application - NetBeans Platform based application'
    • EXPECTED RESULT:
      Application starts".

Test suite: Misc tests

Purpose: To test misc. Maven support features
Setup:

  1. Local definition settings.xml
    1. Have in ~/.m2/settings.xml some section specific to your environment, e.g. proxy settings (See details in [[1]]
    2. Do some action (e.g. create new module) and check that action is executed according to ~/.m2/settings.xml
    3. Download and unzip Maven distribution from web
    4. In Tools|Options, change Maven home to newly downloaded bits
    5. move your settings.xml from ~/.m2 to $NEW_MAVEN_HOME/conf/settings.xml
    6. Change something specific in $NEW_MAVEN_HOME/conf/settings.xml (e.g. proxy settings)
    7. Do some action (e.g. create new module) and check that action is executed according to $NEW_MAVEN_HOME/conf/settings.xml
    • EXPECTED RESULT:
      Settings.xml in Maven home can be taken into account".
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