Concat Now Time in YYYYMMDDHH with LastName keyword test field as one string value
I have this piece of code
# Obtain the current time
TimeValue=aqDateTime.Time() # Obtain the current date and time
NowValue=aqDateTime.Now() # Convert the returned date/time values to string values
StringTimeValue = aqConvert.DateTimeToStr(TimeValue)
StringNowValue = aqConvert.DateTimeToStr(NowValue) # Post the converted values to the log
Log.Message(“The time obtained from the Time routine is ” + StringTimeValue)
Log.Message(“The time obtained from the Now routine is ” + StringNowValue) # Convert the floating-point values to string values
VariantTimeValue = aqConvert.FloatToStr(TimeValue)
VariantNowValue = aqConvert.FloatToStr(NowValue) # Post the converted values to the log
Log.Message(“The variant representation of TimeValue is “+ VariantTimeValue)
Log.Message(“The variant representation of NowValue is “+ VariantNowValue)
I want to concat the The time obtained from the Now routine as YYYYMMDD and 24 hr format which the above does not look like. I dont need the PM. The name of the field to concat the time and date now function to is Aliases.browser.pageApplyNow6.formWouldYouLikeToIncludeA.textboxLastName
How can I achieve that in a unit script and when test executes the unit script fills out the LastName field with the entire string? I want to store that result also in a temporary variable that will be called again later in the test and reset when the start of the test begins the next time.
I figured out the problem. The problem was Set Variable Value was a part of my keyword test steps. That did not need to be there because I created the project level variable and called it inside my Unit3 script in code. Before I did not have it spelled out correctly in code so it was not identified correctly either. Also, I made sure to place the Unit3 script routine right after the first name text box. Now when the keyword script test runs the last name is concatenating with the DateTime(Now) formatted the way SmartBear docs say to do it. Thank you both for your time and consideration.