-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHTMLReporter
More file actions
79 lines (66 loc) · 1.77 KB
/
HTMLReporter
File metadata and controls
79 lines (66 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/*
*
* Class Name : HTMLReporter
* Author : Uzi Eilon <uzie@perfectomobile.com>
* Date : Dec 6th 2013
*
* Description :
* implements ExecutionReporter and create an HTML summary report
*
*/
public class HTMLReporter implements ExecutionReporter {
BufferedWriter _bw = null;
public HTMLReporter (String title )
{
reportHeader(title);
}
public void reportHeader (String title)
{
String repName = Constants.REPORT_LIB+ Constants.HTML_REPORT_NAME;
File f = new File (repName) ;
try {
_bw = new BufferedWriter(new FileWriter(f));
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
_bw.write("<p> Date :"+dateFormat.format(cal.getTime())+" </p>");
_bw.write("<p> Test Name: "+title+"</p>");
_bw.write("<p>");
_bw.write("<p>");
_bw.write("<table border=\"1\">");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void addLine(String testName,String deviceID,String repID,boolean status)
{
try {
_bw.write("<tr>");
_bw.write("<td>"+testName+"</td>");
_bw.write("<td>"+deviceID+"</td>");
_bw.write("<td> <a href=\""+repID+"\">Report</a></td>");
_bw.write("<td>"+status+"</td>");
_bw.write("</tr>");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void closeRep()
{
try {
_bw.write("</table></p></body></html>");
_bw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}