提交 88b1357b authored 作者: mry's avatar mry

fix(报告显示中文):报告显示中文信息

上级 b93592b7
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
...@@ -103,6 +108,15 @@ ...@@ -103,6 +108,15 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
......
...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Component; ...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import org.testng.Assert; import org.testng.Assert;
import org.testng.Reporter; import org.testng.Reporter;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.File; import java.io.File;
...@@ -74,7 +75,6 @@ public class ConferenceActive { ...@@ -74,7 +75,6 @@ public class ConferenceActive {
//修改test会议室 //修改test会议室
private void updateErrorMeetTest() { private void updateErrorMeetTest() {
meetManager();
WebElement tbody = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody")); WebElement tbody = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"));
List<WebElement> rows = tbody.findElements(By.className("el-table__row")); List<WebElement> rows = tbody.findElements(By.className("el-table__row"));
for (WebElement row : rows) { for (WebElement row : rows) {
...@@ -96,9 +96,10 @@ public class ConferenceActive { ...@@ -96,9 +96,10 @@ public class ConferenceActive {
//todo 这个系统暂时没有登录的功能 //todo 这个系统暂时没有登录的功能
} }
@BeforeMethod
//进入页面,并且到达会议室库管理页面 //进入页面,并且到达会议室库管理页面
public void meetManager() { public void meetManager() {
webDriver.get("http://123.60.53.83"); webDriver.get("http://123.60.53.83/");
webDriver.manage().window().maximize(); webDriver.manage().window().maximize();
webDriver.findElement(By.xpath("/html/body/div/div/div[1]/div[2]/div[2]/span")).click(); webDriver.findElement(By.xpath("/html/body/div/div/div[1]/div[2]/div[2]/span")).click();
webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[1]/div/ul/li/div/span")).click(); webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[1]/div/ul/li/div/span")).click();
...@@ -109,7 +110,6 @@ public class ConferenceActive { ...@@ -109,7 +110,6 @@ public class ConferenceActive {
public void resetTest() { public void resetTest() {
try { try {
String test; String test;
meetManager();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).sendKeys("100"); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).sendKeys("100");
...@@ -128,7 +128,6 @@ public class ConferenceActive { ...@@ -128,7 +128,6 @@ public class ConferenceActive {
@Test(description = "查询人数,输入负号") @Test(description = "查询人数,输入负号")
public void findUnNumber() { public void findUnNumber() {
try { try {
meetManager();
//容纳人数查询 //容纳人数查询
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear();
...@@ -153,7 +152,6 @@ public class ConferenceActive { ...@@ -153,7 +152,6 @@ public class ConferenceActive {
public void findMeetName() { public void findMeetName() {
try { try {
String test; String test;
meetManager();
//会议室名称查询 //会议室名称查询
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).clear(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).clear();
...@@ -181,7 +179,6 @@ public class ConferenceActive { ...@@ -181,7 +179,6 @@ public class ConferenceActive {
public void findNumberMeet() { public void findNumberMeet() {
try { try {
String test; String test;
meetManager();
//容纳人数查询 //容纳人数查询
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[2]/div/div/div/input")).clear();
...@@ -197,7 +194,6 @@ public class ConferenceActive { ...@@ -197,7 +194,6 @@ public class ConferenceActive {
@Test(description = "按照会议室规模查询") @Test(description = "按照会议室规模查询")
public void findScaleMeet() { public void findScaleMeet() {
try { try {
meetManager();
WebElement find = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span")); WebElement find = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[1]/form/div/div[4]/button[1]/span"));
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[3]/div/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div[1]/ul/li[1]/span")).click(); webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div[1]/ul/li[1]/span")).click();
...@@ -221,7 +217,6 @@ public class ConferenceActive { ...@@ -221,7 +217,6 @@ public class ConferenceActive {
public void findMeet() { public void findMeet() {
try { try {
String test; String test;
meetManager();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).click();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).clear(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).clear();
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).sendKeys("G"); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/form/div/div[1]/div/div/div/input")).sendKeys("G");
...@@ -254,7 +249,6 @@ public class ConferenceActive { ...@@ -254,7 +249,6 @@ public class ConferenceActive {
@Test(description = "会议室新增测试") @Test(description = "会议室新增测试")
public void insertMeet() { public void insertMeet() {
try { try {
meetManager();
//点击新增 //点击新增
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click();
popUp("test", "test1", "100"); popUp("test", "test1", "100");
...@@ -275,7 +269,6 @@ public class ConferenceActive { ...@@ -275,7 +269,6 @@ public class ConferenceActive {
@Test(description = "新增null会议") @Test(description = "新增null会议")
public void insertNullMeetFail() { public void insertNullMeetFail() {
try { try {
meetManager();
//点击新增 //点击新增
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click();
//点击保存 //点击保存
...@@ -301,7 +294,6 @@ public class ConferenceActive { ...@@ -301,7 +294,6 @@ public class ConferenceActive {
@Test(description = "新增错误会议室") @Test(description = "新增错误会议室")
public void insertErrorMeet() { public void insertErrorMeet() {
try { try {
meetManager();
//点击新增 //点击新增
webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click(); webDriver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[2]/div/div/div[1]/button/span")).click();
popUp("test", "test1", "-qwe123"); popUp("test", "test1", "-qwe123");
...@@ -358,7 +350,6 @@ public class ConferenceActive { ...@@ -358,7 +350,6 @@ public class ConferenceActive {
@Test(description = "会议室删除测试") @Test(description = "会议室删除测试")
public void deleteMeet() { public void deleteMeet() {
try { try {
meetManager();
WebElement tbody = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody")); WebElement tbody = webDriver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div[2]/div[1]/div[3]/table/tbody"));
List<WebElement> rows = tbody.findElements(By.className("el-table__row")); List<WebElement> rows = tbody.findElements(By.className("el-table__row"));
for (WebElement row : rows) { for (WebElement row : rows) {
......
...@@ -154,7 +154,7 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -154,7 +154,7 @@ public class ExtentTestNGIReporterListener implements IReporter {
name= name.substring(0,49)+"..."; name= name.substring(0,49)+"...";
} }
}else{ }else{
name = result.getMethod().getMethodName(); name = result.getMethod().getDescription();
} }
if(extenttest==null){ if(extenttest==null){
test = extent.createTest(name); test = extent.createTest(name);
...@@ -162,8 +162,8 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -162,8 +162,8 @@ public class ExtentTestNGIReporterListener implements IReporter {
//作为子节点进行创建时,设置同父节点的标签一致,便于报告检索。 //作为子节点进行创建时,设置同父节点的标签一致,便于报告检索。
test = extenttest.createNode(name).assignCategory(categories); test = extenttest.createNode(name).assignCategory(categories);
} }
//test.getModel().setDescription(description.toString()); // test.getModel().setDescription(description.toString());
//test = extent.createTest(result.getMethod().getMethodName()); // test = extent.createTest(result.getMethod().getMethodName());
for (String group : result.getMethod().getGroups()) for (String group : result.getMethod().getGroups())
test.assignCategory(group); test.assignCategory(group);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论