Answers: <p>For less trafficked parts of your web service, synthetic transactions are a good option.</p>
  <p>There are some trade-offs to be made when choosing either using an <em>API</em> to or using a <em>full browser</em> style check.</p>
  <p><em>API</em> checks require changing the application being tested. I'd try and go this route first, but it is dependant on the functionality you need to test. These can be considered health endpoints. Some example implementations are <a href="https://github.com/beamly/SE4/blob/master/SE4.md" rel="nofollow noreferrer">Beamly S4</a> or the <a href="https://hootsuite.github.io/health-checks-api/" rel="nofollow noreferrer">Hootsuite Health Checks</a>. There are many sites which can hit these endpoints as you mentioned eg. Pingdom, <a href="https://www.freshworks.com/website-monitoring/" rel="nofollow noreferrer">FreshPing</a> or <a href="https://docs.datadoghq.com/synthetics/" rel="nofollow noreferrer">Datadog Synthetics</a>.</p>
  <p>Full browser style checks do not require changes to the application, which means they are easy to add. As they use contents of the rendered webpage to navigate around, they can be brittle. Changes to the layout or CSS of the page might break the tests that have been created. Options here include <a href="https://www.browserstack.com/" rel="nofollow noreferrer">BrowserStack</a> or <a href="https://docs.datadoghq.com/synthetics/" rel="nofollow noreferrer">Datadog Synthetics</a>.</p>
  <p>On running this yourself, you can also run into the problem that certain locations, regions, POPs for CDN's might have issues reaching your site. This is why most of these services offer many locations to hit your site from, so you can catch those issues which might only affect some of your customers. So I'd definitely recommend going the hosted route.</p>
  <p>From a security perspective, these systems will definitely need credentials. If you can't lock down the account used by these services in your application to read only, or only provide permissions to certain areas on your app, an option might be to rotate credentials. For example, create job that runs daily that changes the service accounts, and updates the provider with the new password. For example, using the <a href="https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/synthetics_global_variable" rel="nofollow noreferrer">Datadog Synthetics Terraform resource</a>.</p>
  <p>For &quot;watching the watcher&quot;: As you will have regular load on your application now based on the synthetic transactions, you could instrument your application or parse the logs to ensure the transactions are coming through.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-07-20T15:12:34.007Z
Answers: 2021-07-20T15:12:34.007Z
Answers: Matthew Hodgkins
Body: <p>In a company I work for, we have deployed many services: a major part of them are small and rather rarely used, but an outage would be a problem nonetheless. At some point I realized that manual testing of whether they work properly requires too many resources and it might be a good idea to automate the work.</p>
  <p>My first thought was that self-hosting this piece of infrastructure means that I'd have to maintain two separate critical ecosystems: if I run the tests on the same server (or even hosting provider) that my services run on, downtime might bring both systems down and I would get no notification of a failure. Because of that, I decided to choose paid solutions.</p>
  <p>I researched the topic and found many tools like Runscope, but most of them were rather basic request-response validation tools: if the server doesn't time out or respond with an error, the tools assume that everything is OK. This doesn't work well when a website is not open to unauthenticated users: crafting a POST login query is in many cases not feasible (e.g. because of CSRF) and means that I need browser-based automated tests, as opposed to query-based ones. I was suggested to expose an unauthenticated &quot;sanity test&quot; endpoint, but this feels too synthetic: ideally, the test would resemble user interaction as much as it's reasonably possible.</p>
  <p>My current solution is to use <a href="https://pingdom.com" rel="nofollow noreferrer">Pingdom</a>'s transaction/synthetic tests, but I quickly discovered multiple problems:</p>
  <ol>
  <li>Pricing. Pingdom charges 490,00 € yearly for 10 automated browsed-based test scenarios with failure notifications,</li>
  <li>Security. The current solution requires me to upload credentials to the tested applications in order to test anything beyond the login wall,</li>
  <li>&quot;who's watching the watchmen&quot; problem. I solved this by exposing a separate service which keeps track of when it was last contacted and sends a separate set of notifications if Pingdom didn't contact it for some time.</li>
  </ol>
  <p>I feel like this is such a common problem, I cannot believe there are no popular/standard solutions or strategies that would address it. Is my approach somehow wrong, or is it something that is usually developed in a project-specific manner?</p>
  
Tags: <automation><monitoring><testing>
Title: What is a good strategy to reliably and automatically perform remote system tests of a web service?
UserDisplayName: d33tah
ThreadText: # What is a good strategy to reliably and automatically perform remote system tests of a web service?
  
  (Asked by: username_0 on 2021-07-16)
  
  In a company I work for, we have deployed many services: a major part of them are small and rather rarely used, but an outage would be a problem nonetheless. At some point I realized that manual testing of whether they work properly requires too many resources and it might be a good idea to automate the work.
  
  My first thought was that self-hosting this piece of infrastructure means that I'd have to maintain two separate critical ecosystems: if I run the tests on the same server (or even hosting provider) that my services run on, downtime might bring both systems down and I would get no notification of a failure. Because of that, I decided to choose paid solutions.
  
  I researched the topic and found many tools like Runscope, but most of them were rather basic request-response validation tools: if the server doesn't time out or respond with an error, the tools assume that everything is OK. This doesn't work well when a website is not open to unauthenticated users: crafting a POST login query is in many cases not feasible (e.g. because of CSRF) and means that I need browser-based automated tests, as opposed to query-based ones. I was suggested to expose an unauthenticated "sanity test" endpoint, but this feels too synthetic: ideally, the test would resemble user interaction as much as it's reasonably possible.
  
  My current solution is to use [Pingdom](https://pingdom.com)'s transaction/synthetic tests, but I quickly discovered multiple problems:
  
  1. Pricing. Pingdom charges 490,00 € yearly for 10 automated browsed-based test scenarios with failure notifications,
  2. Security. The current solution requires me to upload credentials to the tested applications in order to test anything beyond the login wall,
  3. "who's watching the watchmen" problem. I solved this by exposing a separate service which keeps track of when it was last contacted and sends a separate set of notifications if Pingdom didn't contact it for some time.
  
  I feel like this is such a common problem, I cannot believe there are no popular/standard solutions or strategies that would address it. Is my approach somehow wrong, or is it something that is usually developed in a project-specific manner?
  
  **Tags:** automation, monitoring, testing
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-20. Score: 4
  
  For less trafficked parts of your web service, synthetic transactions are a good option.
  
  There are some trade-offs to be made when choosing either using an *API* to or using a *full browser* style check.
  
  *API* checks require changing the application being tested. I'd try and go this route first, but it is dependant on the functionality you need to test. These can be considered health endpoints. Some example implementations are [Beamly S4](https://github.com/beamly/SE4/blob/master/SE4.md) or the [Hootsuite Health Checks](https://hootsuite.github.io/health-checks-api/). There are many sites which can hit these endpoints as you mentioned eg. Pingdom, [FreshPing](https://www.freshworks.com/website-monitoring/) or [Datadog Synthetics](https://docs.datadoghq.com/synthetics/).
  
  Full browser style checks do not require changes to the application, which means they are easy to add. As they use contents of the rendered webpage to navigate around, they can be brittle. Changes to the layout or CSS of the page might break the tests that have been created. Options here include [BrowserStack](https://www.browserstack.com/) or [Datadog Synthetics](https://docs.datadoghq.com/synthetics/).
  
  On running this yourself, you can also run into the problem that certain locations, regions, POPs for CDN's might have issues reaching your site. This is why most of these services offer many locations to hit your site from, so you can catch those issues which might only affect some of your customers. So I'd definitely recommend going the hosted route.
  
  From a security perspective, these systems will definitely need credentials. If you can't lock down the account used by these services in your application to read only, or only provide permissions to certain areas on your app, an option might be to rotate credentials. For example, create job that runs daily that changes the service accounts, and updates the provider with the new password. For example, using the [Datadog Synthetics Terraform resource](https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/synthetics_global_variable).
  
  For "watching the watcher": As you will have regular load on your application now based on the synthetic transactions, you could instrument your application or parse the logs to ensure the transactions are coming through.
  
  
  ---
  
  