Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
selenium-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
selenium-test
Commits
efe63e94
提交
efe63e94
authored
12月 03, 2021
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(自动测试成功):修改了报告以及截图生成的位置,准备Jenkins自动测试
上级
55e7c1e7
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
258 行增加
和
4 行删除
+258
-4
README.md
README.md
+19
-0
dependency-reduced-pom.xml
dependency-reduced-pom.xml
+163
-0
261f3ea7f522477fb25ac75256455590.png
images/261f3ea7f522477fb25ac75256455590.png
+0
-0
pom.xml
pom.xml
+42
-0
SeleniumTestApplication.java
...ava/com/example/seleniumtest/SeleniumTestApplication.java
+14
-0
ConferenceActive.java
...ple/seleniumtest/conferenceRoomTest/ConferenceActive.java
+19
-3
ExtentTestNGIReporterListener.java
...niumtest/extentsreport/ExtentTestNGIReporterListener.java
+1
-1
2021-12-02-16-19-00.html
test-output/2021-12-02-16-19-00.html
+0
-0
没有找到文件。
README.md
0 → 100644
浏览文件 @
efe63e94
# 会议室管理排座的自动测试
## 会议室管理
-
会议室新增测试
1.
都为空新增
2.
规模为空新增
3.
成功添加
-
会议室修改测试
1.
修改全部内容,成功修改
-
会议室查询测试
1.
会议室名称查询
2.
人数查询
3.
会议室规模查询
4.
数据有效性
-
会议室删除测试
1.
删除会议室
dependency-reduced-pom.xml
0 → 100644
浏览文件 @
efe63e94
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<artifactId>
spring-boot-starter-parent
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<version>
2.1.4.RELEASE
</version>
<relativePath>
pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.example
</groupId>
<artifactId>
seleniumTest
</artifactId>
<name>
seleniumTest
</name>
<version>
0.0.1-SNAPSHOT
</version>
<description>
Demo project for Spring Boot
</description>
<build>
<plugins>
<plugin>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
3.2.1
</version>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
</execution>
</executions>
<configuration
/>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src\main\resources\test.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src\main\resources\test.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<version>
2.1.4.RELEASE
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.15
</version>
<scope>
provided
</scope>
<exclusions>
<exclusion>
<artifactId>
protobuf-java
</artifactId>
<groupId>
com.google.protobuf
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<version>
2.1.4.RELEASE
</version>
<scope>
test
</scope>
<exclusions>
<exclusion>
<artifactId>
spring-boot-test
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
<exclusion>
<artifactId>
spring-boot-test-autoconfigure
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
<exclusion>
<artifactId>
json-path
</artifactId>
<groupId>
com.jayway.jsonpath
</groupId>
</exclusion>
<exclusion>
<artifactId>
assertj-core
</artifactId>
<groupId>
org.assertj
</groupId>
</exclusion>
<exclusion>
<artifactId>
mockito-core
</artifactId>
<groupId>
org.mockito
</groupId>
</exclusion>
<exclusion>
<artifactId>
hamcrest-library
</artifactId>
<groupId>
org.hamcrest
</groupId>
</exclusion>
<exclusion>
<artifactId>
jsonassert
</artifactId>
<groupId>
org.skyscreamer
</groupId>
</exclusion>
<exclusion>
<artifactId>
spring-test
</artifactId>
<groupId>
org.springframework
</groupId>
</exclusion>
<exclusion>
<artifactId>
xmlunit-core
</artifactId>
<groupId>
org.xmlunit
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.seleniumhq.selenium
</groupId>
<artifactId>
selenium-java
</artifactId>
<version>
3.4.0
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
31.0.1-jre
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.22
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.relevantcodes
</groupId>
<artifactId>
extentreports
</artifactId>
<version>
2.41.1
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.vimalselvam
</groupId>
<artifactId>
testng-extentsreport
</artifactId>
<version>
1.3.1
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.aventstack
</groupId>
<artifactId>
extentreports
</artifactId>
<version>
3.0.6
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.10
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
<properties>
<java.version>
1.8
</java.version>
</properties>
</project>
images/261f3ea7f522477fb25ac75256455590.png
deleted
100644 → 0
浏览文件 @
55e7c1e7
67.1 KB
pom.xml
浏览文件 @
efe63e94
...
...
@@ -69,10 +69,52 @@
<version>
3.0.6
</version>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.10
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
3.2.1
</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src\main\resources\test.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src\main\resources\test.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
...
...
src/main/java/com/example/seleniumtest/SeleniumTestApplication.java
浏览文件 @
efe63e94
...
...
@@ -4,15 +4,29 @@ import com.example.seleniumtest.conferenceRoomTest.ConferenceActive;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.ImportResource
;
@SpringBootApplication
(
scanBasePackages
=
{
"com.example.seleniumtest"
})
//@Configuration
//@ImportResource(locations = {"classpath:"})
public
class
SeleniumTestApplication
{
@Autowired
ConferenceActive
conferenceActive
;
// public static boolean started = false;
// private static ApplicationContext applicationContext;
//
// public static ApplicationContext get(){
// return applicationContext;
// }
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SeleniumTestApplication
.
class
,
args
);
// started = true;
}
}
src/main/java/com/example/seleniumtest/conferenceRoomTest/ConferenceActive.java
浏览文件 @
efe63e94
package
com
.
example
.
seleniumtest
.
conferenceRoomTest
;
import
com.example.seleniumtest.SeleniumTestApplication
;
import
com.example.seleniumtest.selenium.enums.Browser
;
import
com.example.seleniumtest.selenium.util.WebDriverUtil
;
import
lombok.Data
;
import
org.apache.commons.io.FileUtils
;
import
org.openqa.selenium.*
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
import
org.testng.Assert
;
import
org.testng.Reporter
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.io.File
;
...
...
@@ -26,18 +30,30 @@ public class ConferenceActive {
private
WebDriver
webDriver
=
WebDriverUtil
.
getWebDriver
(
Browser
.
FIREFOX
,
false
);
// public static ApplicationContext applicationContext;
// @BeforeClass
// public void start(){
// if(!SeleniumTestApplication.started){
// applicationContext = SpringApplication.run(SeleniumTestApplication.class);
// SeleniumTestApplication.started = true;
// }else{
// applicationContext = SeleniumTestApplication.get();
// }
// }
//失败截图
public
void
file
()
{
File
screenshotAs
=
((
TakesScreenshot
)
webDriver
).
getScreenshotAs
(
OutputType
.
FILE
);
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
fileName
=
uuid
+
".png"
;
try
{
FileUtils
.
copyFile
(
screenshotAs
,
new
File
(
"images/"
+
fileName
));
FileUtils
.
copyFile
(
screenshotAs
,
new
File
(
"
/opt/conference_manage_deploy/
images/"
+
fileName
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Reporter
.
log
(
"<a href=
..
/images/"
+
fileName
+
" target=_blank>这是失败截图</a>"
,
true
);
Reporter
.
log
(
"<img src=
..
/images/"
+
fileName
+
" style=width:30px;height:30px />"
,
true
);
Reporter
.
log
(
"<a href=
/opt/conference_manage_deploy
/images/"
+
fileName
+
" target=_blank>这是失败截图</a>"
,
true
);
Reporter
.
log
(
"<img src=
/opt/conference_manage_deploy
/images/"
+
fileName
+
" style=width:30px;height:30px />"
,
true
);
}
//新增/编辑会议室输入
...
...
src/main/java/com/example/seleniumtest/extentsreport/ExtentTestNGIReporterListener.java
浏览文件 @
efe63e94
...
...
@@ -17,7 +17,7 @@ import java.util.*;
public
class
ExtentTestNGIReporterListener
implements
IReporter
{
//生成的路径以及文件名
private
static
final
String
OUTPUT_FOLDER
=
"
test-outpu
t/"
;
private
static
final
String
OUTPUT_FOLDER
=
"
/opt/conference_manage_deploy/test_repor
t/"
;
private
static
final
String
FILE_NAME
=
new
SimpleDateFormat
(
"yyyy-MM-dd-HH-mm-ss"
).
format
(
new
Date
())
+
".html"
;
...
...
test-output/2021-12-02-16-19-00.html
deleted
100644 → 0
浏览文件 @
55e7c1e7
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论