@Grasshopperが示唆したことは正確には機能しませんでしたが、正しい方向に見せてくれました。
代わりにプラグインとしてのコードを追加するので、私は、CLIコマンドを実行し、ビットにrun
方法を変更するためにベースとしてそれを使用して、cucumber.api.cli.Main
のコピーを作成することにより、オクタン価レポーターを「/負荷ハック」するために管理し、実行時にプラグインを追加してください。プラグインはコンストラクタでかなりの数のパラメータを必要としたので、これを行う必要がありました。完璧な解決策ではないかもしれませんが、私は最初に持っていたプロセスを構築するためにgradle
を保つことができました。
public static byte run(String[] argv, ClassLoader classLoader) throws IOException {
RuntimeOptions runtimeOptions = new RuntimeOptions(new ArrayList<String>(asList(argv)));
ResourceLoader resourceLoader = new MultiLoader(classLoader);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
//====================Added the following lines ================
//Hardcoded runner(?) class. If its changed, it will need to be changed here also
OutputFile outputFile = new OutputFile(Main.class);
runtimeOptions.addPlugin(new HPEAlmOctaneGherkinFormatter(resourceLoader, runtimeOptions.getFeaturePaths(), outputFile));
//==============================================================
runtime.run();
return runtime.exitStatus();
}
cucumber.api.cli.Mainは、コマンドラインから呼び出されたときにランナーを使用しません。カスタムコードをプラグインとして追加するには、-pオプションを使用します。この記事 - https://automationrhapsody.com/create-cucumber-jvm-custom-formatter/を参照してください。 – Grasshopper