cancel
Showing results for 
Search instead for 
Did you mean: 

How to store a value that is generated in a transaction in test complete

Frequent Contributor

Re: How to store a value that is generated in a transaction in test complete

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.

Community Hero

Re: How to store a value that is generated in a transaction in test complete

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Frequent Contributor

Re: How to store a value that is generated in a transaction in test complete

This is what I see inthe global variable.

Is there a video that I can see for this kind of situation?

Community Hero

Re: How to store a value that is generated in a transaction in test complete

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Frequent Contributor

Re: How to store a value that is generated in a transaction in test complete

I alreday added aDelay in the script before the YES and after the YES button is clicked

 

Community Hero

Re: How to store a value that is generated in a transaction in test complete

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.  


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Frequent Contributor

Re: How to store a value that is generated in a transaction in test complete

How do I check if the stored value is being stored in the first step?

So how do I call the stored value in my next step?

Community Hero

Re: How to store a value that is generated in a transaction in test complete

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-expre...)

 

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-expre...)


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Frequent Contributor

Re: How to store a value that is generated in a transaction in test complete

So the stored value is not being used in the next step, the test is running and selecting the first row of workorder number which is not correct. The script needs to select the workorder number from UI that is in stored variable.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors