Forum Discussion
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?
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.
- cmbdnne6 years agoOccasional Contributor
Hi Robert, thanks a lot for your reply.
While your solution recipe makes perfect sense I find myself having troubles applying your clues so I hope you won't mind me asking you to please elaborate further even though it probably is very back to basis.
Screendump 1 is a clip from my test where the project's name value is entered and it's this value I'd like to change from test re-run to re-run - however, this project name is going to be inserted later in the same test (Screendump 2).
Then, I've created my variable, ProjectName, immediately after entering the project name value at the very beginning of my test (Screendump 3 and 4), and I'm assigning the variable the value of your code expression (Screendump 5).
However: Should the ProjectName variable value be defined by the entire code expression? The "Automation" part too?
I reckon that the ProjectName variable should be created and its value assigned at this initial point in the test as the ProjectName variable needs to be inserted further down in the test?
To me it doesn't appear logical to set the variable value at the end of the entire recorded test.
Thank you very much in advance.
Related Content
- 11 months agoakilan
- 12 years agoachand
- 12 years agopratyushdash