[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Devel.Tests.Ubuntu / nunit.framework / TUnit / XMLUtils.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Linq;
5 using System.Xml;
6
7 namespace NUnit.Framework.TUnit
8 {
9     public class XMLUtils
10     {
11         private static string XML_ELEMENT_ENVIRONMENT = "environment";
12         private static string XML_ELEMENT_SUITE = "suite";
13         private static string XML_ELEMENT_SET = "set";
14         private static string XML_ELEMENT_TESTCASE = "testcase";
15         private static string XML_ELEMENT_TEST_ONLOAD_DELAY = "onload_delay";
16         private static string XML_ELEMENT_RESULT = "result";
17
18         private static string XML_ELEMENT_ACTUAL_RESULT = "actual_result";
19         private static string XML_ELEMENT_START = "start";
20         private static string XML_ELEMENT_END = "end";
21         private static string XML_ELEMENT_STDOUT = "stdout";
22         private static string XML_ELEMENT_STDERR = "stderr";
23
24
25         private static string XML_ATTR_NAME_COMPONENT = "component";
26         private static string XML_ATTR_NAME_ELEMENT_EXECUTION_TYPE = "execution_type";
27         private static string XML_ATTR_NAME_ELEMENT_ID = "id";
28         private static string XML_ATTR_NAME_ELEMENT_PRIORITY = "priority";
29         private static string XML_ATTR_NAME_ELEMENT_PURPOSE = "purpose";
30
31
32         /*XML Reader*/
33         private XmlReader reader;
34
35         /* Test Environment */
36         private TestcaseEnvironment testcaseEnv;
37
38         /* Suite Value*/
39         private TestcaseSuite testcaseSuite;
40
41         /* Suite Value*/
42         //private ArrayList tcList;
43
44         private int count;
45
46         private Boolean flag;
47
48
49         // Instance Constructor
50         public XMLUtils()
51         {
52             reader = null;
53             testcaseEnv = new TestcaseEnvironment();
54             testcaseSuite = new TestcaseSuite();
55             count = 0;
56             flag = false;
57         }
58
59         private List<TestcaseData> readXML(string path)
60         {
61             List<TestcaseData> tcList = new List<TestcaseData>();
62
63             reader = null;
64             //reader = new XmlReader.Create(path);
65             reader = XmlReader.Create(path);
66
67             try
68             {
69                 while (reader.Read())
70                 {
71                     switch (reader.NodeType)
72                     {
73                         case XmlNodeType.Element:
74                             if (reader.Name == XML_ELEMENT_ENVIRONMENT)
75                             {
76                                 /* TEST ENVIRONMENT */
77                                 while (reader.MoveToNextAttribute())
78                                 {
79                                     if (reader.Name == "build_id")
80                                     {
81                                         testcaseEnv.build_id = reader.Value;
82                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV build_id : " + testcaseEnv.build_id);
83                                     }
84                                     else if (reader.Name == "device_id")
85                                     {
86                                         testcaseEnv.device_id = reader.Value;
87                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV device_id : " + testcaseEnv.device_id);
88                                     }
89                                     else if (reader.Name == "device_model")
90                                     {
91                                         testcaseEnv.device_model = reader.Value;
92                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV device_model : " + testcaseEnv.device_model);
93                                     }
94                                     else if (reader.Name == "device_name")
95                                     {
96                                         testcaseEnv.device_name = reader.Value;
97                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV device_name : " + testcaseEnv.device_name);
98                                     }
99                                     else if (reader.Name == "lite_version")
100                                     {
101                                         testcaseEnv.lite_version = reader.Value;
102                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV lite_version : " + testcaseEnv.lite_version);
103                                     }
104                                     else if (reader.Name == "host")
105                                     {
106                                         testcaseEnv.host = reader.Value;
107                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV host : " + testcaseEnv.host);
108                                     }
109                                     else if (reader.Name == "manufacturer")
110                                     {
111                                         testcaseEnv.manufacturer = reader.Value;
112                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV manufacturer : " + testcaseEnv.manufacturer);
113                                     }
114                                     else if (reader.Name == "resolution")
115                                     {
116                                         testcaseEnv.resolution = reader.Value;
117                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV resolution : " + testcaseEnv.resolution);
118                                     }
119                                     else if (reader.Name == "screen_size")
120                                     {
121                                         testcaseEnv.screen_size = reader.Value;
122                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"ENV screen_size : " + testcaseEnv.screen_size);
123                                     }
124                                 }
125                             }
126                             /* TEST CASE SUITE */
127                             else if (reader.Name == XML_ELEMENT_SUITE)
128                             {
129                                 while (reader.MoveToNextAttribute())
130                                 {
131                                     if (reader.Name == "category")
132                                     {
133                                         testcaseSuite.suite_category = reader.Value;
134                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"SUITE category : " + testcaseSuite.suite_category);
135                                     }
136                                     else if (reader.Name == "launcher")
137                                     {
138                                         testcaseSuite.suite_launcher = reader.Value;
139                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"SUITE launcher : " + testcaseSuite.suite_launcher);
140                                     }
141                                     else if (reader.Name == "name")
142                                     {
143                                         testcaseSuite.suite_name = reader.Value;
144                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"SUITE name : " + testcaseSuite.suite_name);
145                                     }
146                                 }
147                             }
148                             else if (reader.Name == XML_ELEMENT_SET)
149                             {
150                                 reader.MoveToNextAttribute();
151                                 if (reader.Name == "name")
152                                 {
153                                     testcaseSuite.set_name = reader.Value;
154                                     //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"SET name : " + testcaseSuite.set_name);
155                                 }
156                             }
157                             /* TEST CASE READ */
158                             else if (reader.Name == XML_ELEMENT_TESTCASE)
159                             {
160                                 TestcaseData tmp = new TestcaseData();
161                                 // add in arrayList 
162                                 tcList.Add(tmp);
163                                 //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"CASE ARY ADD *****************************");
164                                 while (reader.MoveToNextAttribute())
165                                 {
166                                     if (reader.Name == XML_ATTR_NAME_COMPONENT)
167                                     {
168                                         ((TestcaseData)tcList[count]).component = reader.Value;
169                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE component : " + reader.Value);
170                                     }
171                                     else if (reader.Name == XML_ATTR_NAME_ELEMENT_EXECUTION_TYPE)
172                                     {
173                                         ((TestcaseData)tcList[count]).execution_type = reader.Value;
174                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE execution : " + reader.Value);
175                                     }
176                                     else if (reader.Name == XML_ATTR_NAME_ELEMENT_ID)
177                                     {
178                                         ((TestcaseData)tcList[count]).id = reader.Value;
179                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE ID : " + reader.Value);
180
181                                     }
182                                     else if (reader.Name == XML_ATTR_NAME_ELEMENT_PRIORITY)
183                                     {
184                                         ((TestcaseData)tcList[count]).priority = reader.Value;
185                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE priority : " + reader.Value);
186                                     }
187                                     else if (reader.Name == XML_ATTR_NAME_ELEMENT_PURPOSE)
188                                     {
189                                         ((TestcaseData)tcList[count]).purpose = reader.Value;
190                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE purpose : " + reader.Value);
191                                     }
192                                     else if (reader.Name == XML_ELEMENT_RESULT)
193                                     {
194                                         ((TestcaseData)tcList[count]).result = reader.Value;
195                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE result : " + reader.Value);
196                                     }
197
198                                     else if (reader.Name == XML_ELEMENT_TEST_ONLOAD_DELAY)
199                                     {
200                                         ((TestcaseData)tcList[count]).onloaddelay = reader.Value;
201                                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE onloaddelay : " + reader.Value);
202                                     }
203                                 }
204                             }
205
206                             /* Description */
207                             else if (reader.Name == "description")
208                             {
209                                 while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
210                                     reader.Read();
211
212                                 ((TestcaseData)tcList[count]).test_script_entry = reader.Value;
213                                 //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE test_script_entry : " + reader.Value);
214                             }
215                             /* TEST CASE READ */
216                             else if (reader.Name == "result_info")
217                             {
218                                 flag = true;
219                                 while (flag)
220                                 {
221                                     reader.Read();
222                                     if (reader.NodeType == XmlNodeType.Element)
223                                     {
224                                         if (reader.Name == XML_ELEMENT_ACTUAL_RESULT)
225                                         {
226                                             while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
227                                                 reader.Read();
228
229                                             ((TestcaseData)tcList[count]).actual_result = reader.Value;
230                                             //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE actual_result : " + reader.Value);
231                                         }
232                                         else if (reader.Name == XML_ELEMENT_START)
233                                         {
234                                             while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
235                                                 reader.Read();
236
237                                             ((TestcaseData)tcList[count]).start = reader.Value;
238                                             //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE start : " + reader.Value);
239                                         }
240                                         else if (reader.Name == XML_ELEMENT_END)
241                                         {
242                                             while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
243                                                 reader.Read();
244
245                                             ((TestcaseData)tcList[count]).end = reader.Value;
246                                             //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE end : " + reader.Value);
247                                         }
248                                         else if (reader.Name == XML_ELEMENT_STDOUT)
249                                         {
250                                             while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
251                                                 reader.Read();
252
253                                             ((TestcaseData)tcList[count]).stdout = reader.Value;
254                                             //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE stdout : " + reader.Value);
255                                         }
256                                         else if (reader.Name == XML_ELEMENT_STDERR)
257                                         {
258                                             while (reader.NodeType != XmlNodeType.Text && reader.NodeType != XmlNodeType.EndElement)
259                                                 reader.Read();
260
261                                             ((TestcaseData)tcList[count]).stderr = reader.Value;
262                                             //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE stderr : " + reader.Value);
263                                         }
264                                     }
265                                     if (reader.NodeType == XmlNodeType.EndElement)
266                                     {
267                                         if (reader.Name == "result_info")
268                                         {
269                                             flag = false;
270                                         }
271                                     }
272                                 }
273                             }
274                             break;
275                         case XmlNodeType.Text:
276                             //if (reader.Name == XML_ELEMENT_TEST_SCRIPT_ENTRY)
277                             //{
278                             //((TestcaseData)tcList[count]).test_script_expected_result = reader.Value;
279                             ////LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"        CASE test_script_entry : " + reader.Value);
280                             ////LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,"CASE ARY END ***************************** ");
281                             //}
282                             break;
283                         case XmlNodeType.EndElement:
284                             flag = false;
285                             if (reader.Name == "testcase")
286                             {
287                                 //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ," ***************************** END ***************************** ");
288                                 count++;
289                             }
290                             break;
291                     }
292                 }
293             }
294             catch (Exception e)
295             {
296                 LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ERROR : " + e.Message);
297             }
298
299             reader.Dispose();
300
301             return tcList;
302         }
303
304         public String[] getTestIdList(string path)
305         {
306             List<string> res = new List<string>();
307             List<TestcaseData> tcList;
308
309             try
310             {
311                 tcList = readXML(path);
312                 foreach (TestcaseData data in tcList)
313                 {
314                     res.Add(data.id);
315                 }
316             }
317             catch (Exception e)
318             {
319                 LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ERROR : " + e.Message);
320             }
321             return (string[])res.ToArray<string>();
322         }
323
324         public String[] getFailList(string path)
325         {
326
327             List<string> res = new List<string>();
328             List<TestcaseData> tcList;
329
330             try
331             {
332                 tcList = readXML(path);
333                 foreach (TestcaseData data in tcList)
334                 {
335                     if (data.result == "FAIL")
336                     {
337                         res.Add(data.id);
338                         //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG ,data.id);
339                     }
340                 }
341             }
342             catch (Exception e)
343             {
344                 LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ERROR : " + e.Message);
345             }
346
347             return (string[])res.ToArray<string>();
348         }
349
350         public void writeResult(String path, String fileName, TestcaseEnvironment testEnv, List<TestcaseData> list)
351         {
352             try
353             {
354                 FileStream fs = new FileStream(path + fileName, FileMode.Create);
355                 StreamWriter sw = new StreamWriter(fs);
356
357                 XmlWriter xmlWriter = XmlWriter.Create(sw);
358                 xmlWriter.WriteStartDocument();
359
360                 xmlWriter.WriteStartElement("test_definition");
361
362                 xmlWriter.WriteStartElement("suite");
363                 xmlWriter.WriteAttributeString("category", "");
364                 xmlWriter.WriteAttributeString("extension", "");
365                 xmlWriter.WriteAttributeString("name", "");
366
367                 xmlWriter.WriteStartElement("set");
368                 xmlWriter.WriteAttributeString("name", "C#");
369                 xmlWriter.WriteAttributeString("set_debug_msg", "N/A");
370                 xmlWriter.WriteAttributeString("type", "js");
371
372                 /* MAKE TESTCASE */
373                 foreach (TestcaseData data in list)
374                 {
375
376                     xmlWriter.WriteStartElement("testcase");
377                     xmlWriter.WriteAttributeString("component", data.component);
378                     xmlWriter.WriteAttributeString("execution_type", data.execution_type);
379                     xmlWriter.WriteAttributeString("id", data.id);
380                     xmlWriter.WriteAttributeString("priority", data.priority);
381                     xmlWriter.WriteAttributeString("purpose", data.purpose);
382                     xmlWriter.WriteAttributeString("onload_delay", data.onloaddelay);
383                     xmlWriter.WriteAttributeString("result", data.result);
384
385                     /*
386                     <description>
387                         <test_script_entry>/opt/tct-messaging-mms-tizen-tests/messaging/MessageBody_mms_extend.html</test_script_entry>
388                     </description>
389                     */
390                     xmlWriter.WriteStartElement("description");
391                     xmlWriter.WriteStartElement("test_script_entry");
392                     xmlWriter.WriteString(data.test_script_entry);
393                     xmlWriter.WriteEndElement(); // close test_script_entry
394                     xmlWriter.WriteEndElement(); // close description
395
396                     /*
397                     <result_info>
398                         <actual_result>PASS</actual_result>
399                         <start>2016-04-01 16:53:06</start>
400                         <end>2016-04-01 16:53:07</end>
401                         <stdout>[Message]</stdout>
402                         <stderr />
403                     </result_info>
404                     */
405                     xmlWriter.WriteStartElement("result_info");
406
407                     xmlWriter.WriteStartElement("actual_result");
408                     xmlWriter.WriteString(data.actual_result);
409                     xmlWriter.WriteEndElement(); // end of atcual_result
410
411                     xmlWriter.WriteStartElement("start");
412                     xmlWriter.WriteString(data.start);
413                     xmlWriter.WriteEndElement(); // end of start
414
415                     xmlWriter.WriteStartElement("end");
416                     xmlWriter.WriteString(data.end);
417                     xmlWriter.WriteEndElement(); // end of end
418
419                     xmlWriter.WriteStartElement("stdout");
420                     xmlWriter.WriteString(data.stdout);
421                     xmlWriter.WriteEndElement(); // end of stdout
422
423                     xmlWriter.WriteStartElement("stderr");
424                     xmlWriter.WriteString(data.stderr);
425                     xmlWriter.WriteEndElement(); // end of stderr
426
427                     xmlWriter.WriteEndElement(); // end of resultinfo
428
429
430                     xmlWriter.WriteEndElement(); // end of testcase
431                 }
432                 xmlWriter.WriteEndElement(); // end of set
433                 xmlWriter.WriteEndElement(); // end of suite
434
435                 xmlWriter.WriteEndDocument();
436
437                 xmlWriter.Dispose();
438
439                 sw.Dispose();
440                 fs.Dispose();
441             }
442             catch (Exception e)
443             {
444                 LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ERROR :: : " + e.Message);
445             }
446         }
447         
448         /*
449             @fileName : fileName of summary XML
450             @path : path of  summary XML
451             @list : SummaryData object list
452         */
453         public void writeSummary(String path, String fileName, List<SummaryData> list)
454         {
455             FileStream fs = new FileStream(path + fileName, FileMode.Create);
456             StreamWriter sw = new StreamWriter(fs);
457
458             XmlWriter xmlWriter = XmlWriter.Create(sw);
459             xmlWriter.WriteStartDocument();
460
461             xmlWriter.WriteStartElement("result_summary");
462             xmlWriter.WriteAttributeString("plan_name", "temp");
463             
464
465             /*
466             <environment 
467             build_id ="" 
468                 tct_version,"TCT_3.0" 
469                 tct_profile,"mobile" 
470                 device_id,"0000d85b00006200" 
471                 device_model,"" 
472                 device_name,"localhost  " 
473                 host,"Linux-3.13.0-83-generic-x86_64-with-Ubuntu-12.04-precise" 
474                 resolution,"" 
475                 screen_size,"" 
476                 manufacturer,"">
477             */
478
479             xmlWriter.WriteStartElement("environment");
480             xmlWriter.WriteAttributeString("build_id", "");
481             xmlWriter.WriteAttributeString("tct_version", "TCT_3.0");
482             xmlWriter.WriteAttributeString("tct_profile", "mobile");
483             xmlWriter.WriteAttributeString("device_id", "0000d85b00006200");
484             xmlWriter.WriteAttributeString("device_model", "");
485             xmlWriter.WriteAttributeString("device_name", "localhost");
486             xmlWriter.WriteAttributeString("host", "Linux -3.13.0-83-generic-x86_64-with-Ubuntu-12.04-precise");
487             xmlWriter.WriteAttributeString("resolution", "");
488             xmlWriter.WriteAttributeString("screen_size", "");
489             xmlWriter.WriteAttributeString("manufacturer", "");
490
491
492             //<other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
493             xmlWriter.WriteStartElement("other");
494             //string attr = "xmlns:xs";
495             //xmlWriter.WriteAttributeString(attr, "http://www.w3.org/2001/XMLSchema");
496             //xmlWriter.WriteAttributeString(attr, "http://www.w3.org/2001/XMLSchema-instance");
497             //xmlWriter.WriteAttributeString("xsi:type", "xs:string");
498             xmlWriter.WriteEndElement(); // close other
499
500             xmlWriter.WriteEndElement(); // close environment
501
502
503             /*
504               <summary test_plan_name = "Empty test_plan_name" >
505                 < start_at > 2016 - 04 - 08_18_37_38 </ start_at >
506                 < end_at > 2016 - 04 - 08_18_38_07 </ end_at >
507               </ summary >
508             */
509             xmlWriter.WriteStartElement("summary");
510             xmlWriter.WriteAttributeString("test_plan_name", "Empty test_plan_name");
511
512             xmlWriter.WriteStartElement("start_at");
513             xmlWriter.WriteString("2016-04-20_18_37_38");
514             xmlWriter.WriteEndElement();  // close start_at
515
516             xmlWriter.WriteStartElement("end_at");
517             xmlWriter.WriteString("2016 - 04 - 08_18_38_07");
518             xmlWriter.WriteEndElement();  // close end_at
519
520             xmlWriter.WriteEndElement();  // close summary
521
522
523             /*
524                 < suite name = "tct-fullscreen-nonw3c-tests" >
525                     < total_case > 13 </ total_case >
526                     < pass_case > 13 </ pass_case >
527                     < pass_rate > 100.00 </ pass_rate >
528                     < fail_case > 0 </ fail_case >
529                     < fail_rate > 0.00 </ fail_rate >
530                     < block_case > 0 </ block_case >
531                     < block_rate > 0.00 </ block_rate >
532                     < na_case > 0 </ na_case >
533                     < na_rate > 0.00 </ na_rate >
534                 </ suite >
535             */
536
537             foreach (SummaryData data in list)
538             {
539                 xmlWriter.WriteStartElement("suite");
540                 xmlWriter.WriteAttributeString("name", data.suiteName);
541
542
543                 xmlWriter.WriteStartElement("total_case");
544                 xmlWriter.WriteString(data.totalCase+"");
545                 xmlWriter.WriteEndElement();//  end of total_case
546
547                 xmlWriter.WriteStartElement("pass_case");
548                 xmlWriter.WriteString(data.passCase + "");
549                 xmlWriter.WriteEndElement();//  end of pass_case
550
551                 xmlWriter.WriteStartElement("pass_rate");
552                 xmlWriter.WriteString(data.passRate + "");
553                 xmlWriter.WriteEndElement();//  end of pass_rate
554
555                 xmlWriter.WriteStartElement("fail_case");
556                 xmlWriter.WriteString(data.failCase + "");
557                 xmlWriter.WriteEndElement();//  end of fail_case
558
559                 xmlWriter.WriteStartElement("fail_rate");
560                 xmlWriter.WriteString(data.failRate + "");
561                 xmlWriter.WriteEndElement();//  end of fail_rate
562
563                 xmlWriter.WriteStartElement("block_case");
564                 xmlWriter.WriteString(data.blockCase + "");
565                 xmlWriter.WriteEndElement();//  end of block_case
566
567                 xmlWriter.WriteStartElement("block_rate");
568                 xmlWriter.WriteString(data.blockRate + "");
569                 xmlWriter.WriteEndElement();//  end of block_rate
570
571                 xmlWriter.WriteStartElement("na_case");
572                 xmlWriter.WriteString(data.naCase + "");
573                 xmlWriter.WriteEndElement(); //  end of na_case
574
575                 xmlWriter.WriteStartElement("na_rate");
576                 xmlWriter.WriteString(data.naRate + "");
577                 xmlWriter.WriteEndElement();//  end of na_reate
578
579                 xmlWriter.WriteEndElement(); //  end of suite
580
581             }
582
583             xmlWriter.WriteEndDocument(); //  end of document
584
585             xmlWriter.Dispose();
586
587
588             sw.Dispose();
589             fs.Dispose();
590         }
591     }
592
593
594     /* Testcase Data */
595     public class TestcaseData
596     {
597         /* testcase value */
598         public String component { get; set; }
599         public String execution_type { get; set; }
600         public String id { get; set; }
601         public String priority { get; set; }
602         public String onloaddelay { get; set; }
603         public String purpose { get; set; }
604         public String test_script_entry { get; set; }
605         public String result { get; set; }
606
607         public String actual_result { get; set; }
608         public String start { get; set; }
609         public String end { get; set; }
610         public String stdout { get; set; }
611         public String stderr { get; set; }
612
613         public TestcaseData()
614         {
615             component = "";
616             execution_type = "";
617             id = "";
618             priority = "";
619             purpose = "";
620             purpose = "";
621             test_script_entry = "";
622             onloaddelay = "";
623             result = "";
624
625             actual_result = "";
626             start = "";
627             end = "";
628             stdout = "";
629             stderr = "";
630         }
631     }
632
633     /* TestcaseSuite Data */
634     public class TestcaseSuite
635     {
636         /*
637           <suite category = "W3C/HTML5 APIs" 
638                 launcher="WRTLauncher" name="tct-3dtransforms-css3-tests">
639             <set name = "3DTransforms" >
640         */
641         public String suite_category { get; set; }
642         public String suite_launcher { get; set; }
643         public String suite_name { get; set; }
644         public String set_name { get; set; }
645
646         public TestcaseSuite()
647         {
648             suite_category = "";
649             suite_launcher = "";
650             suite_name = "";
651             set_name = "";
652         }
653
654     }
655
656     /* TestcaseEnvironment Data */
657     public class TestcaseEnvironment
658     {
659         /*
660           <suite category = "W3C/HTML5 APIs" 
661                 launcher="WRTLauncher" name="tct-3dtransforms-css3-tests">
662             <set name = "3DTransforms" >
663         */
664         public String build_id { get; set; }
665         public String device_id { get; set; }
666         public String device_model { get; set; }
667         public String device_name { get; set; }
668
669         public String host { get; set; }
670         public String lite_version { get; set; }
671         public String manufacturer { get; set; }
672         public String resolution { get; set; }
673         public String screen_size { get; set; }
674
675         public TestcaseEnvironment()
676         {
677             build_id = "";
678             device_id = "";
679             device_model = "";
680             device_name = "";
681             device_name = "";
682
683             host = "";
684             lite_version = "";
685             manufacturer = "";
686             resolution = "";
687             screen_size = "";
688         }
689     }
690
691     /* Summary Data */
692     public class SummaryData
693     {
694         public int totalCase { get; set; }
695         public int passCase { get; set; }
696         public int passRate { get; set; }
697         public int failCase { get; set; }
698         public int failRate { get; set; }
699         public int blockCase { get; set; }
700         public int blockRate { get; set; }
701         public int naCase { get; set; }
702         public int naRate { get; set; }
703
704         public string suiteName { get; set; }
705
706         public SummaryData()
707         {
708             totalCase = 0;
709             passCase = 0;
710             passRate = 0;
711             failCase = 0;
712             failRate = 0;
713             blockCase = 0;
714             blockRate = 0;
715             naCase = 0;
716             naRate = 0;
717             suiteName = "";
718         }
719     }
720 }