testcontainers / testcontainers/testcontainers-java
[Feature]: JUnit Jupiter extension for reuse of containers
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
Module
Core
Problem
Assume you have several integration tests splitted in some classes. All this tests can reuse the same container instance. If the container needs some time to setup that would be a great benefit.
Solution
By using the JUnit extension API it would be easy to create a custom annotation like this:
@ContainerConfig(name="containerA", needNewInstance=false) public void testFoo() {}
A container that is needed could be simply defined by a provider:
@ContainerProvider(name="containerA") public GenericContainer<?> createContainerA() {}
By using test lifecycle callbacks (https://junit.org/junit5/docs/current/user-guide/#extensions-lifecycle-callbacks) this could be achieved as a JUnit extension.
I would be happy to help by creating the feature :)
Benefit
Containers that are needed for multiple tests in multiple classes only need to be defined once and the instances can be reused.
Alternatives
Would you like to help contributing this feature?
Yes
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Core モジュールから始め、issue で参照されている JUnit Jupiter extension API のライフサイクルコールバックを読みます。提案されている ContainerConfig アノテーションと ContainerProvider アノテーションが、テストクラス間でコンテナを登録して再利用する方法を定義し、そのうえで共有インスタンスが一度だけ作成され、needNewInstance リクエストは分離されたままになることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java
- 領域
- testing
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100