help to handle the expect script issue

Hi experts

I know the expect script can match the terminal output to run the the following cmd

I write a script with expect named "test", I want to run ten "test" with background running,

for ((i=1;i<=10;i++)
do
 ./test -n $i
done

I find all the output of test will print on one terminal, and one "test" program will match another output of "test, eg: ./test -n 3 maybe match
./test -n 4 by mistake, i just want ./test -n 3 to match its own output

how can I handle this , give me some idea