gpt4 book ai didi

python - 属性错误: 'module' object has no attribute 'runTest'

转载 作者:太空宇宙 更新时间:2023-11-03 21:36:12 28 4
gpt4 key购买 nike

我知道已经有人问过类似的问题,但我在这些问题的评论中找不到答案。请在这里帮助我。

我有以下页面对象:

class ChatInput(BaseTest):
def __init__(self, driver, *args, **kwargs):
super(ChatInput, self).__init__(*args, **kwargs)
self.driver = driver

def get_chat_Input(self):
return self.wait_for_element_by_xpath(elements.CHAT_INPUT, 60)

def add_content_in_chatInput(self, msg):
chatInput = self.get_chat_Input()
chatInput.clear()
chatInput.click()
chatInput.send_keys('')
chatInput.send_keys(msg)

return True

我正在将此页面对象的方法调用到我的测试类。

from .components.ChatInput import ChatInput

class SmokeTest(BaseTest):
def test_everything(self):
env = self.getEnvConfig()
for driver in env['DRIVERS']:
self.configDriver(driver)
self.driver.get(CONFIG.SITE_URL)

self.chatInput = ChatInput(self.driver)

assert self.chatInput.add_content_in_chatInput('Hello, this is agent QA. Please tell us, how we can help you today?')

但是当我运行测试时,出现以下错误:

 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/suite.py", line 122, in run
test(result)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 663, in __call__
return self.run(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 590, in run
testMethod = getattr(self, self._testMethodName)
AttributeError: 'ChatInput' object has no attribute 'runTest'

请让我知道我做错了什么?

最佳答案

您似乎正在尝试测试名为 runTest 的方法。或者更具体地说,在测试时,您需要运行 ChatInput.runTest,但它不存在。这就是错误消息所说的内容。

关于python - 属性错误: 'module' object has no attribute 'runTest' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53233298/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com