Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nwn_Api_auto_test
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuai
nwn_Api_auto_test
Commits
e53c6bcf
Commit
e53c6bcf
authored
Dec 25, 2018
by
Li Yongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改邮件和用例
parent
2e0a899a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
29 deletions
+43
-29
DataAll.xls
nwn_Api_auto_test/TestData/DataAll.xls
+0
-0
DefectTest.xml
nwn_Api_auto_test/src/DefectTest.xml
+1
-1
Mail.java
nwn_Api_auto_test/src/com/offcn/TestUnti/Mail.java
+16
-4
ZipUtils.java
nwn_Api_auto_test/src/com/offcn/TestUnti/ZipUtils.java
+26
-24
No files found.
nwn_Api_auto_test/TestData/DataAll.xls
View file @
e53c6bcf
No preview for this file type
nwn_Api_auto_test/src/DefectTest.xml
View file @
e53c6bcf
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<classes>
<classes>
<class
name=
"com.puhui.test.RenMai_APITest"
>
<class
name=
"com.puhui.test.RenMai_APITest"
>
<methods>
<methods>
<include
name=
"f"
invocation-numbers=
"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 "
/>
<include
name=
"f"
invocation-numbers=
"0 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
"
/>
</methods>
</methods>
</class>
</class>
</classes>
</classes>
...
...
nwn_Api_auto_test/src/com/offcn/TestUnti/Mail.java
View file @
e53c6bcf
...
@@ -12,6 +12,8 @@ import javax.mail.internet.MimeMultipart;
...
@@ -12,6 +12,8 @@ import javax.mail.internet.MimeMultipart;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -126,7 +128,7 @@ public class Mail {
...
@@ -126,7 +128,7 @@ public class Mail {
// 4. Subject: 邮件主题
// 4. Subject: 邮件主题
Date
date
=
new
Date
();
Date
date
=
new
Date
();
String
time
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
date
);
String
time
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
date
);
message
.
setSubject
(
"
nwn接口
自动化测试报告-"
+
time
,
"UTF-8"
);
message
.
setSubject
(
"
小雨直播
自动化测试报告-"
+
time
,
"UTF-8"
);
/*
/*
* 下面是邮件内容的创建:
* 下面是邮件内容的创建:
...
@@ -183,9 +185,18 @@ public class Mail {
...
@@ -183,9 +185,18 @@ public class Mail {
// text_image.setContent(mm_text_image);
// text_image.setContent(mm_text_image);
MimeBodyPart
attachment2
=
new
MimeBodyPart
();
MimeBodyPart
attachment2
=
new
MimeBodyPart
();
if
(
ZipUtils
.
ZipTestResult
()){
File
directory
=
new
File
(
"."
);
DataHandler
dh2
=
new
DataHandler
(
new
FileDataSource
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\测试报告详细资料.zip"
));
String
mailpath
=
""
;
try
{
mailpath
=
directory
.
getCanonicalPath
()
+
File
.
separator
+
"test-output"
+
File
.
separator
+
"html\\"
;
}
catch
(
IOException
e1
)
{
// TODO Auto-generated catch block
e1
.
printStackTrace
();
}
if
(
ZipUtils
.
ZipTestResult
(
mailpath
)){
DataHandler
dh2
=
new
DataHandler
(
new
FileDataSource
(
mailpath
+
"测试报告详细资料.zip"
));
attachment2
.
setDataHandler
(
dh2
);
attachment2
.
setDataHandler
(
dh2
);
attachment2
.
setFileName
(
"测试报告详细资料.zip"
);
attachment2
.
setFileName
(
"测试报告详细资料.zip"
);
// // 9. 创建附件"节点"
// // 9. 创建附件"节点"
...
@@ -239,6 +250,7 @@ public class Mail {
...
@@ -239,6 +250,7 @@ public class Mail {
return
message
;
return
message
;
}
}
public
static
InternetAddress
[]
parseAddress
(
String
personnel
){
public
static
InternetAddress
[]
parseAddress
(
String
personnel
){
String
addr
=
""
;
String
addr
=
""
;
if
(
"all"
.
equals
(
personnel
)){
if
(
"all"
.
equals
(
personnel
)){
...
...
nwn_Api_auto_test/src/com/offcn/TestUnti/ZipUtils.java
View file @
e53c6bcf
...
@@ -260,48 +260,50 @@ public class ZipUtils {
...
@@ -260,48 +260,50 @@ public class ZipUtils {
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/** 测试压缩方法1 */
/** 测试压缩方法1 */
// FileOutputStream fos1 = new FileOutputStream(new File("c:/mytest01.zip"));
// FileOutputStream fos1 = new FileOutputStream(new File("c:/mytest01.zip"));
//
//
// ZipUtils.toZip("D:/log", fos1,true);
// ZipUtils.toZip("D:/log", fos1,true);
/** 测试压缩方法2 */
/** 测试压缩方法2 */
List
<
File
>
fileList
=
new
ArrayList
<>();
//
List<File> fileList = new ArrayList<>();
//
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
index.html"
));
// fileList.add(new File(mailpath+"
index.html"));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
overview.html"
));
// fileList.add(new File(mailpath+"
overview.html"));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
reportng.css"
));
// fileList.add(new File(mailpath+"
reportng.css"));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
reportng.js"
));
// fileList.add(new File(mailpath+"
reportng.js"));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
suite1_test1_results.html"
));
// fileList.add(new File(mailpath+"
suite1_test1_results.html"));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
suites.html"
));
// fileList.add(new File(mailpath+"
suites.html"));
//
//
FileOutputStream
fos2
=
new
FileOutputStream
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
mytest02.zip"
));
// FileOutputStream fos2 = new FileOutputStream(new File(mailpath+"
mytest02.zip"));
//
ZipUtils
.
toZip
(
fileList
,
fos2
);
//
ZipUtils.toZip(fileList, fos2);
}
}
public
static
boolean
ZipTestResult
(){
public
static
boolean
ZipTestResult
(
String
mailpath
){
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
File
>
fileList
=
new
ArrayList
<>();
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
index.html"
));
fileList
.
add
(
new
File
(
mailpath
+
"
index.html"
));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
overview.html"
));
fileList
.
add
(
new
File
(
mailpath
+
"
overview.html"
));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
reportng.css"
));
fileList
.
add
(
new
File
(
mailpath
+
"
reportng.css"
));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
reportng.js"
));
fileList
.
add
(
new
File
(
mailpath
+
"
reportng.js"
));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
suite1_test1_results.html"
));
fileList
.
add
(
new
File
(
mailpath
+
"
suite1_test1_results.html"
));
fileList
.
add
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
suites.html"
));
fileList
.
add
(
new
File
(
mailpath
+
"
suites.html"
));
FileOutputStream
fos2
=
null
;
FileOutputStream
fos2
=
null
;
try
{
try
{
fos2
=
new
FileOutputStream
(
new
File
(
"F:\\gitCangKu\\Api_auto_test\\test-output\\html\\
测试报告详细资料.zip"
));
fos2
=
new
FileOutputStream
(
new
File
(
mailpath
+
"
测试报告详细资料.zip"
));
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment