2

specflow では、「何か役に立つ」などの名前でシナリオを作成すると、生成された単体テストは「DoSomethingUsefull」(スペースなし) という名前になります。シナリオの名前が長い場合、これは nunit テスト ランナーではあまり読みにくくなります。

アンダースコアで単語を区切る方法はありますか? (設定みたいな?)

4

1 に答える 1

3

唯一の方法は、SpecFlow のソース コードを変更することです。


namespace TechTalk.SpecFlow
{
    public static string ToIdentifierPart(this string text)
    {
        text = firstWordCharRe.Replace(text, match => match.Groups["pre"].Value + match.Groups["fc"].Value.ToUpper());

        // --- add this line ---
        text = text.Replace(" ", "_");   

        text = punctCharRe.Replace(text, "_");
        text = RemoveAccentChars(text);

        if (text.Length > 0)
            text = text.Substring(0, 1).ToUpper() + text.Substring(1);

        return text;
    }
}
于 2011-05-17T20:25:11.477 に答える