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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batching .was files

Status
Not open for further replies.

efittery

Programmer
Feb 13, 2003
21
US
I have about 30 .was files I would like to run overnight.

Any tips on how to do this?

Normally I use TestExpert to put all my test scripts in a harness that I can have run overnight, but I don't have much experience with Procomm/Aspect Scripting.

Any help would be appreciated.
 
I would create a master script file to run the all the other scripts as child processes using the execute fucntion.

Example
Code:
proc main
execute "script1.wax"
execute "script2.wax"
execute "script3.wax"
;....
endproc

If the parent script needs to determine status of the child before proceeding, you can use exit codes (ie exit 42) in the child script which then can be checked using the $EXITCODE variable from the parent script.
 
I can get more flexibility out of creating a .bat file and putting the following in it:

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_01.wax

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_02.wax

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_03.wax

My problem is that the above causes me to get 3 copies of PROCOMM running. How do you shut down PROCOMM executables after they run one .wax file?
 
Actually what I should have said is that when the first version of Procomm runs the first .was script, the first instance of Procomm just sits there doing nothing.

this means the .bat file sits waiting for the first instance to finish running and never starts up the next line in the .bat file.

As aa result, I must somehow tell each instance of PROCOMM that after it is finished running it should shut down.

suggestions?
 
stupid me....

pwexit will do the job if it is the last statement in all of the "prog main" programs I am running.

It is amazing what you can do if you read documentation. Thanks everybody for your help.

have a good day.

:)

 
This was my final solution:

In the file common.inc which is included by all of my .was files I put in the line

; #define BATCH -1

By leaving in or removing the ";", you can specify using the BATCH mode or not.

In all the other .was files, I put the following at the bottom of each file:

#ifdef BATCH
pwexit
#endif

in the file EXEC_TEST.bat I put in the following lines.

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_01.was

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_02.was

c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_03.was

With all that set up, I can run any of the files individually by leaving the

; #define BATCH -1

as it is or I can remove the ";" from the common.inc line that does the #define BATCH -1 and just double click on the file EXEC_TEST.bat




 
c:\Programs\Symantec\ProcommPlus\PROGRAMS\PW5.EXE EXEC_UTC_01.wax

If I run the above line in a dos window, it will start up procomm and run the .was file.

When the .was file finishes the procomm program is still running.

Is there a command line argument I can add to the end of the above dos command line that will cause procomm to stop when the script has completed running?

I know about pwexit but I really would prefere to have a command line argument that tells procomm to shut down when it finishes running the script.

thanks
 
Nope, pwexit is the only way I am aware to have Procomm shut itself down. You could theoretically cobble together a batch file that looks for a file created by the script indicating it is done, then launch a "kill" utility to force the closing of Procomm, but that is a tad messy and inelegant.


aspect@aspectscripting.com
 
Being able to automate regression testing with PROCOMM is not impossible. This is how I managed to do it.

I want to be able to write to the DOS command line:

pw5 test.was PWEXIT

and have the PWEXIT argument be interpreted by my script to tell Procomm to shut down.

I also want to be able to use the Procomm GUI to run the test.was script.

Anyhow, here is how I do it.

1. When you run pw5 ( Procomm) from the command line, I0 contains the number of arguments being passed in. The strings S0 through S9 contain the arguments. Note: If the only argument is PWEXIT the string S0 will contain this text until it is written over.

2. By using I0, you can determine which of the strings S0 through S9 will be holding the last argument. So if I0 = 1 then I know that S0 will be holding the last argument. In my case I want to know if it is "PWEXIT".

3. Every script must do a "#INCLUDE common.inc" and the first line of this file should be:

STRING exitOnPWEXIT S0

QUESTION: Does anybody have a way to do the above in such a way that it would be something like S[I0-1], meaning I am
interested in using I0 - 1 to specify which S0 through S9 I wish to use?

4. In the common.inc file there has to be the procedure:

proc exitIfPWEXIT
if strcmp exitOnPWEXIT "PWEXIT"
pwexit
endif
endproc

5. The last line of every script you write must be:

exitIfPWEXIT()

6. The last thing is to build a .bat file that will allow running any number of Procomm scripts in a batch file.

7. The following is an example of my .bat file.

PW5.EXE EXEC_UTC_01.was PWEXIT
PW5.EXE EXEC_UTC_02.was PWEXIT
PW5.EXE EXEC_UTC_03.was PWEXIT
PW5.EXE EXEC_UTC_04.was PWEXIT
PW5.EXE EXEC_UTC_05.was PWEXIT
PW5.EXE EXEC_UTC_06.was PWEXIT

When you run this batch file from the dos command line, it will start procomm, run the test script and because the last argument was PWEXIT, will shut down procomm prior to doing the whole process again with the next .was script specified in the .bat file. This will also work with .wax files.

You will have to make sure that PW5.EXE ( procomm) is in your path.
 
Probably the easiest thing to do would be to use a switch statement on i0, then have a separate case block for each possible value that i0 could have in your script. The example script in the discussion of the switch command should get you going on this.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top