How do I convert the payload which is an array held in memory ( I think ?), into a string so that I can compare if it is equal to test ?
You don't need to. The strcmp() function can be used to perform the test, and the payload array can be cast to the proper type.
if(strcmp((char *)payload, "test") == 0)
{
// Yeah, they match.
}