• R/O
  • SSH
  • HTTPS

c4ju: コミット


コミットメタ情報

リビジョン7 (tree)
日時2012-02-18 20:58:50
作者srz_zumix

ログメッセージ

無視リスト対応
オプション修正

変更サマリ

差分

--- trunk/src/Program.cs (revision 6)
+++ trunk/src/Program.cs (revision 7)
@@ -16,10 +16,12 @@
1616 {
1717 bool input_stdin = false;
1818 bool show_worst = false;
19- bool quiet = false;
19+ bool verbose = false;
2020 List<string> files = new List<string>();
2121 string outfile = "test_default.xml";
2222 string filter_xmlpath = "filter_default.xml";
23+ List<string> excluding = new List<string>();
24+ string excluding_list_txt = null;
2325
2426 #region コマンドライン解析
2527 // コマンドライン引数の解析
@@ -31,6 +33,7 @@
3133 string option = argv.Substring(2);
3234 string opt_out_xmlfile = "out_xmlfile";
3335 string opt_filter = "filter";
36+ string opt_excluding = "excluding";
3437 #region 出力ファイル
3538 if (option.IndexOf(opt_out_xmlfile) == 0)
3639 {
@@ -62,6 +65,8 @@
6265 --help : generate this help message.
6366 --out_xmlfile=<path> : path of xml report.
6467 --filter=<path> : path of test filter xml.
68+--excluding=<file> : read the ignore list from a file.
69+--verbose : displays detailed messages.
6570 "
6671 );
6772 return 0;
@@ -93,12 +98,32 @@
9398 show_worst = true;
9499 }
95100 #endregion
96- #region サイレントモード
97- else if (option == "quiet")
101+ #region 無視リスト
102+ else if (option.IndexOf(opt_excluding) == 0)
98103 {
99- quiet = true;
104+ // フィルターファイル名の指定
105+ if (option.Length > 1)
106+ {
107+ if (option.IndexOf("=") == opt_excluding.Length)
108+ excluding_list_txt = option.Substring(opt_excluding.Length + 1);
109+ }
110+ else if (i < args.Length)
111+ {
112+ filter_xmlpath = args[++i];
113+ }
114+
115+ if (excluding_list_txt[0] == '\"')
116+ {
117+ excluding_list_txt = excluding_list_txt.Substring(1, excluding_list_txt.Length - 2);
118+ }
100119 }
101120 #endregion
121+ #region verbose
122+ else if (option == "verbose")
123+ {
124+ verbose = true;
125+ }
126+ #endregion
102127 }
103128 else if( argv[0] == '-' )
104129 {
@@ -145,6 +170,20 @@
145170 }
146171 #endregion
147172
173+ #region 無視リスト
174+ if (excluding_list_txt != null)
175+ {
176+ using (StreamReader sr = new StreamReader(excluding_list_txt))
177+ {
178+ string line = null;
179+ while ((line = sr.ReadLine()) != null)
180+ {
181+ excluding.Add(line);
182+ }
183+ }
184+ }
185+ #endregion
186+
148187 #region テストの開始処理
149188 Stopwatch test_suites_sw = new Stopwatch();
150189 Stopwatch test_case_sw = new Stopwatch();
@@ -171,7 +210,10 @@
171210 {
172211 xml.Load(f);
173212
174- Console.WriteLine(f);
213+ if (verbose)
214+ {
215+ Console.WriteLine(f);
216+ }
175217
176218 foreach (Filter filter in filter_list)
177219 {
@@ -250,7 +292,7 @@
250292 fr.Line = line;
251293 fr_list.Add(fr);
252294 string test_combine_name = test_case_name + "." + name;
253- if (!quiet)
295+ if (verbose)
254296 {
255297 Console.WriteLine(test_combine_name);
256298 Console.WriteLine(fr.Message);
@@ -286,16 +328,38 @@
286328 }
287329
288330 test_sw.Stop();
331+ bool except = false;
289332 if (fr_list.Count > 0)
290333 {
291- ++failure_count;
334+ string full_name = test_case_name + "." + name;
335+ foreach (string pattern in excluding)
336+ {
337+ if (System.Text.RegularExpressions.Regex.IsMatch(full_name, pattern))
338+ {
339+ // マッチしたら無視
340+ except = true;
341+ break;
342+ }
343+ }
292344 }
293- junitDoc.AppendTestCase(TestSuite
345+ XmlNode testcase = junitDoc.AppendTestCase(TestSuite
294346 , name
295347 , true
296348 , test_sw.Elapsed
297349 , fr_list
298350 );
351+ if (except)
352+ {
353+ // skip ノード追加
354+ testcase.AppendChild(junitDoc.CreateElement("skipped"));
355+ }
356+ else
357+ {
358+ if (fr_list.Count > 0)
359+ {
360+ ++failure_count;
361+ }
362+ }
299363 #endregion
300364 }
301365 test_case_sw.Stop();
--- trunk/readme.txt (revision 6)
+++ trunk/readme.txt (revision 7)
@@ -19,6 +19,8 @@
1919 --help : generate help message.
2020 --out_xmlfile=<path> : path of xml report.
2121 --filter=<path> : path of test filter xml.
22+ --excluding=<file> : read the ignore list from a file.
23+ --verbose : displays detailed messages.
2224
2325 --------------------------------------------------
2426 Description
@@ -48,6 +50,23 @@
4850 value にテスト対象の属性値が代入されます。
4951
5052 --------------------------------------------------
53+Use Excluding
54+
55+--excluding=<file> オプションを使用することで任意のテスト結果を無視(スキップ)することができます。
56+
57+file には、無視したいテストの条件が書かれたファイルを指定します。
58+条件には、無視したいテストの名前を一行ごとに記述します。
59+(正規表現が使用できます。)
60+
61+==== sample excluding txt ====
62+.*Test.*
63+.*anonymous.*
64+==============================
65+
66+
67+
68+
69+--------------------------------------------------
5170 Jenkins Job Sample
5271
5372 ======= job bat file =======
旧リポジトリブラウザで表示