Forum Discussion

ralyn_sg's avatar
ralyn_sg
Contributor
10 years ago
Solved

date function entering no value during playback

Hi I am using the following function in my keyword test.



KeywordTests.AddUser_Positive.Variables.OasUserId=aqConvert.DateTimeToFormatStr(aqDateTime.Now())



During Playback this enters no value in the corressponding field.Any idea why this issue occurs?
  • So, most probably, the KeywordTests.AddUser_Positive.Variables.OasUserId=aqConvert.DateTimeToFormatStr(aqDateTime.Now()) expression works but something like this:

    <parentObject>.OasUserId.SetText(KeywordTests.AddUser_Positive.Variables.OasUserId)

    does not, right?



    The reason may be because of the behaviour of the given control (read SetText help topic for more details). You may try .Keys() method instead of the .SetText() one:

    <parentObject>.OasUserId.Keys(KeywordTests.AddUser_Positive.Variables.OasUserId)

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ralyn,



    > KeywordTests.AddUser_Positive.Variables.OasUserId=aqConvert.DateTimeToFormatStr(aqDateTime.Now())



    May I wonder why you are expecting that assigning a value to the OasUserId test variable must assign a value to some field?
  • What Ive done is I have used set text property and in the value column I've used Code Expression using a variable.Thats why I used the variable.Isnt this how it is done?
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    So, most probably, the KeywordTests.AddUser_Positive.Variables.OasUserId=aqConvert.DateTimeToFormatStr(aqDateTime.Now()) expression works but something like this:

    <parentObject>.OasUserId.SetText(KeywordTests.AddUser_Positive.Variables.OasUserId)

    does not, right?



    The reason may be because of the behaviour of the given control (read SetText help topic for more details). You may try .Keys() method instead of the .SetText() one:

    <parentObject>.OasUserId.Keys(KeywordTests.AddUser_Positive.Variables.OasUserId)

  • I think you're missing the Format Specifier:



    KeywordTests.AddUser_Positive.Variables.OasUserId=aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m/%d/%Y %H:%M")