Writing and executing a simple TestNG program is mainly 3 step process.
Code - write business logic of your test and annotate it with TestNG annotations
Configure - add information of your test in testng.xml or in build.xml
Run TestNG - it can be invoked from command line, ANT, IDE like Eclipse...