unit-testing - 在 Selenium 中定义自定义操作

标签 unit-testing selenium

我有一个 Selenium 测试用例,它将日期输入到由三个下拉列表(年、月和日)组成的日期选择器中。

select validity_Y label=2008
select validity_M label=08
select validity_D label=08

这部分在整个测试用例中重复了很多次。我想通过定义我的自定义操作“selectValidity”来减少它,这样我就可以减少冗余,比如

selectValidity 2008,08,08

向测试用例添加宏或子例程的最佳(最简单、最干净)方法是什么?

最佳答案

我认为您在 Selenese 中编写测试代码.如果是这样,您是否考虑过使用多种语言中的任何一种的客户端驱动程序?他们有 java , .net , perl , ruby , javascript , php , 和 python .他们每个人都有子程序。据推测,IDE可以将您现有的 Selenese 测试转化为其中的大部分测试。

关于unit-testing - 在 Selenium 中定义自定义操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/160557/

相关文章:

selenium - 在 docker 环境中使用 selenium 进行 Behat 测试

Ruby Selenium - find_elements if nil => Net::ReadTimeout

visual-studio-2010 - 如何在 Visual Studio 2010 中禁用对用户未处理的异常的中断?

c++ - 在 Google Test 中打印 exception.what()

c# - 内部异常的单元测试

unit-testing - with-redefs 在 Windows 上的特定项目中不起作用

java - 自定义等待 try catch webdriver

java - JUnit:忽略方法调用

java - 如何处理 Selenium 中重复使用的元素(重复)

python - selenium.common.exceptions.StaleElementReferenceException : Message: stale element reference: element is not attached to the page document