提交 105eb95d authored 作者: mry's avatar mry

test(初始测试):初始自动测试

上级 b189e78b
package com.tykj.selenium;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.testng.TestNG;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import java.util.ArrayList;
import java.util.List;
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.tykj.selenium"},exclude = MongoAutoConfiguration.class)
public class SeleniumApplication {
public static void main(String[] args) {
List<String> suites = new ArrayList<String>();
suites.add("testng.xml");
TestNG testNG = new TestNG();
testNG.setTestSuites(suites);
testNG.run();
SpringApplication.run(SeleniumApplication.class,args);
}
}
......@@ -7,9 +7,7 @@ import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.io.File;
......@@ -23,7 +21,7 @@ public class ConferenceActive {
@Value(value = "${conferenceRoomTest.url}")
private String baseUrl;
private WebDriver webDriver = WebDriverUtil.getWebDriver(Browser.FIREFOX, false);
private WebDriver webDriver = WebDriverUtil.getWebDriver(Browser.FIREFOX);
//失败截图
public void file() {
......@@ -31,7 +29,7 @@ public class ConferenceActive {
String uuid = UUID.randomUUID().toString().replace("-", "");
String fileName = uuid + ".png";
try {
FileUtils.copyFile(screenshotAs, new File("/opt/conference_manage_deploy/images/" + fileName));
FileUtils.copyFile(screenshotAs, new File("/opt/meeting_deploy/images/" + fileName));
} catch (IOException e) {
e.printStackTrace();
}
......@@ -43,16 +41,19 @@ public class ConferenceActive {
//todo 这个系统暂时没有登录的功能
}
@Test
//进入页面
@Test
public void url(){
webDriver.get(baseUrl);
webDriver.get("123.60.53.83");
// webDriver.get(baseUrl);
webDriver.manage().window().maximize();
webDriver.findElement(By.className("router_nav")).click();
webDriver.findElement(By.className("router_nav"));
}
// @Test(description = "新增会议室")
// public void insertMeeting(){
//
......@@ -64,9 +65,9 @@ public class ConferenceActive {
@AfterClass(alwaysRun = true)
public void quit(){
webDriver.quit();
}
// @AfterClass(alwaysRun = true)
// public void quit(){
// webDriver.quit();
// }
}
......@@ -17,7 +17,7 @@ import java.util.*;
public class ExtentTestNGIReporterListener implements IReporter {
//生成的路径以及文件名
private static final String OUTPUT_FOLDER = "/opt/conference_manage_deploy/reports/";
private static final String OUTPUT_FOLDER = "/opt/meeting_deploy/reports/";
private static final String FILE_NAME =
new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒的报告").format(new Date()) + ".html";
......
......@@ -29,7 +29,8 @@ public class WebDriverUtil {
private final static String UOS = System.getProperty("user.dir") + File.separator + "chromedriverUOS";
public static WebDriver getWebDriver(String browser, Boolean headless) {
public static WebDriver getWebDriver(String browser) {
Boolean headless;
String executable = "";
String os = System.getProperty("os.name");
logger.info("本机操作系统:{}", os);
......@@ -73,7 +74,6 @@ public class WebDriverUtil {
if (headless) {
cn360Options.addArguments("--headless");
}
cn360Options.setBinary("/opt/apps/com.360.browser-stable/files/com.360.browser");
return new ChromeDriver(cn360Options);
case Browser.UOS:
System.setProperty("webdriver.chrome.driver", WebDriverUtil.UOS + executable);
......@@ -81,11 +81,9 @@ public class WebDriverUtil {
if (headless) {
uosOptions.addArguments("--headless");
}
uosOptions.setBinary("/usr/bin/uos-browser-stable");
return new ChromeDriver(uosOptions);
default:
throw new RuntimeException("该浏览器不存在:" + browser);
}
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>TestNG Report</title><style type="text/css">table {margin-bottom:10px;border-collapse:collapse;empty-cells:show}th,td {border:1px solid #009;padding:.25em .5em}th {vertical-align:bottom}td {vertical-align:top}table a {font-weight:bold}.stripe td {background-color: #E6EBF9}.num {text-align:right}.passedodd td {background-color: #3F3}.passedeven td {background-color: #0A0}.skippedodd td {background-color: #DDD}.skippedeven td {background-color: #CCC}.failedodd td,.attn {background-color: #F33}.failedeven td,.stripe .attn {background-color: #D00}.stacktrace {white-space:pre;font-family:monospace}.totop {font-size:85%;text-align:center;border-bottom:2px solid #000}</style></head><body><table><tr><th>Test</th><th># Passed</th><th># Skipped</th><th># Failed</th><th>Time (ms)</th><th>Included Groups</th><th>Excluded Groups</th></tr><tr><th colspan="7">testng</th></tr><tr><td><a href="#t0">test</a></td><td class="num">1</td><td class="num">0</td><td class="num">0</td><td class="num">33,263</td><td></td><td></td></tr></table><table><thead><tr><th>Class</th><th>Method</th><th>Start</th><th>Time (ms)</th></tr></thead><tbody><tr><th colspan="4">testng</th></tr></tbody><tbody id="t0"><tr><th colspan="4">test &#8212; passed</th></tr><tr class="passedeven"><td rowspan="1">com.tykj.selenium.conferenceRoomTest.ConferenceActive</td><td><a href="#m0">url</a></td><td rowspan="1">1639104392017</td><td rowspan="1">32472</td></tr></tbody></table><h2>test</h2><h3 id="m0">com.tykj.selenium.conferenceRoomTest.ConferenceActive#url</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p></body></html>
\ No newline at end of file
差异被折叠。
差异被折叠。
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite name="com.tykj.selenium.conferenceRoomTest.ConferenceActive" tests="1" time="32.472" ignored="0" failures="0" timestamp="10 Dec 2021 02:47:05 GMT" skipped="0" hostname="DESKTOP-R9I5LK7" errors="0">
<testcase name="url" time="32.472" classname="com.tykj.selenium.conferenceRoomTest.ConferenceActive"/>
</testsuite> <!-- com.tykj.selenium.conferenceRoomTest.ConferenceActive -->
<html>
<head><title>Test results</title><link href="./testng.css" rel="stylesheet" type="text/css" />
<link href="./my-testng.css" rel="stylesheet" type="text/css" />
</head><body>
<h2><p align='center'>Test results</p></h2>
<table border='1' width='100%' class='main-page'><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Skipped</th><th>testng.xml</th></tr>
<tr align='center' class='invocation-passed'><td><em>Total</em></td><td><em>1</em></td><td><em>0</em></td><td><em>0</em></td><td>&nbsp;</td></tr>
<tr align='center' class='invocation-passed'><td><a href='testng/index.html'>testng</a></td>
<td>1</td><td>0</td><td>0</td><td><a href='testng/testng.xml.html'>Link</a></td></tr></table></body></html>
<table border='1'>
<tr>
<th>Class name</th>
<th>Method name</th>
<th>Groups</th>
</tr><tr>
<td>com.tykj.selenium.conferenceRoomTest.ConferenceActive</td>
<td>&nbsp;</td><td>&nbsp;</td></tr>
<tr>
<td align='center' colspan='3'>@Test</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>url</td>
<td>&nbsp;</td></tr>
<tr>
<td align='center' colspan='3'>@BeforeClass</td>
</tr>
<tr>
<td align='center' colspan='3'>@BeforeMethod</td>
</tr>
<tr>
<td align='center' colspan='3'>@AfterMethod</td>
</tr>
<tr>
<td align='center' colspan='3'>@AfterClass</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>quit</td>
<td>&nbsp;</td></tr>
</table>
<h2>Groups used for this test run</h2>
\ No newline at end of file
<html><head><title>Results for testng</title></head>
<frameset cols="26%,74%">
<frame src="toc.html" name="navFrame">
<frame src="main.html" name="mainFrame">
</frameset>
</html>
<html><head><title>Results for testng</title></head>
<body>Select a result on the left-hand pane.</body></html>
<h2>Methods run, sorted chronologically</h2><h3>&gt;&gt; means before, &lt;&lt; means after</h3><p/><br/><em>testng</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="6ae0ad"> <td>21/12/10 10:47:04</td> <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;ConferenceActive.quit()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]">&lt;&lt;quit()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS </td>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td> <td>main@1354083458</td> <td></td> </tr>
<tr bgcolor="6ae0ad"> <td>21/12/10 10:46:32</td> <td>-32471</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ConferenceActive.url()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]">url()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS </td>
<td>main@1354083458</td> <td></td> </tr>
</table>
<h2>Methods that were not run</h2><table>
</table>
\ No newline at end of file
<h2>Methods run, sorted chronologically</h2><h3>&gt;&gt; means before, &lt;&lt; means after</h3><p/><br/><em>testng</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="6ae0ad"> <td>21/12/10 10:46:32</td> <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ConferenceActive.url()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]">url()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS </td>
<td>main@1354083458</td> <td></td> </tr>
<tr bgcolor="6ae0ad"> <td>21/12/10 10:47:04</td> <td>32471</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;ConferenceActive.quit()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]">&lt;&lt;quit()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS </td>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td> <td>main@1354083458</td> <td></td> </tr>
</table>
<h2>Reporter output</h2><table></table>
\ No newline at end of file
[SuiteResult context=test]
\ No newline at end of file
<html><head><title>testng.xml for testng</title></head><body><tt>&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;<br/>&lt;!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"http://testng.org/testng-1.0.dtd"&gt;<br/>&lt;suite&nbsp;name="testng"&gt;<br/>&nbsp;&nbsp;&lt;listeners&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;listener&nbsp;class-name="com.tykj.selenium.extentsreport.ExtentTestNGIReporterListener"/&gt;<br/>&nbsp;&nbsp;&lt;/listeners&gt;<br/>&nbsp;&nbsp;&lt;test&nbsp;name="test"&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="com.tykj.selenium.conferenceRoomTest.ConferenceActive"&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;methods&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include&nbsp;name="url"/&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/methods&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/class&gt;&nbsp;&lt;!--&nbsp;com.tykj.selenium.conferenceRoomTest.ConferenceActive&nbsp;--&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;<br/>&nbsp;&nbsp;&lt;/test&gt;&nbsp;&lt;!--&nbsp;test&nbsp;--&gt;<br/>&lt;/suite&gt;&nbsp;&lt;!--&nbsp;testng&nbsp;--&gt;<br/></tt></body></html>
\ No newline at end of file
<html>
<head>
<title>Results for testng</title>
<link href="../testng.css" rel="stylesheet" type="text/css" />
<link href="../my-testng.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3><p align="center">Results for<br/><em>testng</em></p></h3>
<table border='1' width='100%'>
<tr valign='top'>
<td>1 test</td>
<td><a target='mainFrame' href='classes.html'>1 class</a></td>
<td>1 method:<br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods.html'>chronological</a><br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods-alphabetical.html'>alphabetical</a><br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods-not-run.html'>not run (0)</a></td>
</tr>
<tr>
<td><a target='mainFrame' href='groups.html'>0 group</a></td>
<td><a target='mainFrame' href='reporter-output.html'>reporter output</a></td>
<td><a target='mainFrame' href='testng.xml.html'>testng.xml</a></td>
</tr></table>
<table width='100%' class='test-passed'>
<tr><td>
<table style='width: 100%'><tr><td valign='top'>test (1/0/0)</td><td valign='top' align='right'>
<a href='test.html' target='mainFrame'>Results</a>
</td></tr></table>
</td></tr><p/>
</table>
</body></html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Failed suite [testng]">
<listeners>
<listener class-name="com.tykj.selenium.extentsreport.ExtentTestNGIReporterListener"/>
</listeners>
<test name="test(failed)">
<classes>
<class name="com.tykj.selenium.conferenceRoomTest.ConferenceActive">
<methods>
<include name="url"/>
<include name="quit"/>
</methods>
</class> <!-- com.tykj.selenium.conferenceRoomTest.ConferenceActive -->
</classes>
</test> <!-- test(failed) -->
</suite> <!-- Failed suite [testng] -->
body {
margin: 0px 0px 5px 5px;
}
ul {
margin: 0px;
}
li {
list-style-type: none;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.navigator-selected {
background: #ffa500;
}
.wrapper {
position: absolute;
top: 60px;
bottom: 0;
left: 400px;
right: 0;
overflow: auto;
}
.navigator-root {
position: absolute;
top: 60px;
bottom: 0;
left: 0;
width: 400px;
overflow-y: auto;
}
.suite {
margin: 0px 10px 10px 0px;
background-color: #fff8dc;
}
.suite-name {
padding-left: 10px;
font-size: 25px;
font-family: Times;
}
.main-panel-header {
padding: 5px;
background-color: #9FB4D9; //afeeee;
font-family: monospace;
font-size: 18px;
}
.main-panel-content {
padding: 5px;
margin-bottom: 10px;
background-color: #DEE8FC; //d0ffff;
}
.rounded-window {
border-radius: 10px;
border-style: solid;
border-width: 1px;
}
.rounded-window-top {
border-top-right-radius: 10px 10px;
border-top-left-radius: 10px 10px;
border-style: solid;
border-width: 1px;
overflow: auto;
}
.light-rounded-window-top {
border-top-right-radius: 10px 10px;
border-top-left-radius: 10px 10px;
}
.rounded-window-bottom {
border-style: solid;
border-width: 0px 1px 1px 1px;
border-bottom-right-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
overflow: auto;
}
.method-name {
font-size: 12px;
font-family: monospace;
}
.method-content {
border-style: solid;
border-width: 0px 0px 1px 0px;
margin-bottom: 10;
padding-bottom: 5px;
width: 80%;
}
.parameters {
font-size: 14px;
font-family: monospace;
}
.stack-trace {
white-space: pre;
font-family: monospace;
font-size: 12px;
font-weight: bold;
margin-top: 0px;
margin-left: 20px;
}
.testng-xml {
font-family: monospace;
}
.method-list-content {
margin-left: 10px;
}
.navigator-suite-content {
margin-left: 10px;
font: 12px 'Lucida Grande';
}
.suite-section-title {
margin-top: 10px;
width: 80%;
border-style: solid;
border-width: 1px 0px 0px 0px;
font-family: Times;
font-size: 18px;
font-weight: bold;
}
.suite-section-content {
list-style-image: url(bullet_point.png);
}
.top-banner-root {
position: absolute;
top: 0;
height: 45px;
left: 0;
right: 0;
padding: 5px;
margin: 0px 0px 5px 0px;
background-color: #0066ff;
font-family: Times;
color: #fff;
text-align: center;
}
.top-banner-title-font {
font-size: 25px;
}
.test-name {
font-family: 'Lucida Grande';
font-size: 16px;
}
.suite-icon {
padding: 5px;
float: right;
height: 20;
}
.test-group {
font: 20px 'Lucida Grande';
margin: 5px 5px 10px 5px;
border-width: 0px 0px 1px 0px;
border-style: solid;
padding: 5px;
}
.test-group-name {
font-weight: bold;
}
.method-in-group {
font-size: 16px;
margin-left: 80px;
}
table.google-visualization-table-table {
width: 100%;
}
.reporter-method-name {
font-size: 14px;
font-family: monospace;
}
.reporter-method-output-div {
padding: 5px;
margin: 0px 0px 5px 20px;
font-size: 12px;
font-family: monospace;
border-width: 0px 0px 0px 1px;
border-style: solid;
}
.ignored-class-div {
font-size: 14px;
font-family: monospace;
}
.ignored-methods-div {
padding: 5px;
margin: 0px 0px 5px 20px;
font-size: 12px;
font-family: monospace;
border-width: 0px 0px 0px 1px;
border-style: solid;
}
.border-failed {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0px 0px 0px 10px;
border-color: #f00;
}
.border-skipped {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0px 0px 0px 10px;
border-color: #edc600;
}
.border-passed {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0px 0px 0px 10px;
border-color: #19f52d;
}
.times-div {
text-align: center;
padding: 5px;
}
.suite-total-time {
font: 16px 'Lucida Grande';
}
.configuration-suite {
margin-left: 20px;
}
.configuration-test {
margin-left: 40px;
}
.configuration-class {
margin-left: 60px;
}
.configuration-method {
margin-left: 80px;
}
.test-method {
margin-left: 100px;
}
.chronological-class {
background-color: #0ccff;
border-style: solid;
border-width: 0px 0px 1px 1px;
}
.method-start {
float: right;
}
.chronological-class-name {
padding: 0px 0px 0px 5px;
color: #008;
}
.after, .before, .test-method {
font-family: monospace;
font-size: 14px;
}
.navigator-suite-header {
font-size: 22px;
margin: 0px 10px 5px 0px;
background-color: #deb887;
text-align: center;
}
.collapse-all-icon {
padding: 5px;
float: right;
}
$(document).ready(function() {
$('a.navigator-link').click(function() {
// Extract the panel for this link
var panel = getPanelName($(this));
// Mark this link as currently selected
$('.navigator-link').parent().removeClass('navigator-selected');
$(this).parent().addClass('navigator-selected');
showPanel(panel);
});
installMethodHandlers('failed');
installMethodHandlers('skipped');
installMethodHandlers('passed', true); // hide passed methods by default
$('a.method').click(function() {
showMethod($(this));
return false;
});
// Hide all the panels and display the first one (do this last
// to make sure the click() will invoke the listeners)
$('.panel').hide();
$('.navigator-link').first().click();
// Collapse/expand the suites
$('a.collapse-all-link').click(function() {
var contents = $('.navigator-suite-content');
if (contents.css('display') == 'none') {
contents.show();
} else {
contents.hide();
}
});
});
// The handlers that take care of showing/hiding the methods
function installMethodHandlers(name, hide) {
function getContent(t) {
return $('.method-list-content.' + name + "." + t.attr('panel-name'));
}
function getHideLink(t, name) {
var s = 'a.hide-methods.' + name + "." + t.attr('panel-name');
return $(s);
}
function getShowLink(t, name) {
return $('a.show-methods.' + name + "." + t.attr('panel-name'));
}
function getMethodPanelClassSel(element, name) {
var panelName = getPanelName(element);
var sel = '.' + panelName + "-class-" + name;
return $(sel);
}
$('a.hide-methods.' + name).click(function() {
var w = getContent($(this));
w.hide();
getHideLink($(this), name).hide();
getShowLink($(this), name).show();
getMethodPanelClassSel($(this), name).hide();
});
$('a.show-methods.' + name).click(function() {
var w = getContent($(this));
w.show();
getHideLink($(this), name).show();
getShowLink($(this), name).hide();
showPanel(getPanelName($(this)));
getMethodPanelClassSel($(this), name).show();
});
if (hide) {
$('a.hide-methods.' + name).click();
} else {
$('a.show-methods.' + name).click();
}
}
function getHashForMethod(element) {
return element.attr('hash-for-method');
}
function getPanelName(element) {
return element.attr('panel-name');
}
function showPanel(panelName) {
$('.panel').hide();
var panel = $('.panel[panel-name="' + panelName + '"]');
panel.show();
}
function showMethod(element) {
var hashTag = getHashForMethod(element);
var panelName = getPanelName(element);
showPanel(panelName);
var current = document.location.href;
var base = current.substring(0, current.indexOf('#'))
document.location.href = base + '#' + hashTag;
var newPosition = $(document).scrollTop() - 65;
$(document).scrollTop(newPosition);
}
function drawTable() {
for (var i = 0; i < suiteTableInitFunctions.length; i++) {
window[suiteTableInitFunctions[i]]();
}
for (var k in window.suiteTableData) {
var v = window.suiteTableData[k];
var div = v.tableDiv;
var data = v.tableData
var table = new google.visualization.Table(document.getElementById(div));
table.draw(data, {
showRowNumber : false
});
}
}
<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" ignored="0" total="1" passed="1">
<reporter-output>
</reporter-output>
<suite name="testng" duration-ms="33263" started-at="2021-12-10T02:46:32Z" finished-at="2021-12-10T02:47:05Z">
<groups>
</groups>
<test name="test" duration-ms="33263" started-at="2021-12-10T02:46:32Z" finished-at="2021-12-10T02:47:05Z">
<class name="com.tykj.selenium.conferenceRoomTest.ConferenceActive">
<test-method status="PASS" signature="url()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]" name="url" duration-ms="32472" started-at="2021-12-10T10:46:32Z" finished-at="2021-12-10T10:47:04Z">
<reporter-output>
</reporter-output>
</test-method> <!-- url -->
<test-method status="PASS" signature="quit()[pri:0, instance:ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))]" name="quit" is-config="true" duration-ms="783" started-at="2021-12-10T10:47:04Z" finished-at="2021-12-10T10:47:05Z">
<reporter-output>
</reporter-output>
</test-method> <!-- quit -->
</class> <!-- com.tykj.selenium.conferenceRoomTest.ConferenceActive -->
</test> <!-- test -->
</suite> <!-- testng -->
</testng-results>
.invocation-failed, .test-failed { background-color: #DD0000; }
.invocation-percent, .test-percent { background-color: #006600; }
.invocation-passed, .test-passed { background-color: #00AA00; }
.invocation-skipped, .test-skipped { background-color: #CCCC00; }
.main-page {
font-size: x-large;
}
<html>
<head>
<title>TestNG: test</title>
<link href="../testng.css" rel="stylesheet" type="text/css" />
<link href="../my-testng.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.log { display: none;}
.stack-trace { display: none;}
</style>
<script type="text/javascript">
<!--
function flip(e) {
current = e.style.display;
if (current == 'block') {
e.style.display = 'none';
return 0;
}
else {
e.style.display = 'block';
return 1;
}
}
function toggleBox(szDivId, elem, msg1, msg2)
{
var res = -1; if (document.getElementById) {
res = flip(document.getElementById(szDivId));
}
else if (document.all) {
// this is the way old msie versions work
res = flip(document.all[szDivId]);
}
if(elem) {
if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
}
}
function toggleAllBoxes() {
if (document.getElementsByTagName) {
d = document.getElementsByTagName('div');
for (i = 0; i < d.length; i++) {
if (d[i].className == 'log') {
flip(d[i]);
}
}
}
}
// -->
</script>
</head>
<body>
<h2 align='center'>test</h2><table border='1' align="center">
<tr>
<td>Tests passed/Failed/Skipped:</td><td>1/0/0</td>
</tr><tr>
<td>Started on:</td><td>Fri Dec 10 10:46:32 CST 2021</td>
</tr>
<tr><td>Total time:</td><td>33 seconds (33263 ms)</td>
</tr><tr>
<td>Included groups:</td><td></td>
</tr><tr>
<td>Excluded groups:</td><td></td>
</tr>
</table><p/>
<small><i>(Hover the method name to see the test class name)</i></small><p/>
<table width='100%' border='1' class='invocation-passed'>
<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
<tr><td><b>Test method</b></td>
<td width="30%"><b>Exception</b></td>
<td width="10%"><b>Time (seconds)</b></td>
<td><b>Instance</b></td>
</tr>
<tr>
<td title='com.tykj.selenium.conferenceRoomTest.ConferenceActive.url()'><b>url</b><br>Test class: com.tykj.selenium.conferenceRoomTest.ConferenceActive</td>
<td></td>
<td>32</td>
<td>ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (null))</td></tr>
</table><p>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitXMLReporter -->
<testsuite hostname="DESKTOP-R9I5LK7" ignored="0" name="test" tests="1" failures="0" timestamp="10 十二月 2021 02:47:05 GMT" time="33.263" errors="0">
<testcase name="url on ConferenceActive(baseUrl=null, webDriver=FirefoxDriver: firefox on WINDOWS (9150e06b-d507-4fe3-b9ee-09c7ea8ca700))" time="32.472" classname="com.tykj.selenium.conferenceRoomTest.ConferenceActive"/>
</testsuite> <!-- test -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Failed suite [testng]">
<listeners>
<listener class-name="com.tykj.selenium.extentsreport.ExtentTestNGIReporterListener"/>
</listeners>
<test name="test(failed)">
<classes>
<class name="com.tykj.selenium.conferenceRoomTest.ConferenceActive">
<methods>
<include name="url"/>
<include name="quit"/>
</methods>
</class> <!-- com.tykj.selenium.conferenceRoomTest.ConferenceActive -->
</classes>
</test> <!-- test(failed) -->
</suite> <!-- Failed suite [testng] -->
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论