expect(locator).to_have_values()
时间: 2024-09-10 16:16:15 浏览: 9
`expect(locator).to_have_values()` 这是一个常见于测试框架(如Selenium WebDriver with Cucumber or JUnit等)中的断言语句。它通常用于Web应用程序的自动化测试,其中`locator`代表一个定位元素的选择器,比如CSS选择器或XPath表达式。
这个方法的作用是在预期的情况下检查指定的页面元素(通过`locator`找到)应该包含一组特定的值。如果元素的实际值与期望的值匹配,那么该断言就认为测试通过;如果不匹配,则测试失败,并会记录错误信息,说明实际值和期望值之间的差异。
举个例子,在Cucumber BDD风格的测试用例中,这可能会用来验证用户表单提交后的数据是否正确:
```java
Given("I fill in the form", I.fillInTheField("#username", "john"));
When("I submit the form", I.clickOnButton("#submit"));
Then("The username should be saved", expect(locator("#savedUsername")).to_have_values("john"));
```
相关问题
帮忙翻译sql injection violation, dbType mysql, , druid-version 1.2.9, syntax error: syntax error, error in :'in order by tl.top_id desc ,tc.create_t', expect ), actual BY, pos 847, line 51, column 12, token BY : select count(0) from (select tld.dispatch_list_num, tl.top_id, bl.id as bom_id, bl.bom_version, tc.id, tc.task_list_details_id, tc.task_name, tc.pn_code, tc.product_type, tc.details, tc.check_type, tc.check_num, tc.stock_num, tc.check_user_id, tc.check_user_name, tc.producer_id, tc.producer_name, tc.company_id, tc.`delete`, tc.create_time, tc.update_time, tc.product_name, tc.total_num from task_check tc left join task_list_details tld on tld.id=tc.task_list_details_id left join bom_list bl on bl.id=tld.bom_id left join task_list tl on tl.id=tld.task_list_id where tc.`delete` = 0 and tld.company_id = ? and tld.top_id in order by tl.top_id desc ,tc.create_time desc) tmp_count;
SQL注入违规,数据库类型为MySQL,Druid版本为1.2.9,语法错误:语法错误,错误在于:'in order by tl.top_id desc, tc.create_t',期望为“)”,实际为“BY”,位置在第847个字符,第51行,第12列,关键字为BY。查询语句如下:
select count(0) from (select tld.dispatch_list_num, tl.top_id, bl.id as bom_id, bl.bom_version, tc.id, tc.task_list_details_id, tc.task_name, tc.pn_code, tc.product_type, tc.details, tc.check_type, tc.check_num, tc.stock_num, tc.check_user_id, tc.check_user_name, tc.producer_id, tc.producer_name, tc.company_id, tc.`delete`, tc.create_time, tc.update_time, tc.product_name, tc.total_num from task_check tc left join task_list_details tld on tld.id=tc.task_list_details_id left join bom_list bl on bl.id=tld.bom_id left join task_list tl on tl.id=tld.task_list_id where tc.`delete` = 0 and tld.company_id = ? and tld.top_id in order by tl.top_id desc, tc.create_time desc) tmp_count;
self.pub_path = rospy.Publisher("/topic_msgs_path", Path, queue_size=10) self.msg_path = Path() self.pub_expect_path = rospy.Publisher("/topic_expect_path", Path, queue_size=10) self.twist_msg = Twist() self.pub_orient = rospy.Publisher("/topic_orient", Odometry, queue_size=1) self.pub_cmd_vel = rospy.Publisher("cmd_vel",Twist,queue_size=1) self.static_transformStamped = geometry_msgs.msg.TransformStamped() self.setup_transform() # msgDetect(pub,msg,e,n,psi,psi_d,tau_d,force_d,vel_u,vel_u_d,T_l,T_r) self.t_range = P.t_range self.n_points = P.n_points # self.generate_path()
这段代码是一个类的初始化函数,在ROS中使用rospy库创建了多个发布者对象。这些发布者对象用于将不同类型的消息发布到相应的话题上。
首先,创建了一个名为"/topic_msgs_path"的话题发布者,消息类型为Path,队列大小为10,并将其赋值给self.pub_path。
接下来,创建了一个Path类型的消息对象self.msg_path。
然后,创建了另一个名为"/topic_expect_path"的话题发布者,消息类型为Path,队列大小为10,并将其赋值给self.pub_expect_path。
接着,创建了一个Twist类型的消息对象self.twist_msg。
然后,创建了一个名为"/topic_orient"的话题发布者,消息类型为Odometry,队列大小为1,并将其赋值给self.pub_orient。
最后,创建了一个名为"cmd_vel"的话题发布者,消息类型为Twist,队列大小为1,并将其赋值给self.pub_cmd_vel。
在类的其他代码中,还包括了一些其他功能,如设置静态变换、生成路径等。