Forum Discussion
Just out of curiousity, how are you determining whether or not the value is stored in the variable? Are you referencing the variable somewhere else and it's coming up blank?
Also... did you try debugging and making sure that the property you're referencing in the "Set Variable" statement actually contains the desired value?
Value does not get stored
- tristaanogre6 years agoEsteemed Contributor
Try this... put a breakpoint on the Set Variable value.... run the test to the breakpoint... then step over... while still in debug, do a "watch" to look at the value of the variable... did it get set?
This is all debugging, all working with the code, all trying to see what the behavior is and determining, once you have observed the behavior, what is necessary to correct it. GENERALLY speaking, the code is correct... you click the button, you assign the value, then you try to consume it. So, we need to figure out WHY the set variable value is not actually getting a value.So...
1) Are you getting errors?2) What is the ACTUAL observed behavior when the test runs?
You're asking me to diagnose static code via screenshots when the problem is most likely an issue during runtime. I can only suggest. You'll need to do the work. Perhaps the delay you put in wasn't long enough. Again... you need to OBSERVE the behavior... you click the "Yes" button... is there a time period between clicking the button and when the work order number field is populated (a question I asked and you didn't answer)? THAT, right there, could be the ENTIRE problem... but we don't know that yet. Take the time, do the work, diagnose what's going on.
- tristaanogre6 years agoEsteemed Contributor
Put a break point in your test script JUST after the Set Variable command. (https://support.smartbear.com/testcomplete/docs/testing-with/debugging/breakpoints/using.html)
Then, run the test.
When the test stops, evaluate the contents of the project variable. (https://support.smartbear.com/testcomplete/docs/testing-with/debugging/general-info/evaluating-expressions.html)
That's the first step... making sure the value is getting set. And, to be honest, I'm confused... because I asked you a while back how you knew that the value wasn't being set and you said because it wasn't getting populated in the next step... so... not ENTIRELY sure what is going on. If you don't even know if the value is getting set, how do you know there's a problem?
As for using it... when you want to use the contents of the variable, when you select an operation, when indicating the parameters, you can set the mode to "Variable" and then select the variable. That will then input the value of the variable into whatever operation you've selected. (https://support.smartbear.com/testcomplete/docs/testing-with/debugging/general-info/evaluating-expressions.html)
- tristaanogre6 years agoEsteemed Contributor
Yes, we've established that... you're trying to capture the value of a particular property of an object and it's not getting stored. What I would like to do is debug that... using Object Spy in TestComplete, can you view the object and it's properties and make sure that, yes, in fact, the property contains the desired value? Not the variable, but the ACTUAL object property in your application under test.
- saranoor6 years agoFrequent Contributor
Attaching the screenshots.
In Capture 7 screenshot I do not know what to use? What Method or property to use?
- tristaanogre6 years agoEsteemed Contributor
That's not object spy....
https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-spy/about.htmlUse this tool to examine the object in question... this will display all the properties.... and one of those properties should contain the value you're looking for.
- saranoor6 years agoFrequent Contributor
Screenshot displays the Object Spy that was freezing all the time
I managed to map it to Work order which is 130314 in this instance.
- tristaanogre6 years agoEsteemed Contributor
OK... can you confirm, then, that the Set Variable statement is pointing to the contentText property of that object? That is the property that seems to contain the desired value. Your previous screenshots aren't clear on whether or not you're using that property.
- saranoor6 years agoFrequent Contributor
This is what I see inthe global variable.
Is there a video that I can see for this kind of situation?
- tristaanogre6 years agoEsteemed Contributor
Everything appears to be in order here. My suspicion is that the problem is not in the Set Variable or in the specific object, but in a timing.
When you manually execute the test, step by step, when you click the "Yes" button, is there a delay or a page reload or something that occurs before that work order number appears? My guess is that this is the problem... that the variable is getting assigned a value before the label has the proper order number present. This is what you need to debug... figure out if there's some sort of delay that needs to be coded in to wait for that number.
- saranoor6 years agoFrequent Contributor
I alreday added aDelay in the script before the YES and after the YES button is clicked
Related Content
- 2 years agovericomms
Recent Discussions
- 8 hours agojstaehlin
- 2 days agoAivanitskiy