0

別のテスト (同じページ) の結果に基づいて、テーブルの baseUrl を設定したいと思います。Fitnesse のドキュメント (およびその他のリソース) の次のページをたどってみました: smartrics ブログ投稿fitnesse シンボル ページ、しかし、うまく動作しないようです。これまでのところ、次の構文で試しました。

| Fit Rest Fixture | %emailLink% | | GET | / | 200 |Content-Type: text/plain|Email Verified|

| Fit Rest Fixture | emailLink= | | GET | / | 200 |Content-Type: text/plain|Email Verified|

| Fit Rest Fixture | $emailLink | | GET | / | 200 |Content-Type: text/plain|Email Verified|

しかし、それらのどれも機能しません。別のテーブルでテストしているため、シンボルがnullではないことはわかってemailLinkいますが、RestFixtureに挿入できないようです。シンボル名がその値に対して解決されていないことを示す IllegalArgumentException を常に取得します。 java.lang.IllegalArgumentException: Malformed base URL: $emailLink

どんな助けでも大歓迎です。

4

2 に答える 2

0

のコードを見て、FitRestFixtureそれをいじることで、自分に合ったものを思いつきました。私が探していた機能はそのままではサポートされていないようですが、次のような単純な mod を使用して簡単に実現できます (ただし、この方法は最もクリーンではありません)。

/**
 * @return Process args ({@link fit.Fixture}) for Fit runner to extract the
 * baseUrl of each Rest request, first parameter of each RestFixture
 * table.
 */
protected String getBaseUrlFromArgs() {
    String arg = null;
    if (args.length > 0) {
        arg = args[0];
        /* mod starts here */
        if (isSymbol(arg)) {
            String symbolName = stripSymbolNotation(arg);
            arg = resolveSymbol(symbolName);
        }
        /* mod ends here */
    }
    return arg;
}

private boolean isSymbol(String arg) {
    // notice that I've used the '<<' notation convention to extract the 
    // the value from a symbol, while in RestFixture the conventional 
    // notation is %symbolName%
    return null != arg && arg.startsWith("<<");
}

private String stripSymbolNotation(String arg) {
    return arg.substring(2);
}

private String resolveSymbol(String arg) {
    String symbolValue = (String) Fixture.getSymbol(arg);
    LOG.warn(String.format("resolved symbol %s to value %s", arg, symbolValue));
    return symbolValue;
}
于 2016-11-17T13:31:46.713 に答える
0

スリム使ってる?

http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.SymbolsInTables

Slim でこのようにシンボルを数回使用しましたが、特に REST フィクスチャでは使用しませんでした。

于 2016-11-16T06:14:26.100 に答える