IntelliJ increase Scalatest Heap space - scala

I'm using IntelliJ to run Scalatest tests. Problem I'm having is the tests are running out of Heap space (likely because my tests are using Selenium and starting up jettys to hit my Api).
I know how to increase my Heap space in IntelliJ but after increasing the space the tests still run out of Heap.
Is there a different place to increase Heap space for tests rather than the usual IntelliJ info.plist (oh btw I'm on Mac)

go to Edit Configurations:
Choose the test on the left, and tweak its VM options:
In case you are using a ScalaTest ant task, there is a jvmarg that you can set:
<jvmarg value="-Xmx2048m -XX:MaxPermSize=128m"/>

As you rightly observed, it is not IDEA's heap size that needs to be increased but rather that of the ScalaTest run configuration accessible from the Run > Edit Configurations... dialog. There, you should be able to set the VM Options for the tests you are trying to run.

Related

GWT 2.5.1 Compile always throws Java Heap Space Error

Whenever I compile GWT 2.5.1 application. by right click on project and doing Run As-> Web Application (GWT Super Dev Mode), it never fully compiles and throws Java heaps space full error. Even when I increase the heap space size to as max as it can be, it is still throwing the same error. No matter what memory value I give, it always failes with heap space error. Can anyone help out?
How did you increase the heap space? In IntelliJ for example you need to explicitely give the build process more space:
Settings > Build, Execution, Deployment > Compiler > Build process heap size

Scanning Error during Import of Maven Projects into Eclipse

I have looked up the following error in numerous places but can't seem to get a consensus on the solution or one that works for that matter.
"Maven Projects
Scanning error[path to project]; java.lang.OutOfMemoryError: Java heap space"
I set MAVEN_OPTS to "-Xms512m -Xmx1024m -XX:MaxPermSize=1024"
The project I am importing is an assets project with many images, icons, .swf, and JS files.
Is there something else I need or am I setting the above in the terminal the wrong way?
Look at the maven build process in jvisualvm (from your jdk). There you can see how much memory is consumed. If you see that the build exceeds the 1024 MB, set -Xmx to a higher value. If you see that the maximal heap size is below 1024 MB, then your MAVEN_OPTS settings did not work.
Increase more heap size more again, Setting for JVM: http://www.wikihow.com/Increase-Java-Memory-in-Windows-7
Open Java mission control to see RAM, heap size usage. It will give you insight to good decision how much memory size is suitable.
http://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-1998576.html

sbt test is slow, sbt test-only is fast

I'm experiencing some perplexing behavior when running tests from SBT. I have a project with ~100 ScalaTest tests. They all ran in a few seconds. I added a dozen more larger tests that take around a second each in IntelliJ. When I run them in SBT via "test" they pass, but take on the order of 10 minutes. When I run them in SBT via "test-only" they pass in seconds, similar to when I run them in IntelliJ.
I tried tinkering with the heap memory, the parallel test running settings, and forking, but nothing I've done fixes the problem. Unfortunately it's not an open-source project, but any hypotheses would be greatly appreciated.

Specify memory for ant maven deploy task

I am using ant maven deploy task to upload the zip file created by the ant script to our repository, but the problem is the file is too big and it fails with
java.lang.OutOfMemoryError: Java heap space. Following is the task
<deploy uniqueversion="false">
<remoterepository url="${repository}" id="${repositoryId}"/>
<remotesnapshotrepository url="${snapshotRepository}" id="${snapshotRepositoryId}"/>
<attach file="target/${qname}-dist.zip" type="zip"/>
<pom file="pom.xml" groupid="com.my.company" artifactid="test" packaging="zip" version="${version}" />
</deploy>
How do I specify memory heap size here, I don't seem to find anything in deploy task or some of its children task.
Maven doesn't fork on the deploy task so to increase the memory, you have to increase the heap size for the maven executable itself. You can just set your MAVEN_OPTS environment variable to include the -Xmx setting: MAVEN_OPTS=”-Xmx512m”

How do I configure Eclipse to run your tests automatically?

I read this article: Configure your IDE to run your tests automatically
http://eclipse.dzone.com/videos/configure-your-ide-run-your
It's pretty easy to configure Eclipse IDE to run an Ant target every time a file is saved.
MyProject -> Right-click : Properties -> Builders -> New -> Ant Builder
The problem is that the builder has to rebuild the jar on every save, which is very long. The JUnit tests run using the .classes in the jar.
We already have JUnit configurations (EclipseIde .launch files which contains the whole classpath to run the tests). I wish I could create a builder that wraps those JUnit launch files. This would have the benefit of running the tests against Eclipse .classes (faster than rebuilding the jar). Also the test results are displayed in the JUnit view.
Has anybody manage to do that?
I recently started using Infinitest and it seems to somehow "know" which parts of the code affect which test cases. So when you change some code, it automatically re-runs the tests which are likely to break. If the test fails, it marks an error at the spot where it failed, the same way Eclipse would mark a coding error like calling a non-existent method or whatever. And it all happens in the background without you having to do anything.
You could try CT-Eclipse, a continuous testing plugin for Eclipse.
From the plugin page:
With CT-Eclipse enabled, as you edit your code, Eclipse runs your tests quietly in the background, and notifies you if any of them fail or cause errors.
You can use JUnit Max it is an eclipse plug in that will run all you tests every time you save. But it will do it without interrupting your work flow. The results are shown in the left corner of Eclipse and you can always go back to the last successful testrun. The plugin runs the tests that are most likely to fail first so that you get a response for your last saving as fast as possible.
http://www.junitloop.org/index.php/JUnitLoop is another one like this (haven't tried it yet myself)