Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:22:01+00:00 2026-05-23T03:22:01+00:00

Started playing with grails and I want to evaluate GORM, so I created a

  • 0

Started playing with grails and I want to evaluate GORM, so I created a domain class using Spring Tool Suite: Client with name, vatNumber, and regNumber and the test class was created automatically.

The code for unit test I added is :

package pilot1

import grails.test.*

class ClientTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testSomething() {
        def instances = []
        def myTestDomain = mockDomain(Client, instances)
        def client = new Client(name:"Test",vatNumber:"323",regNumber:"343")
        client.id =1;
        assertEquals client.name, "Test"
        client.save();
        def res = Client.findByName("Test")
        println instances
        println res
        //assertEquals 1, instances.size()
    }
}

The results are [] and null! What did I do wrong?

Also, I would like also to see the SQL generated by GORM (Hibernate) behind the scenes. Any idea how I might do that in Grails ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:22:02+00:00Added an answer on May 23, 2026 at 3:22 am

    http://www.ibm.com/developerworks/java/library/j-grails10148/index.html

    “As I mentioned earlier, Grails supports two basic types of tests: unit and integration. There’s no syntactical difference between the two — both are written as a GroovyTestCase using the same assertions. The difference is the semantics. A unit test is meant to test the class in isolation, whereas the integration test allows you to test the class in a full, running environment.
    Quite frankly, if you want to write all of your Grails tests as integration tests, that’s just fine with me. All of the Grails create-* commands generate corresponding integration tests, so most folks simply use what is already there. As you’ll see in just a moment, most of the things you want to test require the full environment to be up and running anyway, so integration tests are a pretty good default.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started playing with the ASP.Net MVC framework, and today I created
Just started playing with Tornado and want to offer multiple methods of authentication. Currently
I have just started playing around with using Dojo in Zend Framework and things
I have just started playing around with Log4Net... I now want to send an
I started playing with the idea of testing a webpage load time using R.
I have recently started playing with databases, trying to teach myself using examples. I
I have just started playing with KnockoutJS and it it fascinating. I successfully created
I've just started playing with ssh on Mac. I want to setup ssh port
I recently started playing around with writing Perl (v5.8.8) extensions using XS. One of
I just started playing with scala and have been using the Scala By Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.