在Coded UI中对日期选择器进行硬编码 [英] Hard coding a date picker in Coded UI

查看:74
本文介绍了在Coded UI中对日期选择器进行硬编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个日期选择器工作正常,但第三个接受所选数据,然后擦除它或更改记录测试中的原始手动输入。

I have two date pickers that work fine but the third either accepts the selected data and then wipes it or changes the original manual input from the recorded test.

我想要选择日期>二十年前。

I want to selct a date > then twenty years ago.

我已经尝试将参数硬编码到  .cs但这也会在测试运行时发生变化。例如

I have tried hard coding the parameter into the  .cs but this also changes when the test is run. eg

customerDetails.DOBParams .UICtl00PlaceHolderMainEdit4Text =

customerDetails.DOBParams.UICtl00PlaceHolderMainEdit4Text =

" 12121972" ;

"12121972";

我也尝试过使用CSV
中的数据科幻乐。失败。

I have also tried using data from a CSV file. Fail.

< span style ="font-family:Consolas; font-size:x-small"> 是否有一些代码可以为此字段生成
a日期(例如,新的DateTime(DateTime.Now.Year - 40,12,12)以及在哪个级别编写代码的UI应该编写代码吗?

Is there a bit of code that can generate a date for this field (e.g.  new DateTime(DateTime.Now.Year - 40, 12, 12) and at which level of the Coded UI should the code be written?

推荐答案

您是否可以手动执行这些步骤?即第三个日期日历中的步骤仅在运行时失败编码的UI测试。

Are you able to perform these steps manually? i.e the steps on the third date calendar only fails when running in a Coded UI Test.

在第三个日期日历中是否有一些验证?

Is there some validation in the third datecalendar?

你能比较第三个日期日历的代码和第一个日期日历的代码吗? & second并验证是否有任何差异?

Can you compare the code for third date calendar with those on the first & second and verify if there are any differences?

 

请附上堆栈跟踪失败与失败跟踪日志。

Please attach stack trace of the failure & trace logs.


这篇关于在Coded UI中对日期选择器进行硬编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆