Cobertura not analysing the project in grails - grails

I'm using grails 1.3.7.I installed code-coverage plugin.And placed the cobertura 1.9.4.jar and asm2.2.3.jar in project lib folder in STS workspace.Running using grails test-app -coverage command.When i'm doing this it runs the whole Junit test casses as well it generate the report in Cobertura folder in target.But in generated HTML code it showing Zero classes and all others are zero.
In console at last it displays 0 classes loading and 0 classes saving like this after running the test casses.
As well I tried in BuildConfig.groovy to add,
coverage { sourceInclusions = ['grails-app/target*'] }
It's not resolving the path
So how can i solve this problem to get correct cobertura report..??
While i'm running using the above mentioned command will the code-coverage (cobertura) automatically instrument the classes or mannually we have to say..??
I go through the cobertura instrumentation ref via comment lines document..in that they used cobertura-instrumented.bat --destination ... if use these comments cobertura-instrumented.bat is not internal or external command like this error is comming..
How to correct this and make this plugin work correct to get correct result rather than 0%..??
Thanks..

Make sure your app is not running at the same time you are running the test suite. Cobertura needs to instrument your compiled code and if the app is running it can interfere with that.

Code-Coverage correctly shows the output after i changed the lib jars as asm2.2.1 to asm3.1 as well asm-util.jar and oro.jar was added on it.

Related

grails intellij ide 'run application' fails to load any controllers

any number of problems tonight.
I have a grails 3.3.8 app in intellij. I have built some domain classes, and in the ide I selected the domain classes and told it to generate the controllers, which it does.
if i right click the Application project in project browser (either to run debug) the app comes up but no controllers are loaded. so i have to cease the session.
if i open gradle view and issue the bootRun command the app starts and the controllers get loaded!
however if i right click on the boot run action and select debug, if disappears off into the ether on a background thread and the IDE never fires and i dont get control of the debug session in the IDE.
This has got terribly frustrating and i've burn't alot of time tonight going round in circles
does anyone know why the right click on Application, in project explorer, fails to load the controllers, whilst bootRun does load them .
If i can fix that - then the debug from the project explorer should work. Its very odd.
i had to try and recreate the project as this evening it got lost telling me my domain classes were no domain classes and when i tried to delete and controllers/services and rebuild them it kept telling me cmdb.$xxxServices gorm data services couldn't be found and refused to build hibernate datastore
you can find the project to look at enter link description here but it needs another project (ticketAdapter to run, and a library project softwoodUtils) i've used the json end points directly on my browser for the ticketAdapter (server) project and i know thats working - its not a grails app itself)
Looks like you are trying to launch a Run/Debug Configuration of a standard Java Application with the public static void main method. For Grails 3 rather use Grails Run/Debug Configuration where specify the Grails module to load and grails command to run the app with:
You can also use gradle actions like bootRun to run your app.id youdouble click a gradle actions from the gradle panel it will automatically create and run a gradle run configuration. Then you can run or debug that configuration.

Fitnesse: is it possible to disable Test and Suite buttons?

I am running Fitnesse on several dispathers and then copy Fitnesse history and logs from all dispatchers to a separate machine. Some other project members need access to test results on this machine but I don't want them to be able to click Test or Suite there. Is it somehow possible to disable Test and Suite buttons?
I would be glad for any options: either somehow configure it in Fitnesse, or get a patched fitnesse.jar, or any other options.
On the main Fitnesse site (http://fitnesse.org/StayInformed), there is the following note: "Note, the Test and Suite buttons on this site have been disabled because search engines tend to invoke them and put my server under stress. This site is actually created with FitNesse.". So I need something like that, if possible.
Is it possible? Not sure I can find a corresponding place in source code to patch and re-build it. My hope is whether someone already did it or find it easy to help. I raised an issue in GitHub where Fitnesse source code is located but I didn't get any feedback yet.
Thank you!
It is indeed possible, that is indeed what is done for fitnesse.org.
I'm not 100% sure how its done but I suspect it is done by disabling 'responders', see http://fitnesse.org/FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile.
In that page a description is given to disable creating new pages:
Responders=addChild:fitnesse.responders.DisabledResponder,new:org.fitnesse.responders.DisabledResponder
You can probably also use this to disable SuiteResponder and TestResponder, by using:
Responders=suite:fitnesse.responders.DisabledResponder,test:org.fitnesse.responders.DisabledResponder
The full list of responders is in fitnesse.responders.ResponderFactory
On a side note: why do need a full FitNesse installation to show test results? I recommend you look into generating tests results in html format, and just publish that html somewhere. I usually use the jUnit runner to run the tests on a build server (it also creates html output) and then publish the html files generated as build artefact which people can open/view.
Sample, from FitNesse project, generating html in build/fitnesse-results:
import org.junit.runner.RunWith;
#RunWith(FitNesseRunner.class)
#FitNesseRunner.Suite("FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestScriptTable")
#FitNesseRunner.FitnesseDir(".")
#FitNesseRunner.OutputDir("./build/fitnesse-results")
public class FitNesseRunnerTest {
}

Sling Testing Tools Selector configuration

AEM 5.6.1
I am trying to run some server side testing using the sling testing tools. I have deployed the junit.core bundle and I can navigate to the JUnitServlet at /system/sling/junit/
When I hit this url there are tests visible from multiple bundles, I don't want to run the adobe ones but I can't figure out how to filter package names past the period using the url.
e.g
Available tests:
com.adobe.stuff
com.my.stuff
I tried:
/system/sling/junit/com/ <--works but isn't detailed enough
/system/sling/junit/com.my <-- breaks unsurprisingly
/system/sling/junit/com%2Emy <-- also breaks with 501
Is there an expected way of doing this? I couldn't find any documentation about this and the javadoc didn't really help either.
/system/sling/junit/com.my.html should work - you are right that the /system/sling/junit servlet should make this more explicit. There are examples of running such tests from proxy JUnit tests in the Sling codebase, see SlingServerSideTest for example.

Running grails test-app command from grails web console plugin

I have installed the grails web plugin. I can now browse to :
localhost:8080/myappname/console
And I can see the console displayed over there. I have bunch of test-cases written for application. I wish I can test my app from this web console.
Is it possible to do so? I'm very new to grails.
Thanks in advance.
Short answer no. The grails console is meant to write groovy code that interacts with your running application. Your running application does not include your test cases or the grails command line by default.
Long answer sort of. Provided you have all of your projects source code available somewhere in the file system where your application is running, you could call an external process to run test-app and return the result to the user. Here are some docs on running external processes in groovy: http://groovy.codehaus.org/Executing+External+Processes+From+Groovy. I suppose you could also package you application somehow to make this work, but I think doing that would be fairly complex.
I am not sure this is a good use case for the console plugin over all. Hope this helps

Ant with JUnit task - OutOfMemoryError

I have an interesting problem. I am using Ant which executes JUnit tests (test suite composed with 50 tests) via build.xml element. The problem is that I receive OutOfMemoryError.
I have enlarged heap space using ANT_OPTS arguments but it did not help. When I execute the same test suite in Eclipse - everything is fine - memory is released thanks to GC.
I think that this problem is related to Ant and its JUnit task.
Maybe logging of the tests are the reason(but on the other hand I have printsummary="false", [maybe outputtoformatters should be set to false as well???]).
My second guess is that TEST***.xml file (generated at the end of the test) is held in memory and flushed at the end of the test. Is there any way to reduce logs which are in that file?
Guys, please give me some clues.
You need to set the maxmemory attribute in the junit task. See the Ant documentation.
to sum up I want to say that the root of the problems was logging. Logs were sent to the stream and not flushed. After switching the logs off - everything was fine.
By default the fork mode is off. Please try with fork mode on and forkmode set to pertest.

Resources