夜間のビルドが完了すると、いくつかの NUnit テストを自動的に実行しています。新しいビルドを検出し、ビルドされた MSI をローカル フォルダーにコピーし、すべてのコンポーネントをテスト サーバーにデプロイするコンソール アプリケーションがあります。その後、Process/ProcessStartInfo を使用して "nunit-console.exe" を実行することで、NUnit dll に一連のテストを実行します。私の質問は、Total Success/Failed テストの数値をプログラムで取得するにはどうすればよいですか?
3083 次
4 に答える
3
CruiseControl.NET のような継続的インテグレーション サーバーの使用を検討しましたか?
テストをビルドして実行し、結果を Web ページに表示します。ツールだけが必要な場合はnunit-console.exe
、結果を XML で出力し、クルーズ コントロールのような XSLT スクリプトで解析/変換します。
以下は、このような XSL ファイルの例です。変換を の直接出力で実行する場合nunit-console.exe
、select ステートメントを変更して、cruisecontrol を削除する必要があります。
ただし、継続的インテグレーションに興味があるようです。
于 2010-06-11T18:38:52.163 に答える
1
同様の要件があり、NUnit によって生成されたテスト結果の XML ファイルを読み込む必要がありました。
XmlDocument testresultxmldoc = new XmlDocument();
testresultxmldoc.Load(this.nunitresultxmlfile);
XmlNode mainresultnode = testresultxmldoc.SelectSingleNode("test-results");
this.MachineName = mainresultnode.SelectSingleNode("environment").Attributes["machine-name"].Value;
int ignoredtests = Convert.ToInt16(mainresultnode.Attributes["ignored"].Value);
int errors = Convert.ToInt16(mainresultnode.Attributes["errors"].Value);
int failures = Convert.ToInt16(mainresultnode.Attributes["failures"].Value);
int totaltests = Convert.ToInt16(mainresultnode.Attributes["total"].Value);
int invalidtests = Convert.ToInt16(mainresultnode.Attributes["invalid"].Value);
int inconclusivetests = Convert.ToInt16(mainresultnode.Attributes["inconclusive"].Value);
于 2012-06-27T13:03:13.800 に答える
0
最近、同様の要件があり、小さなオープン ソース ライブラリを作成して、結果ファイルを結果の 1 つの集計セットに結合しました (nunit-console の 1 回の実行ですべてのテストを実行したかのように)。
https://github.com/15below/NUnitMergerで見つけることができます
于 2012-06-25T08:26:02.217 に答える