mcpField
T
Testomat Allure Adapter Setup

Testomat Allure Adapter Setup

github.com/testomatioテスト・品質1678 回インストール6 日前に更新
リポジトリ

Testomat Allure Adapter Setup について

Allure を使う Java プロジェクトで、Testomat.io のレポート設定や移行を支援するスキルです。アダプターの導入と注釈の移行に対応し、未対応の Allure 利用は明示的な承認なしに削除しません。

主な機能

  1. 01アダプター導入と移行の方式選択
  2. 02Allure アダプターの設定
  3. 03対応する注釈置換の整理
  4. 04未対応注釈の慎重な処理
  5. 05Maven Surefire の javaagent 設定確認

活用シーン

  1. 01Allure プロジェクトへの Testomat.io レポート追加
  2. 02Allure 注釈の移行計画
  3. 03注釈置換と競合の確認
  4. 04Maven Surefire javaagent の設定

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/testomatio/skills --skill testomat-allure-adapter-setup

インストール後、Claude Code で/testomat-allure-adapter-setupを入力して読み込まれたか確認します。

詳細

Testomat Allure Adapter

すでに Allure を使用している Java プロジェクトで、Testomat.io のレポートを設定します。2 つのモードがあります。Allure を維持してアダプターを追加する方法と、Testomat.io のネイティブアノテーションに移行する方法です。

プロジェクトを設定する前に、ユーザーに希望するモードを尋ねてください。

既存の Allure アノテーションを維持し、テスト結果のレポートにのみ Testomat.io を使用しますか。それとも Allure アノテーションを Testomat.io アノテーションに置き換えますか。

オプション 1:Allure を維持して Testomat.io にレポートを送信する

次の場合にこのオプションを使用します。

  • プロジェクトですでに Allure アノテーションを使用している。
  • ユーザーが @Epic、@Feature、@Story、@Owner、@Severity などのアノテーションを維持したい。

アダプターは Allure から Testomat.io にデータを転送するだけです。Testomat.io から Allure へのアノテーションの移行、生成、同期は行いません。

Testomat Allure Adapter をインストールします。

Maven
<dependency>
    <groupId>io.testomat</groupId>
    <artifactId>testomat-allure-adapter</artifactId>
    <version><LATEST_STABLE_VERSION></version>
</dependency>
Gradle
implementation 'io.testomat:testomat-allure-adapter:<LATEST_STABLE_VERSION>'

オプション 2:Allure から Testomat.io に移行する

次の場合にこのオプションを使用します。

  • ユーザーが Allure アノテーションの使用を終了したい。
  • ユーザーが Testomat.io のアノテーションとレポートのみを使用したい。
  • プロジェクトが新規である、または移行を予定している。

プロジェクトを標準の Testomat.io レポーターに移行します。

次の両方の条件を満たす場合に限り、Allure の依存関係を削除してください。

  1. ユーザーが、サポートされていない Allure アノテーションを削除することを明示的に選択した。
  2. プロジェクトに Allure のアノテーション、API、リスナー、レポート連携が残っていない。
サポート対象の置き換え

次の置き換えを自動的に適用します。

@DisplayName → @Title (automatic)
@AllureId → @TestId (automatic)
@TmsLink → @TestId (automatic)
@Attachment → @Artifact (automatic)
@Step → @Step (automatic)
サポートされていない Allure アノテーション

その他すべての Allure アノテーション(@Epic、@Feature、@Story、@Owner、@Severity、@Description、@Issue など)には、Testomat.io に相当するものがありません。これらを自動的に移行、置き換え、削除してはいけません。

検出された場合は、次のように尋ねてください。

サポートされていない Allure アノテーションが見つかりました。Testomat.io には現在、これらのアノテーションに直接対応する置き換えがありません。維持しますか、それとも削除しますか。

ユーザーが維持する場合:

  • アノテーション、Allure の依存関係、Allure の設定をそのまま残します。

ユーザーが削除する場合:

  • サポートされていないアノテーションを削除します。
  • サポート対象の Testomat.io アノテーションのみを使用して移行を続けます。
  • 上記の条件に従ってのみ、Allure の依存関係を削除します。
@DisplayName を置き換える
@DisplayName("Login test")

↓

@Title("Login test")
import org.junit.jupiter.api.DisplayName;

↓

import io.testomat.core.annotation.Title;
@AllureId を置き換える
@AllureId("a1b2c3d4")

↓

@TestId("a1b2c3d4")
import io.qameta.allure.AllureId;

↓

import io.testomat.core.annotation.TestId;
@TmsLink を置き換える
@TmsLink("k8m2x9q1")

↓

@TestId("k8m2x9q1")
import io.qameta.allure.TmsLink;

↓

import io.testomat.core.annotation.TestId;
@AllureId と @TmsLink の競合

同じテストに両方が指定されている場合:

  • 自動的に置き換えてはいけません。
  • どちらも @TestId に対応しますが、Testomat.io では 1 つのテストにつき @TestId を 1 つしかサポートしていません。
  • どちらの値を使用するか、ユーザーに尋ねてください。
@Step を置き換える
import io.qameta.allure.Step;

↓

import io.testomat.core.annotation.Step;
@io.qameta.allure.Step

↓

@io.testomat.core.annotation.Step
@Attachment を置き換える
import io.qameta.allure.Attachment;

↓

import io.testomat.core.annotation.Artifact;
@Attachment

↓

@Artifact
Allure.step を置き換える

置き換えを行う前に、検出されたすべての Allure.step(...) オーバーロードを分析します。

サポートされている置き換え:

Allure.step(String name)

↓

Testomatio.step(String name, () -> {})
Allure.step(String name, Status status)

↓

Testomatio.step(String name, () -> {})

Status の値は破棄されます。Testomatio.step(...) はステップのステータスのオーバーライドをサポートしていません。

Allure.step(ThrowableContextRunnableVoid<StepContext> runnable)

↓

Testomatio.step("", () -> { /* original runnable body */ })
Allure.step(String name, ThrowableContextRunnableVoid<StepContext> runnable)

↓

Testomatio.step(String name, () -> { /* original runnable body */ })
Allure.step(String name, ThrowableRunnableVoid runnable)

↓

Testomatio.step(String name, () -> { /* original runnable body */ })

ルール:

  • 元のステップ名がある場合は、必ず保持します。
  • 元の実行可能な本体を Testomatio.step(...) の Runnable 引数に移動します。

値を返すオーバーロードはサポートされていません。Testomatio.step(String stepDescription, Runnable function) は値を返さないためです。

Allure.step(String name, ThrowableRunnable<T> runnable)
Allure.step(ThrowableContextRunnable<T, StepContext> runnable)
Allure.step(String name, ThrowableContextRunnable<T, StepContext> runnable)

値を返すオーバーロードが検出された場合は、次のように確認します。

一部の Allure.step(...) の使用箇所は値を返すため、Testomatio.step(...) が戻り値をサポートしていないことから、自動的に移行できません。どのように進めますか?

選択肢:

  1. サポートされているオーバーロードを置き換え、サポートされていないオーバーロードは変更せずに残します。
  2. Allure.step の移行をすべてスキップし、既存の使用箇所をすべてそのまま残します。

ユーザーが選択肢 1 を選んだ場合:

  • サポートされているオーバーロードを置き換えます。
  • 値を返すオーバーロードは変更せずに残します。
  • 手動での移行が必要な使用箇所をユーザーに伝えます。

ユーザーが選択肢 2 を選んだ場合:

  • すべての Allure.step(...) の使用箇所を変更せずに残します。

Allure.step(...) の使用箇所が残っている間は、Allure の依存関係をプロジェクトに残してください。

Allure.addAttachment を置き換える
  • ステップ内では、Testomatio.stepArtifact(String pathToFile) に置き換えます。
  • ステップ外では、Testomatio.artifact(String pathToFile) に置き換えます。
必須の Maven Surefire Plugin 設定

Maven Surefire Plugin の設定を必ず確認します。プロジェクトで使用している場合:

  • argLine が設定されていない場合は、プロジェクトの依存関係で宣言されているバージョンの AspectJ javaagent を追加します。
  • argLine が存在する場合は、既存の値を保持したまま javaagent を追加します。既存の JVM 引数を上書きまたは削除しないでください。
  • AspectJ のバージョンを特定できない場合は、javaagent を追加する前にユーザーに確認します。
<argLine>
    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>

コメント