Forum Discussion
Can you provide an Object Browser data for the mentioned element (the textbox with ID)?
Hi again,
I'm not sure if this was what you're asking for but as the test steps illustrate, I establish a new project with the name testcontrol0402. As this name cannot be the same when I re-run the test, I've replaced the project name with a code expression which names the new project after the date and time of its creation.
This date and time expression value is what I would like to capture in a variable to use further on in the test.
When I re-run my test, the new project will have a different date/time value which then should captured and use further on in the test.
I hope this makes sense & thank you for your help.
- baxatob6 years agoCommunity Hero
When I try to download your file, I get this error:
community.smartbear.com sent an invalid response. ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
Can you embed screenshots directly into the message body?
- cmbdnne6 years agoOccasional Contributor
- cmbdnne6 years agoOccasional Contributor
No I'm sorry, it doesn't appear to be possible.
Is this format better?
- Marsha_R6 years agoChampion Level 3
Save your screenshots separately as .jpg and then attach them. I think the .docx format is what's giving the trouble here.
- cmbdnne6 years agoOccasional Contributor
Hi again, I hope you'll be able to see the screenshots this time.
In screenshot #1 I have created a new project and named it TESTCONTROL1000 (the name could be whatever combination of letters and numbers).When I finish recording my test and re-run it, it will fail because the new project isn't allowed to have the same name as the previous project. I've therefore tried to enter a code expression (see screenshot #2) through which every new project created whenever the test is re-run, is named by the date and time of its creation.
So far so good, but I need to capture the value of the project name as I need it in the test steps to come.
Thus, the project name should be the same throughout the entire test but change whenever the test is re-run.
#1 approach
I've tried to capture the project name value (the date/time expression) in a variable by opening the created project in my app after recording and capturing the name value as a property object/onscreen onject. I then used the variable whereever the project value should be inserted further on in the test procedure. Unsuccessfully.
#2 approach
As the project name could be whatever my next approach was to create a simple Excel data sheet with a list of test project name values and saved it as a csv file. I created a data sheet variable and used it in my test in the same way as described in #1 approach. Problem arised as the variable value didn't appear to change from the first data sheet value to the second to the third with each test run.
Now I've run out of ideas and am beginning to doubt whether this is actually possible in TestComplete - preferably without coding - and I hope you can offer some advice. Let me know if you need further info or screenshots.
Thank you very much in advance.
- tristaanogre6 years agoEsteemed Contributor
Your code expression is incorrect. What I would suggest is give it a starting static piece of text to identify it as coming from your automation and then the datetime stamp to make it unique. It SHOULD be something like this.
'Automation' + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%Y%m%d%H%M')
Now, what I would ACTUALLY, do is use the Set Variable Value operation in your keyword test, create a variable call "projectname", and assign it the value of the code expression as I indicate above. Then, in that operation in your screenshot, set the "Mode" to "Variable" and select that projectname variable from the drop down. You can then use that variable throughout the keyword test anytime you need to reference the project name.
Related Content
- 11 months agoakilan
- 12 years agoachand
- 12 years agopratyushdash