Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
adaptation-master
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
adaptation-master
Commits
45973a4b
提交
45973a4b
authored
1月 15, 2020
作者:
wyl
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of 192.168.1.249:ty_wyl/adaptation-master1 into wyl
# Conflicts: # pom.xml # src/main/java/com/zjty/adaptationmaster/adaptor/service/Impl/AdaptationServiceImpl.java
上级
161443c6
d18c05be
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
239 行增加
和
46 行删除
+239
-46
pom.xml
pom.xml
+54
-10
SeleniumUtils.java
...n/java/com/zjty/adaptationmaster/utils/SeleniumUtils.java
+108
-0
TestCase.java
src/main/java/com/zjty/adaptationmaster/utils/TestCase.java
+69
-0
application-doc.properties
src/main/resources/application-doc.properties
+2
-2
application.properties
src/main/resources/application.properties
+6
-2
Test1.java
src/test/java/com/zjty/adaptationmaster/Test1.java
+0
-0
Test4.java
src/test/java/com/zjty/adaptationmaster/Test4.java
+0
-32
没有找到文件。
pom.xml
浏览文件 @
45973a4b
...
@@ -22,6 +22,12 @@
...
@@ -22,6 +22,12 @@
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<artifactId>
snakeyaml
</artifactId>
<groupId>
org.yaml
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<!--webSocket 后台向前端推送消息-->
<!--webSocket 后台向前端推送消息-->
...
@@ -35,6 +41,38 @@
...
@@ -35,6 +41,38 @@
<scope>
runtime
</scope>
<scope>
runtime
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
org.seleniumhq.selenium
</groupId>
<artifactId>
selenium-java
</artifactId>
<version>
3.141.59
</version>
<exclusions>
<exclusion>
<artifactId>
guava
</artifactId>
<groupId>
com.google.guava
</groupId>
</exclusion>
<exclusion>
<artifactId>
okhttp
</artifactId>
<groupId>
com.squareup.okhttp3
</groupId>
</exclusion>
<exclusion>
<artifactId>
okio
</artifactId>
<groupId>
com.squareup.okio
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<version>
3.2.0
</version>
<exclusions>
<exclusion>
<artifactId>
commons-lang3
</artifactId>
<groupId>
org.apache.commons
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
<artifactId>
jackson-annotations
</artifactId>
...
@@ -120,6 +158,12 @@
...
@@ -120,6 +158,12 @@
<groupId>
org.apache.maven.shared
</groupId>
<groupId>
org.apache.maven.shared
</groupId>
<artifactId>
maven-invoker
</artifactId>
<artifactId>
maven-invoker
</artifactId>
<version>
3.0.1
</version>
<version>
3.0.1
</version>
<exclusions>
<exclusion>
<artifactId>
commons-io
</artifactId>
<groupId>
commons-io
</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
ch.ethz.ganymed
</groupId>
<groupId>
ch.ethz.ganymed
</groupId>
...
@@ -157,16 +201,16 @@
...
@@ -157,16 +201,16 @@
<artifactId>
commons-lang3
</artifactId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.5
</version>
<version>
3.5
</version>
</dependency>
</dependency>
<!-- <dependency>--
>
<!--<dependency
>
<!-- <groupId>com.thoughtworks.xstream</groupId>--
>
<groupId>com.thoughtworks.xstream</groupId
>
<!-- <artifactId>xstream</artifactId>--
>
<artifactId>xstream</artifactId
>
<!-- <version>1.4.10</version>--
>
<version>1.4.10</version
>
<!-- </dependency>--
>
</dependency
>
<!-- <dependency>--
>
<dependency
>
<!-- <groupId>com.thoughtworks.xstream</groupId>--
>
<groupId>com.thoughtworks.xstream</groupId
>
<!-- <artifactId>xstream</artifactId>--
>
<artifactId>xstream</artifactId
>
<!-- <version>1.4.10</version>--
>
<version>1.4.10</version
>
<!--
</dependency>-->
</dependency>-->
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/zjty/adaptationmaster/utils/SeleniumUtils.java
0 → 100644
浏览文件 @
45973a4b
package
com
.
zjty
.
adaptationmaster
.
utils
;
import
org.openqa.selenium.*
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
@Component
public
class
SeleniumUtils
{
@Value
(
"${driverweb}"
)
private
String
driverweb
;
public
WebDriver
initfifox
()
{
System
.
out
.
println
(
driverweb
);
System
.
setProperty
(
"webdriver.gecko.driver"
,
driverweb
);
// 设置驱动类型和位置
WebDriver
driver
=
new
FirefoxDriver
();
return
driver
;
}
public
String
ElementAction
(
List
<
TestCase
>
steps
)
{
WebDriver
driver
=
null
;
try
{
driver
=
initfifox
();
Random
random
=
null
;
for
(
TestCase
step
:
steps
)
{
Thread
.
sleep
(
1000
);
if
(
step
.
getAction
().
equalsIgnoreCase
(
"get"
)){
driver
.
get
(
step
.
getElement
());
}
else
if
(
step
.
getAction
().
equalsIgnoreCase
(
"sendkeys"
)){
String
value
=
step
.
getValue
()
==
null
?
""
:
step
.
getValue
();
if
(
value
.
equalsIgnoreCase
(
"random"
)){
random
=
new
Random
();
int
i
=
random
.
nextInt
(
1000
)+
1000
;
value
=
"test"
+
i
;
}
// driver.findElement(By.xpath(step.getElement())).sendKeys(value);
WebElement
webElement
=
selectType
(
step
.
getMethod
(),
step
.
getElement
(),
driver
);
webElement
.
sendKeys
(
value
);
System
.
out
.
println
(
step
.
getTitle
()+
": "
+
step
.
getElement
()+
" "
+
step
.
getMethod
()+
" "
+
step
.
getAction
()+
" "
+
value
);
}
else
if
(
step
.
getAction
().
equalsIgnoreCase
(
"click"
)){
// driver.findElement(By.xpath(step.getElement())).click();
WebElement
webElement
=
selectType
(
step
.
getMethod
(),
step
.
getElement
(),
driver
);
webElement
.
click
();
System
.
out
.
println
(
step
.
getTitle
()+
": "
+
step
.
getElement
()+
" "
+
step
.
getMethod
()+
" "
+
step
.
getAction
()+
" "
);
}
else
if
(
step
.
getAction
().
equalsIgnoreCase
(
"gettext"
)){
WebElement
webElement
=
selectType
(
step
.
getMethod
(),
step
.
getElement
(),
driver
);
if
(
"errorMsg"
.
equalsIgnoreCase
(
step
.
getElement
())){
if
(
""
.
equals
(
webElement
.
getText
())){
System
.
out
.
println
(
"登录成功!"
);
}
}
else
{
webElement
.
getText
();
System
.
out
.
println
(
webElement
.
getText
());
}
}
else
if
(
step
.
getAction
().
equalsIgnoreCase
(
"readonly"
)){
String
value
=
step
.
getValue
()
==
null
?
""
:
step
.
getValue
();
JavascriptExecutor
removeAttribute
=
(
JavascriptExecutor
)
driver
;
//remove readonly attribute
removeAttribute
.
executeScript
(
"var setDate=document.getElementById(\""
+
step
.
getElement
()+
"\");setDate.removeAttribute('placeholder');"
);
WebElement
webElement
=
selectType
(
step
.
getMethod
(),
step
.
getElement
(),
driver
);
webElement
.
sendKeys
(
"1990-01-02"
);
System
.
out
.
println
(
step
.
getTitle
()+
": "
+
step
.
getElement
()+
" "
+
step
.
getMethod
()+
" "
+
step
.
getAction
()+
" "
+
value
);
}
else
if
(
step
.
getAction
().
equalsIgnoreCase
(
"register"
)){
String
value
=
step
.
getValue
()
==
null
?
""
:
step
.
getValue
();
if
(
value
.
equals
(
driver
.
getCurrentUrl
())){
String
text
=
driver
.
findElement
(
By
.
xpath
(
step
.
getElement
())).
getText
();
System
.
out
.
println
(
text
);
}
else
{
String
errorMsg
=
driver
.
findElement
(
By
.
id
(
"errorMsg"
)).
getText
();
System
.
out
.
println
(
errorMsg
);
}
}
}
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
.
getMessage
());
}
finally
{
driver
.
quit
();
if
(
driver
!=
null
){
driver
=
null
;
}
}
return
null
;
//目前没有用,预留返回字段
}
private
WebElement
selectType
(
String
method
,
String
element
,
WebDriver
driver
)
{
WebElement
element1
=
null
;
if
(
method
.
equalsIgnoreCase
(
"xpath"
)){
element1
=
driver
.
findElement
(
By
.
xpath
(
element
));
}
else
if
(
method
.
equalsIgnoreCase
(
"css"
)){
element1
=
driver
.
findElement
(
By
.
cssSelector
(
element
));
}
else
if
(
method
.
equalsIgnoreCase
(
"id"
)){
element1
=
driver
.
findElement
(
By
.
id
(
element
));
}
else
if
(
method
.
equalsIgnoreCase
(
"name"
)){
element1
=
driver
.
findElement
(
By
.
name
(
element
));
}
return
element1
;
}
}
src/main/java/com/zjty/adaptationmaster/utils/TestCase.java
0 → 100644
浏览文件 @
45973a4b
package
com
.
zjty
.
adaptationmaster
.
utils
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* <p>Description : assess
* <p>Date : 2020/1/3 17:04
* <p>@author : C
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
TestCase
{
/**
* 标题
*/
@Excel
(
name
=
"用例标题"
)
private
String
title
;
/**
* 前置条件
*/
@Excel
(
name
=
"前置条件"
)
private
String
condition
;
/**
* 步骤
*/
@Excel
(
name
=
"步骤"
)
private
String
step
;
/**
* 元素
*/
@Excel
(
name
=
"元素"
)
private
String
element
;
/**
* 方式
*/
@Excel
(
name
=
"方式"
)
private
String
method
;
/**
* 对象
*/
@Excel
(
name
=
"对象"
)
private
String
obj
;
/**
* 动作
*/
@Excel
(
name
=
"动作"
)
private
String
action
;
@Excel
(
name
=
"参数"
)
private
String
value
;
/**
* 期望
*/
@Excel
(
name
=
"期望"
)
private
String
respect
;
}
src/main/resources/application-doc.properties
浏览文件 @
45973a4b
...
@@ -4,8 +4,8 @@ spring.datasource.url=jdbc:postgresql://localhost:5866/adaptation?useSSL=false&s
...
@@ -4,8 +4,8 @@ spring.datasource.url=jdbc:postgresql://localhost:5866/adaptation?useSSL=false&s
spring.datasource.username
=
sysdba
spring.datasource.username
=
sysdba
spring.datasource.password
=
highgo@123
spring.datasource.password
=
highgo@123
MAVENHOME
=
/opt/apache-maven-3.5.4
mavenHome.path
=
/opt/apache-maven-3.5.4
CTLPATH
=
/
home/taiyuan/桌面
/AAS-V9.0/bin/appctl
CTLPATH
=
/
opt
/AAS-V9.0/bin/appctl
CTLPWD
=
Qwert123!@#
CTLPWD
=
Qwert123!@#
src/main/resources/application.properties
浏览文件 @
45973a4b
...
@@ -41,4 +41,8 @@ spring.resources.static-locations=classpath:/uploads/
...
@@ -41,4 +41,8 @@ spring.resources.static-locations=classpath:/uploads/
#highgo
#highgo
highgo.driver
=
org.postgresql.Driver
highgo.driver
=
org.postgresql.Driver
highgo.connectionType
=
postgresql
highgo.connectionType
=
postgresql
highgo.dbName
=
template1
highgo.dbName
=
template1
\ No newline at end of file
driverweb
=
C:/Program Files/driver/geckodriver.exe
testCaseExcelTable
=
C:/Users/admin/Desktop/test.xls
createTxtPath
=
C:/
\ No newline at end of file
src/test/java/com/zjty/adaptationmaster/Test1.java
deleted
100644 → 0
浏览文件 @
161443c6
差异被折叠。
点击展开。
src/test/java/com/zjty/adaptationmaster/Test4.java
deleted
100644 → 0
浏览文件 @
161443c6
package
com
.
zjty
.
adaptationmaster
;
import
com.zjty.adaptationmaster.adaptor.entity.db.DBManage
;
import
com.zjty.adaptationmaster.utils.Regular
;
import
org.junit.Test
;
import
org.postgresql.copy.CopyManager
;
import
org.postgresql.core.BaseConnection
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
public
class
Test4
{
public
static
void
main
(
String
[]
args
)
{
String
s
=
"\"record_alarm\" bit(1) DEFAULT NULL,"
;
System
.
out
.
println
(
s
.
replaceAll
(
"bit(1)"
,
"boolean"
));
}
@Test
public
void
testSubPath
(){
Path
path
=
Paths
.
get
(
"D:\\project\\adaptation\\apusicLibTest\\src"
);
System
.
out
.
println
(
path
.
subpath
(
0
,
1
));
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
System
.
out
.
println
(
path
.
subpath
(
i
,
10
));
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论