Forum Discussion

ANW's avatar
ANW
Contributor
14 years ago

Persistent ProjectSuite variables??

I have to keep some kind of persistent variable for my tests, as I need to test phonenumbers and sim cards in a specific range. But since I have to be sure that the numbers used are not already used, I thought I would make a persistent counter.



I want my Phonenumbers to begin at 19000000, and SimCards at 8945000000000000000, and then whenever I use one, I just increase the counter. That would give me more numbers than I need (as I get a fresh production db every weekend).



So I made two persistent ProjectSuite variables to hold this counter between test runs.



But I am getting an error whenever I try to use them "Variable <ProjectSuite> not defined", and I am unsure why.



I was just testing them with this code:



ProjectSuite.Variables.gCounterNPCellNo := ProjectSuite.Variables.gCounterNPCellNo +1;



If I am reading the help correctly, this is how I should use the variable. So why is TC telling me that it is not defined?



The help uses this example (which is wrong for DelphiScript .. there is a ':' missing in front of '='):



Project.Variables.MyExportFilePath = 'C:\MyFolder\MyProject.mds';


ExportFileTo(Project.Variables.MyExportFilePath);




Why am I getting an error?? ... am i doing something wrong?
  • Hey Jared



    I sent the ProjectSuite, but I already found my error ... typical.



    You can disregard this issue.



    Seems that I had an inc(ProjectSuite.Variables.xxx) line in my test procedure, and it was actually that one that failed during compilation. I found it as I was running something completely different. After commenting that line out, there is no longer any problems.



    Sorry for inconvinience.
  • ANW's avatar
    ANW
    Contributor
    Hey Jared



    I sent the ProjectSuite, but I already found my error ... typical.



    You can disregard this issue.



    Seems that I had an inc(ProjectSuite.Variables.xxx) line in my test procedure, and it was actually that one that failed during compilation. I found it as I was running something completely different. After commenting that line out, there is no longer any problems.



    Sorry for inconvinience.
  • Hi,



    I've tried your code and it worked for me. What TC version are you using? Also, can you send us a sample project suite demonstrating this problem?
  • ANW's avatar
    ANW
    Contributor
    I am using 8.20 Enterprise version. Still having the problem this morning.



    I will send you the project suite I am using.
  • Hi Anders,



    That's ok. Thanks for letting us know that you've solved the problem.