Testing

The plugin contains integration level tests tied to Maven's verify stage. These tests cover all existing functionality as the time of build.

 

 

Exploratory/Ad-hoc testing

To explore or test new features I suggest Atlassian's RAB for exploratory testing.


Scripted / Regression testing

I recommend Resty, its lightweight and easy - https://github.com/micha/resty

 

 Click here to expand sample test script...
#!/bin/bash
#
#
# This script calls the token create endpoint and then disabled and re-enables an agent before deleting its token
# Only a smoke test, for comprehensive tests see the src/test folders
#
 
#update these as needed, or pass as arguments
domain=${1:-http://YOURDOMAIN.com/bamboo}
user=userguy
password=secrets
agentId=$2
 
 
 
#this tests most functionality, and can be customized as needed

#install and source resty
curl -L http://github.com/micha/resty/raw/master/resty > resty
. resty

#now do it!
resty "https://${domain}/builds" -k -H "Accept: application/json" -H "Content-Type: application/json" -u $username:$password
echo "creating new token"
muuid=`POST /rest/agent/latest/tokens '{"name":"doitall","read":"true","change":"true"}' | cut -d\" -f 4`
echo "returned UUID: $muuid"

echo "show lists of tokens"
GET /rest/agent/latest/tokens >/dev/null
echo "dropping to anymous user and hitting homepage to get cookie"
resty "${domain}" -kL >/dev/null
GET / -j >/dev/null
echo "use token to get agent state @ /rest/agent/latest/${agentId}?uuid=${muuid}"
GET /rest/agent/latest/$agentId?uuid=${muuid} -Q >/dev/null
echo "disable agent"
POST /rest/agent/latest/$agentId/disable?uuid=${muuid} -Q >/dev/null
echo "enable agent"
POST /rest/agent/latest/$agentId/disable?uuid=${muuid} -Q >/dev/null
echo "All dones. You should see no warnings our errors above, only info ttext."