I got this question while interviewing some companies. I don’t think I answer the question well. However, based on my understanding:
The UI level testing is more about the what end user will see and would be better to use for acceptance testing.
The API level test is good for performance testing, since it’s easier to simulate multiple users to access the resource at the same time. And, it’s easier to look at where the problem will be.
Can anyone give me more detail about that? And when should we choose to use which type of testing?? Thanks a lot.
Instead of going into a long explanation, where you can find volumes written on the Internet, let me give you a couple of additional keywords.
For UI testing, also look at FUNCTIONAL and EXPLORATORY testing.
For API, also look at UNIT and AUTOMATED testing.
I find this resource useful http://www.stickyminds.com/testandevaluation.asp?Function=FEATUREDETAIL&ObjectId=17275
Pick the one your boss will give you a promotion for.