Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auto-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄承天
auto-test
Commits
9a89229b
提交
9a89229b
authored
4月 15, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
路由规则
上级
a8cc7cf7
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
4 行删除
+21
-4
TestTask.java
src/main/java/com/zjty/autotest/mq/TestTask.java
+21
-4
没有找到文件。
src/main/java/com/zjty/autotest/mq/TestTask.java
浏览文件 @
9a89229b
...
@@ -16,11 +16,16 @@ import com.zjty.autotest.util.IdWorker;
...
@@ -16,11 +16,16 @@ import com.zjty.autotest.util.IdWorker;
import
com.zjty.autotest.util.UnZipRarUtil
;
import
com.zjty.autotest.util.UnZipRarUtil
;
import
com.zjty.autotest.websocket.WebSocketServer
;
import
com.zjty.autotest.websocket.WebSocketServer
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.chrome.ChromeDriver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -78,10 +83,11 @@ public class TestTask {
...
@@ -78,10 +83,11 @@ public class TestTask {
project
.
setInputs
(
inputs
);
project
.
setInputs
(
inputs
);
}
}
// Report report =testSelenium();
//调用黄承天代码
//调用黄承天代码
Report
report
=
seleniumExecutor
.
execute
(
project
);
Report
report
=
seleniumExecutor
.
execute
(
project
);
log
.
info
(
"黄承天结束返回 report:{}"
,
report
);
log
.
info
(
"黄承天结束返回 report:{}"
,
report
);
if
(
report
!=
null
)
{
List
<
Measure
>
measures
=
report
.
getMeasures
();
List
<
Measure
>
measures
=
report
.
getMeasures
();
if
(
measures
!=
null
&&
measures
.
size
()
>
0
)
{
if
(
measures
!=
null
&&
measures
.
size
()
>
0
)
{
long
count
=
measures
.
stream
().
filter
(
m
->
m
.
getSuccess
()
!=
true
).
count
();
long
count
=
measures
.
stream
().
filter
(
m
->
m
.
getSuccess
()
!=
true
).
count
();
...
@@ -154,14 +160,14 @@ public class TestTask {
...
@@ -154,14 +160,14 @@ public class TestTask {
}
}
List
<
String
>
sourceUrls
=
getSourceUrls
(
testChannel
,
pageContents
);
List
<
String
>
sourceUrls
=
getSourceUrls
(
testChannel
,
pageContents
);
List
<
PageRoute
>
allPageRoutes
=
getAllPageRoutes
(
pageRoutes
,
sourceUrls
);
List
<
PageRoute
>
allPageRoutes
=
getAllPageRoutes
(
pageRoutes
,
sourceUrls
);
if
(
allPageRoutes
!=
null
&&
allPageRoutes
.
size
()>
0
)
{
if
(
allPageRoutes
!=
null
&&
allPageRoutes
.
size
()
>
0
)
{
List
<
PageRoute
>
collect
=
allPageRoutes
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
<
PageRoute
>
collect
=
allPageRoutes
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
if
(
collect
!=
null
&&
collect
.
size
()
>
0
)
{
if
(
collect
!=
null
&&
collect
.
size
()
>
0
)
{
evaReport
.
setPageRoutes
(
collect
);
evaReport
.
setPageRoutes
(
collect
);
}
else
{
}
else
{
evaReport
.
setPageRoutes
(
null
);
evaReport
.
setPageRoutes
(
null
);
}
}
}
else
{
}
else
{
evaReport
.
setPageRoutes
(
null
);
evaReport
.
setPageRoutes
(
null
);
}
}
...
@@ -179,6 +185,7 @@ public class TestTask {
...
@@ -179,6 +185,7 @@ public class TestTask {
WebSocketServer
.
sendInfo
(
"1,"
+
id
,
"sjq110"
);
WebSocketServer
.
sendInfo
(
"1,"
+
id
,
"sjq110"
);
return
;
return
;
}
}
}
log
.
info
(
"评测失败"
);
log
.
info
(
"评测失败"
);
autoResultSetService
.
updateByid
(
id
,
2
);
autoResultSetService
.
updateByid
(
id
,
2
);
WebSocketServer
.
sendInfo
(
"2,"
+
id
,
"sjq110"
);
WebSocketServer
.
sendInfo
(
"2,"
+
id
,
"sjq110"
);
...
@@ -376,5 +383,15 @@ public class TestTask {
...
@@ -376,5 +383,15 @@ public class TestTask {
return
allPageRoutes
;
return
allPageRoutes
;
}
}
public
Report
testSelenium
(){
System
.
setProperty
(
"webdriver.chrome.driver"
,
"C:\\Users\\Jey\\Downloads\\chromedriver_win32\\chromedriver.exe"
);
WebDriver
driver
=
new
ChromeDriver
();
String
baseUrl
=
"http://www.baidu.com/"
;
driver
.
get
(
baseUrl
+
"/"
);
WebElement
inputBox
=
driver
.
findElement
(
By
.
id
(
"kw"
));
inputBox
.
sendKeys
(
"CSDN"
);
driver
.
findElement
(
By
.
id
(
"su"
)).
click
();
driver
.
quit
();
return
null
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论