LeanFT 和 Java:在 Docker 容器中运行测试我的基于 Java 的 LeanFT 测试在我的本地机器上使用 IntelliJ、JUnit 和 LeanFT 运行良好:
Chrome 打开,我看到测试运行,一切正常。
现在我想在 Docker 容器中运行这些测试。
当我的测试只做一个简单的导航时,一切都很好:
@test
public void simpleTest2() throws GeneralLeanFtException {
browser.navigate("https://www.google.com");
}
Docker 启动,获取 LeanFt License 并运行测试:
dev@ubuntu:~$ docker run -p 5900:5900 -v /home/dev/development/tempprojects/LeanFT_1/target:/tests --env LFT_LIC_SERVER=S021000105693b.adr.admin.ch --env LFT_LIC_ID=10594 --env RUN_MODE=junit --env RUN_CMD=ch.admin.bit.LeanFtTest -t -i -w /tests functionaltesting/leanft-chrome
LeanFT runtime engine started successfully
License: Concurrent UFT Enterprise Concurrent User
Port: 5095
Version: 14.3.546, (c) Copyright 2015 EntIT Software LLC
Installation Folder: /opt/leanft
Executing junit test: ch.admin.bit.LeanFtTest
JUnit version 4.12
.
Time: 5.778
OK (1 test)
LeanFT runtime engine has stopped successfully
问题:
当我将 WebElement 添加到我的测试中时,它不起作用(在 IntelliJ 中它与 LeanFT-Runner 一起使用)
像这样的东西:
Menu dEFRITENMenu = browser.describe(Menu.class, new MenuDescription.Builder()
.accessibilityName("")
.id("")
.role("menu")
.tagName("UL")
.index(1).build());
dEFRITENMenu.select("EN");
错误是:
1) simpleTest(ch.admin.bit.LeanFtTest)
com.hp.lft.sdk.ReplayObjectNotFoundException: Cannot identify the object "Web Menu".
Verify that this object's properties match an object currently displayed in your application.
at com.hp.lft.sdk.internal.ReplayExceptionFactory$1.create(ReplayExceptionFactory.java:34)
at com.hp.lft.sdk.internal.ReplayExceptionFactory.createOrDefault(ReplayExceptionFactory.java:197)
at com.hp.lft.sdk.internal.ReplayExceptionFactory.createOrDefault(ReplayExceptionFactory.java:21)
at com.hp.lft.sdk.internal.TestObjectExecuterBehaviorBase$ReplayErrorHandler.onError(TestObjectExecuterBehaviorBase.java:65)
at com.hp.lft.sdk.internal.CommunicationClientImpl.handleError(CommunicationClientImpl.java:221)
at com.hp.lft.sdk.internal.CommunicationClientImpl.send(CommunicationClientImpl.java:96)
at com.hp.lft.sdk.internal.TestObjectExecuterBehavior.executeMethod(TestObjectExecuter.java:33)
at com.hp.lft.sdk.internal.TestObjectBase.executeMethod(TestObjectBase.java:119)
at com.hp.lft.sdk.internal.web.WebMenu.access$100(WebMenu.java:14)
at com.hp.lft.sdk.internal.web.WebMenu$2.invoke(WebMenu.java:52)
at com.hp.lft.sdk.internal.TestObjectOperationWrapper.executeWithEvents(TestObjectOperationWrapper.java:81)
at com.hp.lft.sdk.internal.TestObjectOperationWrapper.executeWithEvents(TestObjectOperationWrapper.java:102)
at com.hp.lft.sdk.internal.web.WebMenu.select(WebMenu.java:56)
at ch.admin.bit.LeanFtTest.simpleTest(LeanFtTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:77)
at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
有没有人有想法或正在运行的例子?