robotframework 使用 FAIL : Keyword 'public.token_userlogin' expected 2 arguments, got 0.

在使用Robotframework进行自动化测试时遇到了'public.token_userlogin'关键字期望2个参数但未提供的错误。本文详细记录了解决此问题的过程,包括检查变量名、尝试重启Robotframework以及确认Suite Setup中变量的正确使用方式。最终发现,尽管错误的用法在普通关键字调用中可行,但在Suite变量设置中却会引发问题,需按照正确的格式传递参数。
摘要由CSDN通过智能技术生成

robotframework 使用 FAIL : Keyword ‘public.token_userlogin’ expected 2 arguments, got 0.

在使用robot过程中遇到的问题记录下来,以便以后自己查阅,在使用全局变量Suite Variable时出现的报错。
在这里插入图片描述
可以看出我是需要传递两个参数的${phone} | ${pwd}
在Suite 设置
在这里插入图片描述
测试用例:
在这里插入图片描述
执行结果
在这里插入图片描述
错误的意思就是调用的需要两个参数,但是你一个都没有给,但是我给了呀。解决思路,
1怀疑是不是变量名字写错了,检查了没有问题
2怀疑 robot是不是抽风,重启试了,没有解决
3怀疑自己的用法不对,路子对头查看了在suite 中suite setup使用

解释一下这段代码 def add_seq_to_prefix_tree(self, root_node, cluster: LogCluster): token_count = len(cluster.log_template_tokens) token_count_str = str(token_count) if token_count_str not in root_node.key_to_child_node: first_layer_node = Node() root_node.key_to_child_node[token_count_str] = first_layer_node else: first_layer_node = root_node.key_to_child_node[token_count_str] cur_node = first_layer_node if token_count == 0: cur_node.cluster_ids = [cluster.cluster_id] return current_depth = 1 for token in cluster.log_template_tokens: if current_depth >= self.max_node_depth or current_depth >= token_count: new_cluster_ids = [] for cluster_id in cur_node.cluster_ids: if cluster_id in self.id_to_cluster: new_cluster_ids.append(cluster_id) new_cluster_ids.append(cluster.cluster_id) cur_node.cluster_ids = new_cluster_ids break if token not in cur_node.key_to_child_node: if self.parametrize_numeric_tokens and self.has_numbers(token): if self.param_str not in cur_node.key_to_child_node: new_node = Node() cur_node.key_to_child_node[self.param_str] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: if self.param_str in cur_node.key_to_child_node: if len(cur_node.key_to_child_node) < self.max_children: new_node = Node() cur_node.key_to_child_node[token] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: if len(cur_node.key_to_child_node) + 1 < self.max_children: new_node = Node() cur_node.key_to_child_node[token] = new_node cur_node = new_node elif len(cur_node.key_to_child_node) + 1 == self.max_children: new_node = Node() cur_node.key_to_child_node[self.param_str] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: cur_node = cur_node.key_to_child_node[token] current_depth += 1
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值