Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test application

Status
Not open for further replies.

JudyBarer

Programmer
Jan 13, 2004
23
US
I have a VFP 8.0 app which generates PDF files. I would like to keep all of these files in a certain directory on our server. When I am running my test app I would like to save the files in a different directory. What would be the best way to tell if I am running the test app or not. Is there anything I can do with #IFDEF so that I only have to test once in the app if this is the test app or not? I hope you understand what I am asking.

Thanks

 
#DEFINE and #IFDEF statements that rely on them only ever are evaluated during compile.

So, if you put code like:

Code:
#DEFINE TESTBUILD .T.
.
.
.
#IFDEF TESTBUILD
  lcDestDir = 'c:\temp'
#ELSE
  lcDestDir = gcMydocs
#ENDIF


Then you could simply recompile without the DEFINE TESTBUILD line, and it would use the all the code in #ELSE. You would want to limit the differences between the builds, to avoid not-testing the production code, but key assignments like this could work very well.

If the #DEFINE were in a separate .H file that is "#INCLUDE myheader.H" at the top of every .PRG and in the "Include File" menu setting of every VCX-class and SCX-Form, then you have one place to change the #DEFINE status of TESTBUILD. (But you have to make sure that EVERYTHING recompiles before releasing, after changing the .H file contents)

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Judy,
If you want check between the Runtime and the developer environment, I use something like this:
Code:
PUBLIC glruntime
glruntime = (VERSION(2) = 0)
You can also check for a developer System Environment variable:
Code:
PUBLIC glTesting
glTesting = (GETENV("Testing")="ON")
Of course you'll set a SET command in your AUTOEXEC.BAT or environment settings - depending on your OS.
TESTING="ON"

The #IFDEF's require you to remember to change a value and then recompile the application, which may change things you hadn't planned on.

Rick
 
Thanks for completing my answer, Rick: Personally I use the VERSION(2)=0 so that I don't have to remember anything for release, but as a result the application code may run slightly slower (since all the "IF glRuntime" statements execute in the released code instead of at compile time)

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top