How do you install and use grails test coverage? - grails

I'm trying to get the grails code coverage plugin to work based on these directions:
http://www.grails.org/Test+Code+Coverage+Plugin
I did: grails install-plugin code-coverage
Then: grails test-app
Based on that I expect to see a tests/report/cobertura directory, but I don't see anything inside my project after running "grails test-app".
I've got grails 1.1 installed and created a new application. Do I need to do anything else to see these reports? Are there better instructions anywhere?
Thanks

You must use "grails test-app -coverage" to generate the coverage reports.

Related

How to enable grails for Intellij Community 2016.2.5

I just installed intellij community 2016.2.5 in mac, and tried to create a grails project. It does not show grails as an option, but shows Groovy, Gradle, Griffin.
I went to the intellij grails page and it says:
Also, make sure that the Grails plugin is enabled in IntelliJ IDEA. The plugin is bundled with IntelliJ IDEA and is activated by default
Then, I tried to enable the plugin, or find in repositories, but didn't find any, only a Grails Tools, that is not from jetbrains, and after a install and restart, still don't show anything.
Anyone has used this lastest version with Grails? Has any solution or workaround to make it works? Should I download some older version?
Thanks.
Here is how I import a Grails 3 app into community edition:
First use SDKMAN to get grails - http://sdkman.io/install.html
sdk use grails 3.2.1
grails create-app mytestapp
Then import existing project, select the build.gradle file
Check Use Auto Import
Use gradle wrapper
You can run it by using the bootRun gradle task in the gradle toolbar or going to the Application.groovy file and running the main() method.
To see some of the run configs in action you can watch https://www.ociweb.com/products/grails/grails-quickcast-6-developing-grails-3-applications-with-intellij-idea/ - Though I would recomend running gradle from inside intellij, not via the command line. That was just to show how remote debugging works.
With community you lose some features, but it does work well.

Grails 3.1.9 missing command (create-functional-test)

I want migrate Geb functional tests from 1.3.7 to 3.1.9. Tried to create a new plain test with grails create-functional-test in IntelliJ an via console. Both failed with Command not found create-functional-test.
I created a new application with grails create-app and tried again grails create-functional-test, it works as expected.
Compared and improved all Grails dependencies in build.gradle.
Any ideas how i can fix this issue?
EDIT:
If i uncomment this line: //compile "org.grails.plugins:geb:0.13.1" in build.gradle File it is possible to create a Testfile but of course Grails does not know the GebSpec class.
EDIT 2: I solved it!
The old Plugin, see above, caused the problem. I deleted the dependency and reimported my apllication, know it works.

How do I compile grails project using grails command line?

How do I compile my grails project? I want to get a .war file so I can deploy it.
First I installed JDK then I installed grails and I have properly set environment variables for both and checked it.Now I want to compile this grails project using grails command line.how can I do it?
Thanks in advance
If you type "grails help", you'll get a list of all the grails commands. The one you're looking for is "grails war"

Using Grails 2.4.3 in IntelliJ

I've been unable to create/import a Grails 2.4.3 project with IntelliJ 13.1.4. For example, when I create a new module, choose Grails, then click the create button (highlighted below) and choose the location where Grails 2.4.3 is installed, the project is not created correctly (I get a module with just a /src directory instead of a Grails project) and Grails 2.4.3 is not added to the list of Global Libraries. I don't have this problem with any earlier version of Grails.
I have used Grails 2.4.2 with Intellij 13.1.4 successfully. What I did is create the application with the grails create-app command and then do a File / Import Project in Intellij. Give that a try.
As an alternative solution to the IntelliJ 13.1.4 and Grails 2.4.3 bug you can:
grails create app <app-name>
cd app-name
grails integrate-with --intellij
This configured the project correctly for me with just minor tweaks to SDK and application server. This is a minor twist on the work around described above.
See grails doc here
I had the same problem with IntelliJ 13.1.4 and Grails 2.4.3, which i just downloaded.
After using the grails create-app command from the command line i had to import the project, by "create from existing sources" (point to the new top level folder), "Configure SDK" (to set for the Grails 2.4.3) and finally edit the run configuration. In a second test run with a new test project i did not have too configure the run config.
Then the Grails libs for the were downloaded and the basic app ran. Also the Grails specific option in the Intellij "Tools2 section were suddenly available.
So the given answer by Joe is the way to setup a new Grails project but the IDE should be fixed anyways.
It is not consistent. After several tries I can get some applications to work but it does not seem to be automatic. I think I am going to go back to Grails 2.4.2 until this is resolved within Intellij 13.1.4.
In the screenshot above, there are options for groovy/grails/griffon, and so far the alternative offered was command-line. Try choosing groovy option within intelliJ.
We are using IDEA 13.1.4 with grails 1.3.7 and grails 2.2.1(diff projects) and saw the same issue. It appears this is an intelliJ issue and not so much the grails version, so reverting your grails won't gain you anything. Choosing groovy, you should see a prompt for grails directory structure. This does work if you are presented with this option. Seeing inconsistencies here. Thanks to all for posting your workarounds; never hurts to have multiple approaches.
-Duane

Performance issue with webtest and grails

I have read the documentation for Grails and Webtest in this site:
http://www.grails.org/plugin/webtest
And it's very unupdated. Most of the scripts listed there doesn't work.
I am looking a way to run a working alternative of -nostart listed there.
This is because it's very slow to rerun tests. Or maybe a way to run webtests from outside of Grails
Can you give me any pointer?
Thanks in advance
The webtest plugin changed from version 1.3 to use the new hooks provided by the grails test-app script. Unfortunately one piece of functionality not provided by test-app is the -nostart option.
You could try using
grails interactive
then
test-app -functional
hitting enter should re-run the functional tests without doing a complete restart of grails.
I've also removed the -nostart option from the documentation. All the other documentation should be up to date. What other scripts did not work?
You can raise issues here: http://jira.codehaus.org/browse/GRAILSPLUGINS/component/12994

Resources