Testing The Untestable

A long time problem for automated end-to-end testing has been testing production systems that have no test system available for testing.

A classic example is payment systems and other financial endpoints. Other examples I have worked with include college admission systems, insurance company APIs, loan system endpoints and many local and federal government services that cannot afford or are unable to provide test systems you can use.

Traditionally end-to-end testing with Selenium did not provide simple ways to overcome this problem. This in turn, frequently leads to automation that is very limited in scope and/or require clunky manual intervention and/or manual testing. These challenges only grow when we try to run our test suites in CI systems which require full automation.

Modern approaches have now given us tools and knowledge on how to address this. A couple of solutions are shown below

  1. Create a local server that serves the same responses that the actual API will provide and then configure test runs to start and use this server. This typically means getting a sample response from the real API and then building test responses using this. One item that frequently needs to be addressed is using some form of unique ID generator to provide unique ID's that real responses would provide.
  2. Use a framework such as Cypress or Playwright that provide you with the easy ability to mock out responses from a real server. These tools provide many of the pieces that you would end up building yourself if you went with the first option of a test server.

An important part of a good solution will be to test at multiple levels. Given the above solutions involve mocking out live responses you should consider integration tests (if possible) to verify that production endpoints are still valid and of course a base of high coverage unit tests for actual functionality. You might also consider a few happy path smoke tests for production with sad cases covered in test systems. Production monitoring of live endpoints rather than going through brower UIs is another option to consider.

要查看或添加评论,请登录

Michael Durrant的更多文章

  • This is AI...

    This is AI...

    The recruiter uses AI for the job "Playwright engineer". Playwright is a framework for programmers writing browser…

  • Playwright Page Objects

    Playwright Page Objects

    I've used page objects in a number of languages and automation frameworks. Here is a playwright example where each step…

  • Pairing with chatgpt

    Pairing with chatgpt

    If you use chatgpt mostly like google you may be missing much of the good stuff. Here is an example of a programming…

  • Tests add the most value when you understand why they fail

    Tests add the most value when you understand why they fail

    Unfortunately it can be easy to write a test that reports the failure like this: The failure is that "matchFound" isn't…

  • Playwright for speed

    Playwright for speed

    Playwright lets you write tests that run very fast. To get the fastest tests requires some tweaking of several factors…

    1 条评论
  • Regex pays off big

    Regex pays off big

    Today I am writing a regex in a Playwright test. Which continues to use the knowledge I learned about writing regex's…

    1 条评论
  • Code pairing with chatgpt

    Code pairing with chatgpt

    I recently realized an interesting development for my code writing: I am now frequently pairing with chatgpt to write…

  • Avoiding the Page Object Model

    Avoiding the Page Object Model

    Per google(AI) "The Page Object Model (POM) is a design pattern used in test automation to improve test maintenance and…

  • Playwright accessibility testing

    Playwright accessibility testing

    Testing for accessibility is important for many financial, legal and ethic reasons. Traditionally browser testing did…

  • Playwright retries and timings

    Playwright retries and timings

    Playwright has a number of options to help you tackle those pesky intermittent failures that those of us who are well…

社区洞察

其他会员也浏览了