Novari-QA's avatar
Novari-QA
Frequent Contributor
7 years ago
Status:
New Idea

Have a value equal a function call, not last Last Operation Result

I have a script routine that has 3 parameters. There are methods around my issue however these methods require multiple lines and causes confusion if it gets to hectic.

I have a generic script routine that inputs a date into a text box. I want this date not to be static rather I want the date to be based on todays date.

pTreatDate = 2 days before today

pReferralDate = 1 day before today

pConsultDate = Today

 

As you can see this code requires the variable to be dynamic. I have function calls that get this information. I want to be able to call those function calls and assign their result to these parametes

pTreatDate = DateUtilities.AddDays(DateUtiltities.Today(), -2)
pReferralDate = DateUtilities.AddDays(DateUtiltities.Today(), -1)

pConsultDate = DateUtiltities.Today()

Instead of just one line and one generic function in my keyword test, i now have to have 6 lines 3 script routines with 3 "last operation result" types

Perhaps this can be done another way?

1 Comment

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Sure there is...  it's called "Code Expression"... an parameter of any call in a keyword test can be executed as a "Code Expression" which could include a function call that returns a value. When you select your script routine in your keyword test, when you get to the parameters screen, select "Code Expression" for the desired parameters and put in your DateUtilities calls there.