STS 73 Maven

Test Specification: Maven Support Test Specification

Author: Mario Schroeder
Version: 7.3
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 both JavaEE5 and JavaEE6 projects.

Contents


Test suite: Maven projects

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

  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 F8. 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 > Unit Tests > 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 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 - Maven executes the code each time.

Test suite: Maven related options

Purpose: Test maven related optins

  1. 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.
  2. 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.


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 central repository index 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. 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.
  3. 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. If you have any settings.xml in your local repository rename it temporary
    2. Start IDE with fresh userdir
    3. Go to Services window, expand Maven Repositories node
    • EXPECTED RESULT:
      The Maven Repository Browser has only local repo and an empty central repository.
  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. Open pom.xml file
    2. Select "Graph" tab in editor multiview
    • 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
    • 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 both JavaEE5 and JavaEE6.

  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 usages on App.java in (m1)
    • EXPECTED RESULT:
      Find usages should find reference from (m2) jar in local repo.
  3. Build installers for NB application
    1. Create new Maven NetBeans Application project (Nbapp)
    2. Clean and build on Nbapp-parent
    3. Invoke popup menu on Nbapp-app
    4. Set Configuration to deployment
    5. Clean and build; installers are generated
    • EXPECTED RESULT:
      Installers are generated in Nbapp/application/target; all work fine. ".
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