Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you Change Run mode mid script?
#1
Solved: 11 Years, 4 Months ago
I have been trying to figure out how to change the delay between steps mid run. I currently have a script that has two parts, the first part can be run in "Fast" mode, needing little to no delay between steps. The second part of the test needs to be run much slower, with a second between each step. Is there a function that will change the RunMode part way through the script?

If this is not possible, the other possibility is carrying over an array of strings over from one action to another, but I haven't had much luck getting that to happen either. Any Ideas? Thank.
Reply
#2
Solved: 11 Years, 4 Months ago
Hi Caleytown,
After executed first part call this function in VBS file,Can change the Runmode like you want execute the Normal or fast mode.

Code:
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
Set RunMod = App.Options.Run.RunMode=Normal
Set RunMod = Nothing
Set App=NOTHING

Thanks
----------------------------------------------
Reply
#3
Solved: 11 Years, 4 Months ago
Well, that kinda worked. It changed the RunMode to normal after the action was fully executed, but I need it to change the RunMode half way through the action. Is there a way to do that? Thanks
Reply
#4
Solved: 11 Years, 4 Months ago
Nope, The only way to do it is to split your actions.

Reason being these settings are only read when a newscope is created and that only happens when you run a action. In case you want to use the same Action only then you can try adding 2 iterations where in iteration 1 only fast code runs and in iteration 2 the slow code runs.
Reply
#5
Solved: 11 Years, 4 Months ago
The problem is the first part of the test pulls data from a spread sheet and stores in an array( This happens in a big FOR loop and takes forever with a 1 sec delay). Then the second part of the test uses the array. How do I carry over that array from one action too another if I split the action?
Reply
#6
Solved: 11 Years, 4 Months ago
You can declare that variable in a Library file and then associated that library file with the test.

Code:
'In lib
Dim arrTest

'In Action1
ReDim arrTest(20)
arrTest(0) = "Test"


'In Action2
Msgbox arrTest(0)
Reply
#7
Solved: 11 Years, 4 Months ago
I realize this thread is old but this may be useful to someone in the future.    Here is a walkthrough someone did and is how I solved this issue....

https    ://subscription.packtpub.com/book/application_development/9781849688406/1/ch01lvl1sec20/using-a-global-dictionary-for-fast-shared-data-access

Essential I moved my long looping process to a .vbs file & associated in the test within the functional library.  For me, the .vbs file builds a dictionary that is used later in the script.  Previously this would take 1min+ to build the dictionary during the test in Normal Run mode.  Now the dictionary is initialized & built at the beginning of the test in a split second.

Note:  I moved the Dictionary.add function from the UFT Action into the InitializeDictionary function 

Code:
'-=== myGlobals.vbs ===-
dim GlobalDictionary

Function iniGlobalDictionary()
    Set GlobalDictionary = CreateObject("Scripting.Dictionary")
    GlobalDictionary.add "myKey1", "myValue1"
    GlobalDictionary.add "myKey2", "myValue2"
    ...
End Function

'-=== UFT Action 1 ===-
'pull value from dictionary
x = GlobalDictionary("myKey1")

print (x)
'yeilds "myValue1"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send/pass UFT Run Error Dialog as output value to main driver script lravi4u 0 583 11-05-2023, 03:55 PM
Last Post: lravi4u
  [UFT] Change property of object (WpfButton) robertosalemi 2 2,610 11-22-2016, 12:43 PM
Last Post: Ankur
  Dynamic change of name for Webtables prakashreddy 1 2,375 10-25-2014, 09:53 PM
Last Post: supputuri
  How can I change my test folders, globally? atester 0 2,017 10-03-2014, 04:37 PM
Last Post: atester
  How to run driver script to kick off scripts stored in QC? shipu 0 3,588 04-30-2014, 02:39 AM
Last Post: shipu

Forum Jump:


Users browsing this thread: 1 Guest(s)