What is the difference between using System.Windows.Automation (commonly known as UIA) API and Microsoft.VisualStudio.TestTools.UITesting (one that is used in Coded UI Test behind the scene) for implementing UI Test automation of a WPF application programatically?
Is there any specific scenarios, restrictions or advantages/disadvantages?
Coded UI Tests are a framework which wraps many automation technologies. UIA is just one of them.
UIA is new in Vista/Windows 7 and it targets rich client apps, coded UI tests will use UIA when you write tests against WPF and Silverlight.
The advantage of Coded UI over using UIA directly is a lot of automatic retrys and knowledge of how UIA works is built into Coded UI tests.
In fact, the answer is in your question. UIA is used for automation, while UITesting is used for... testing.
An excerpt from MSDN:
Thus, UIA can be used for - but isn't limited to - UITesting.