私はアプリケーションを起動し、いくつかのテストを実行するスプリングブートテストを行っています。スプリングブートアプリケーションテスト - メモリの問題
アプリケーションヒープサイズの設定に問題があります。
メモリパラメータを設定してmavenとsurefireを実行すると、すべて動作しますが、IDE(Intellij)から実行しようとすると、java.lang.OutOfMemoryError:Javaヒープスペースが発生します。
@RunWith(Parameterized.class)
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebAppConfiguration
public class MyTest {
public MyTest(String name, URL url) {
this.url = url;
}
@Parameterized.Parameters...
public static Iterable<Object[]> tests() throws IOException {
....
}
@Before
public void setUpContext() throws Exception {
new TestContextManager(getClass()).prepareTestInstance(this);
}
@Test
public void doSomething() throws Exception {
...
}
}
編集し、実行コンフィギュレーション、およびメモリオプションを設定します。 –
この記事のようにIDEのヒープサイズを設定しましたか?[JVMオプションとプラットフォームプロパティの設定](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options- and-platform-properties)? – LHCHIN
申し訳ありませんが、言及するのを忘れましたが、実行コンフィギュレーションでメモリパラメータを設定しました。テスト用のアプリケーションを実行しているVMには渡されないようです。 – Saita