python鼻子测试:指定测试应该在Selenium网格中运行的节点
我正在尝试更新我的Selenium Grid Hub功能测试,以便通过nose tests框架运行 目前,在没有nosetests的情况下,如果我想启动一个进程并让它在特定节点上运行,我会在SelRunner.py文件中添加这种类型的代码python鼻子测试:指定测试应该在Selenium网格中运行的节点,python,selenium,webdriver,nose,Python,Selenium,Webdriver,Nose,我正在尝试更新我的Selenium Grid Hub功能测试,以便通过nose tests框架运行 目前,在没有nosetests的情况下,如果我想启动一个进程并让它在特定节点上运行,我会在SelRunner.py文件中添加这种类型的代码 p1 = subprocess.Popen('python Tst_Ayusa_Nmo.py 5564 WINDOWS chrome') 然后将5564 WINDOWS chrome的系统参数传递到我的测试文件中,它将知道应该执行哪个网格节点 #execut
p1 = subprocess.Popen('python Tst_Ayusa_Nmo.py 5564 WINDOWS chrome')
然后将5564 WINDOWS chrome的系统参数传递到我的测试文件中,它将知道应该执行哪个网格节点
#execute test on this node: 5564 WINDOWS chrome
def setUp(self):
if len(sys.argv) > 1:
args = sys.argv
port = args[1]
platform = args[2]
browser = args[3]
现在我已经看了这里关于鼻子的各种帖子,但我不太确定如何才能完成下面同样的事情:
if __name__ == '__main__':
argv = ['--with-xunit', 'Tst_Ayusa_Nmo.py 5564']
nose.main(argv=argv)
======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'py 5564')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\loader.py", line 402, in loadTestsFromName
module = resolve_name(addr.module)
File "C:\Python27\lib\site-packages\nose\util.py", line 321, in resolve_name
obj = getattr(obj, part)
AttributeError: 'module' object has no attribute 'py 5564'
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
一如既往地谢谢你!
另外,除了命令行之外,我还可以使用其他方法传递节点配置。
我使用TestConfig插件。因此,我启动了如下鼻测试:
nose.run(argv=['nosetests','-v','-s','--with-xunit','--tc-file','./configFile'],
plugins=[TestConfig(),Capture(),Xunit()])
我做了内部测试
from testconfig import config
import sys
class testModule_1:
def test_M1_1(self):
print 'Module 1 Test 1 Config: ' + config['rc_configuration']['command']
以及我的配置文件的示例:
[TEST_CONFIG]
xunitFile = firefoxTests.xml
[rc_configuration]
command = GoogleChrome
“太好了,这很有效。更详细地说,您的配置文件是放置端口号等的地方。例如:[TEST_config]xunitFile=android\u android\u 5554.xml[rc\u configuration]browser=android platform=android node=8080主机端口=8080