You can test procmail in a number of ways. The way I found easiest was just to simply send an email I was testing against to stdin for procmail
$procmail < email
The danger here is that you are running and testing your scripts on a live system, and hence if something is wrong with your recipes, bye-bye messages.
If you want to be really safe though, you add a safety catch recipe, as your first rule:
:0c /some/backup/dir
Not actually my own tip. Taken from David W. Tamkin's Post on the Procmail Mailing List.
The only problem is… it doesn't work. At least not for me.
I finally got the code working by messing around a bit with it.
DROPPRIVS=yes
:0fw
| /usr/bin/spamassassin
:0
* ^X-Spam-Status: Yes
{
# where i want the message to go
foldername=$HOME/Maildir/.zzSpam
#create a carbon copy of the message and store it
#as a non-delivery action, this allow the script to
#continue processing see procmailrc(5)
:0c
$foldername/ # stores in $foldername/new/
#find out the name of the file we just stored the mail as
:0
* LASTFOLDER ?? /\/[^/]+$
{ tail=$MATCH }
#move the mail to the cur (i.e. read) folder and set satus flags
TRAP="mv $LASTFOLDER $foldername/cur/$tail:2,S"
#We still have the original message hanging around
#so delete it.
#checking again, so that worst case, if i messed up earlier
#only spam messages will be deleted.
:0
* ^X-Spam-Status: Yes
/dev/null
HOST
}