Unit Tests

Some useful links/guides how to write unit tests:

As the unit tests are concentrated primarily on individual classes and methods it's mostly the responsibility of individual developers to write unit tests

List of Existing Unit Tests for Groovy & Grails functionality

  • groovy.editor /* Petr H., Matthias S., Martin A. */
  • groovy.grails /* Petr H. */
  • groovy.gsp /* Petr H., Matthias S. */
  • /* Petr H. */

Functional Tests

  • Results for nightly builds (SWAN only)
  • Test Automation
  • Test Guidelines
  • properties can be set on the command line, in nbbuild/ or in groovy.kit/nbproject/private/

Overall summary

Kit name Test count Test duration (min) Class Coverage Method Coverage
groovy.kit 21 10 58% 41%

Note: Tests were run on Toshiba TecraM9 - Intel Pentium M 2GHz, 3GB RAM, Ubuntu 8.10 against NetBeans 7.0 pre-M1

Running Tests

  • Prerequisites:
  • have a local installation of supported version of Grails
  • add test-qa-functional-sys-prop.grails.home=/path/to/grails to nbbuild/
  • Running tests from the IDE:
  • open a test in the IDE
  • Run File
  • Running tests from command line:
cd $NB_ALL/groovy.kit
//will run "stable" tests groovy.kit module
//will use default timeout (= 10mins) - can by overriden by -Dtest.timeout
//will overwrite test-qa-functional-sys-prop.grails.home from nbbuild/
ant test-qa-functional -Dtest.config=stable -Dtest-qa-functional-sys-prop.grails.home=/path/to/grails

Groovy and Grails support

Test sources are in groovy.kit module

  • Available test configurations:
Test Configuration Test Suite(s) Duration (mins)
stable GrailsActionsTest, GrailsWizardsTest, GroovySampleTest, GroovyWizardsTest 10

Covered scenarios

  • Open existing Grails Application with some domain classes and a controller
  • Change a port for running application
  • Call Generate All action on the domain class
  • Install a plugin using Grails plugin manager
  • Call Generate View action on another domain class
  • Call Go to Controller action
  • Call Go to View action
  • Call Go to Domain Class action
  • Run and Stop application
  • Uninstall previously installed plugin
  • Call Create War action
  • Create new Grails Application project
  • Create new GSP file in Grails Application
  • Create new Domain Class in Grails Application
  • Create new Controller in Grails Application
  • Create new Gant Script in Grails Application
  • Create new Service in Grails Application
  • Create new Tag Library in Grails Application
  • Create new Unit Test in Grails Application
  • Create new Integration Test in Grails Application
  • Create and build Groovy Java Demo sample
  • Create and build NB Project Generators sample
  • Create new Groovy class in Java SE application project
  • Create new Groovy script in Java SE application project
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