(Quick Reference)

create-unit-test-controller

Purpose

The create-unit-test-controller generates all the unit tests for a controller.

Examples

grails create-unit-test-controller Person
grails create-unit-test-controller "*"

Description

Given at least one domain class, this command creates unit tests for a controller. The command will generate the following files:

  • test/unit/{package}/{domainClass}ControllerIndexTests.groovy
  • test/unit/{package}/{domainClass}ControllerContentTests.groovy
  • test/unit/{package}/{domainClass}ControllerListTests.groovy
  • test/unit/{package}/{domainClass}ControllerCreateTests.groovy
  • test/unit/{package}/{domainClass}ControllerSaveTests.groovy
  • test/unit/{package}/{domainClass}ControllerEditTests.groovy
  • test/unit/{package}/{domainClass}ControllerUpdateTests.groovy
  • test/unit/{package}/{domainClass}ControllerDeleteTests.groovy

Usage:

grails create-unit-test-controller [domainClass]

Arguments:

  • domainClass - Either a domain class name (case-sensitive) without its package or a wildcard (*). If you specify the wildcard the artifacts will be generated for all domain classes.