In my android project I want to run tests using shell script. Depending on whether or not tests pass I want to do some further actions. My question is how my script is supposed to know if tests passed? To run tests I use ./gradlew test command. It would be nice if the return value of this command would be an integer or boolean but it’s not. This is my run_tests.sh at the moment, however it doesn't work because OUTPUT is not a boolean value;
#!/bin/bash
OUTPUT=$(./gradlew test)
if [ "$OUTPUT" = true ]; then
echo "Tests passed. Do something."
else
echo "Tests didn't pass. Do something."
fi
This script always prints "Tests didn't pass. Do something.".
Aucun commentaire:
Enregistrer un commentaire