返回「资料来源、摘录与归档」

【ChatGPT】游戏自动化测试实践案例 - 敏感词过滤

【ChatGPT】游戏自动化测试实践案例 敏感词过滤

更多
Markdown 结构化数据
本文目录 5 个章节

【ChatGPT】游戏自动化测试实践案例 - 敏感词过滤

note · ChatGPT 问答录 本文保存一次 ChatGPT 问答原始输出,仅作为资料来源;其中结论未自动视为已验证知识,使用前应结合可靠来源复核。

创建时间:2023/6/11 19:08

一个简单的示例:

python

from airtest.core.api import connect_device, time

from poco.drivers.unity3d import UnityPoco

连接到目标设备device = connect_device("Android:///")

初始化 Pocopoco = UnityPoco(device)

def test_sensitive_word_filtering(): for word in sensitive_words:

点击输入框并输入敏感词 input_box = poco("input_box")

input_box.click()

text("word")

time.sleep(1)

点击发送按钮 send_button = poco("send_button")

send_button.click()

time.sleep(1)

检查敏感词是否被过滤 message = poco("message")

assert message.get_text() == "***", f"敏感词 {word} 未被过滤!"

test_sensitive_word_filtering()

在上述示例中,我们首先连接到目标设备并初始化 Poco。然后,我们遍历敏感词列表,逐个输入敏感词并点击发送按钮。最后,我们检查应用程序是否成功地过滤了这些敏感词(将其替换为 "***")。