Saturday, August 3, 2019



Azure App Insights – Write Test case for AppService Availability





To check you AppService availability is potential when your application is in production and being use by plenty of end users. To write test case in .Net, Java or in other programming language is possible using Nunit ,Junit ,Jasmine and others.
I was astonished with this testing feature, So thought to explore something about it. Yeahh That’s true so lets write Test case in Azure .Trust me it gonna be fun.
I’m utilizing .Net Core based application along with Azure Cosmos DB.



Prerequisites : You should have basic understanding of .Net Core .
Application Insights should be configured for an application like WebApp/AppService
Once you are done, You can should see few resources created within Azure portal as shown in image rg-in-azure



Once you have published an application ,Click on Application Insights (e.g. CosmosDBInsights).After clicking on this it opens AppInsights refer an image shown below application-insights


IN the left pane you should be able to see Availability option till date 3Aug 2019 ,Click on that
After clicking of availability you will see the following screen in order to create you Test to verify an availability of the specific endpoint. Refer image add-test




After clicking on AddTest , A new window will appear on the right side to fill the all necessary details like


  1. TestName,
  2. Test Type
  3.  Specify the URL to test in that,
  4.  Parse dependent request which states “When enabled, the test requests images, scripts, style files, and other files that are part of the web page under test. The recorded response time includes the time taken to get these files. The test fails if all these resources cannot be successfully downloaded within the timeout for the whole test. If this option is not enabled, the test only requests the file at the URL you specified” . Reference portal.azure.com.
  5. . Enable retries for availability test failures
  6.  Test Frequency : The frequency at which this test will be executed periodically.
  7.  Test Location : Choose your test location after keeping thought about users .
  8.  Success Criteria Which requires Http status code returned to equal the value like 200, 400,4040, 500 etc.
  9.  Alerts : There are default alerts configured though classis preview still exists.

You can refer below some screen shots for reference what should you fill in those properties.
Refer image Test-case-details


Once you save it and after the certain time you will see , Test case has started executing and you should be able to see the details in Availability section in form of line chart or Scatter chart. If you expand the arrow button shows below the chart you will find location details about website availability .Kindy refer an image showing below: availability-of-ping-url






This helps you definitely if you want to test specific endpoint availability.