Prepare your Environment:
--Download and install Visual Studio (enterprise version).
1. Open Visual studio to create a test project.
Choose File > new > project select Web Performance and Load Testing Project, and then rename your project name and select a specified path.
2. Right click on WebTest and add a Web service Request.
the request is created and with a default URL. Replace the URL with the URL of your app's page. Here I will send a post request . You can change the request type and set the expected status code in Properties.
3. Add a header and edit Body, etc.
Edit body if need
4. Run web test .
5. Analyze the results
You can see the testing is run successfully, response status =200 OK ..... Then I change the status to 201. that testing will be failed and show you details about the error.
Summary:
I start to learn about Visual studio, I think that visual studio is not designed for API testing ,so that is not convenient to run API testing.