jeudi 30 janvier 2020

Run a single case test with maven in parallel [BASH]

I need to run n times the same test case and count the number of times the test pass or fail. I wrote the following snippet of code:

CONCATNAME=$CLASSNAME”#”$METHODNAME
PASSTEST=0
FAILTEST=0
TOSEARCH="BUILD SUCCESS"
i=0
for i in $( seq 1 $NROUNDS )
do
    echo "exec command: mvn -Dtest="$CONCATNAME" test"
    message=$(mvn -Dtest=$CONCATNAME test)
    if echo "$message" | grep -q "$TOSEARCH"; then
        PASSTEST=$((PASSTEST+1))
    else 
        FAILTEST=$((FAILTEST+1))
    fi
done

but the execution takes several minutes to complete. Is it possible without modifying the POM.xml file to run the mvn -Dtest command in parallel?

Aucun commentaire:

Enregistrer un commentaire