测试之间的TestNG执行暂停

时间:2018-01-30 21:34:11

标签: selenium testng-eclipse

我正在重构一大堆selenium测试并尝试在testNG中执行它们。问题是每次测试后测试执行停止(最终得到timedout),而不管结果如何。当我做浏览器刷新测试继续。我不确定是什么问题。

我的测试就像这样

@Test(groups = {" Portal - Page Login Tests"})
public void testPageLoginWithInvalidPwd() throws Exception{
    Assert.assertEquals( Login(GetWebDriver(...);
}

@Test(groups = {" Portal - Page Login Tests"})
public void testPageLoginWithValidPws() throws Exception{
    Assert.assertEquals( Login(...);
}

这是我的xml文件

<suite name="test-single">
    <parameter name="Url" value="https:test.com" />
    <parameter name="Browser" value="firefox" />
    <test verbose="1" name="test">
        <classes>
            <class name="test.PageloginPage">
                <methods>
                    <include name="testPageLoginWithInvalidPwd"></include>
                    <include name="testPageLoginWithValidPws"></include>
                    </methods>
                </class>
        </classes>

提前致谢。

堆栈跟踪: FAILED:testPageLoginWithValidPws org.openqa.selenium.TimeoutException:timeout   (会话信息:chrome = 64.0.3282.119)   (驱动程序信息:chromedriver = 2.35.528161(5b82f2d2aae0ca24b877009200ced9065a772e73),platform = Windows NT 6.1.7601 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:0毫秒 建立信息:版本:&#39; 3.8.1&#39;,修订版:&#39; 6e95a6684b&#39;,时间:&#39; 2017-12-01T19:05:32.194Z&#39; 系统信息:主机:&#39; 100206-PHY&#39;,ip:&#39; 10.1.208.242&#39;,os.name:&#39; Windows 7&#39;,os.arch:&# 39; amd64&#39;,os.version:&#39; 6.1&#39;,java.version:&#39; 9.0.4&#39; 驱动程序信息:org.openqa.selenium.chrome.ChromeDriver 功能{acceptInsecureCerts:false,acceptSslCerts:false,applicationCacheEnabled:false,browserConnectionEnabled:false,browserName:chrome,chrome:{chromedriverVersion:2.35.528161(5b82f2d2aae0ca ...,userDataDir:C:\ Users \ KKULAN~1 \ AppData \ L ...},cssSelectorsEnabled:true,databaseEnabled:false,handlesAlerts:true,hasTouchScreen:false,javascriptEnabled:true,locationContextEnabled:true,mobileEmulationEnabled:false,nativeEvents:true,networkConnectionEnabled:false,pageLoadStrategy:normal,platform:XP,platformName :XP,rotate:false,setWindowRect:true,takesHeapSnapshot:true,takesScreenshot:true,unexpectedAlertBehaviour :, unhandledPromptBehavior :, version:64.0.3282.119,webStorageEnabled:true} 会话ID:0bb70fb5edb140fd90d7351ece634135     at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at java.base / jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     在java.base / java.lang.reflect.Constructor.newInstance(Constructor.java:488)     在org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)     在org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)     在org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)     在org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)     在org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)     在org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)     在org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)     在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)     在org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)     在k3g.edwebpageclasses.ELogin.loginToPortal(ELogin.java:269)     在k3g.webpagefunctionality.Power.Login(Power.java:197)     在k3g.ed.LoginPage.testPageLoginWithValidPws(LoginPage.java:152)     at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.base / java.lang.reflect.Method.invoke(Method.java:564)     at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)     at org.testng.internal.Invoker.invokeMethod(Invoker.java:571)     在org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)     at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)     at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)     在org.testng.TestRunner.privateRun(TestRunner.java:648)     在org.testng.TestRunner.run(TestRunner.java:505)     在org.testng.SuiteRunner.runTest(SuiteRunner.java:455)     在org.testng.SuiteRunner.run顺序(SuiteRunner.java:450)     在org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)     在org.testng.SuiteRunner.run(SuiteRunner.java:364)     在org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)     在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)     at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)     在org.testng.TestNG.runSuitesLocally(TestNG.java:1116)     在org.testng.TestNG.runSuites(TestNG.java:1028)     在org.testng.TestNG.run(TestNG.java:996)     at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)     在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)     在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

1 个答案:

答案 0 :(得分:0)

我将浏览器和驱动程序版本降级为62和2.34并且没有看到问题