提交 9a89229b authored 作者: 孙洁清's avatar 孙洁清

路由规则

上级 a8cc7cf7
......@@ -16,11 +16,16 @@ import com.zjty.autotest.util.IdWorker;
import com.zjty.autotest.util.UnZipRarUtil;
import com.zjty.autotest.websocket.WebSocketServer;
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.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.io.IOException;
......@@ -78,10 +83,11 @@ public class TestTask {
project.setInputs(inputs);
}
// Report report =testSelenium();
//调用黄承天代码
Report report = seleniumExecutor.execute(project);
log.info("黄承天结束返回 report:{}",report);
if(report!=null) {
List<Measure> measures = report.getMeasures();
if (measures != null && measures.size() > 0) {
long count = measures.stream().filter(m -> m.getSuccess() != true).count();
......@@ -154,14 +160,14 @@ public class TestTask {
}
List<String> sourceUrls = getSourceUrls(testChannel, pageContents);
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());
if (collect != null && collect.size() > 0) {
evaReport.setPageRoutes(collect);
} else {
evaReport.setPageRoutes(null);
}
}else {
} else {
evaReport.setPageRoutes(null);
}
......@@ -179,6 +185,7 @@ public class TestTask {
WebSocketServer.sendInfo("1," + id, "sjq110");
return;
}
}
log.info("评测失败");
autoResultSetService.updateByid(id, 2);
WebSocketServer.sendInfo("2," + id, "sjq110");
......@@ -376,5 +383,15 @@ public class TestTask {
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论