Introducing All You Can Test When You Capture Network Traffic

cerberus-testing-all-you-can-test-when-you-capture-network-traffic

We all wonder what happens behind the scene.

In the world of software, the various flows happening after we click on a button are hardly visible. But we have to access them to ensure they are working properly using test automation.

The browser network traffic enables access to valuable information of the user experience: which APIs are called, the loading time and even the size of the loaded content.

In this article, we share the various testing use-cases available once you capture the network traffic. We will use Cerberus Testing to simplify our journey. You can read this introductory article on how to unlock the network traffic capture.

Let’s share the repeatable structure you can then reuse.

Understand the repeatable structure

The network traffic is a mine of various information where the data can be hardly usable at first. Cerberus Testing helps you by providing a clear data interface and test structure.

The data interface is the main source of information to build the various verifications. Cerberus Testing formats the data to ease your testing journey. Global and detailed indicators are available for each network traffic capture.

The test structure decouples each area of automated tests. The actions and controls are the building blocks of the actions to be performed. Then, the data properties enable to decouple the of actions and data. Lastly, the libraries of objects, steps and data are available transversally.

Our network capture case can be built on this structure :

  1. Define actions to capture the network traffic
  2. Set data properties to collect specific information
  3. Add controls depending on your verifications

First, you use “waitNetworkTrafficIdle” and “setNetworkTrafficContent” to actually collect the network traffic:

Second, you can define a property using the native JSON parser:

Then, you can add a control based on the retrieve data:

You can reuse that exact structure for a variety of uses-cases shared hereafter.

Verify a specific partner interaction

A click on a button triggers a whole set of interactions behind the scenes. Verifying these flows is essential to ensure the associated functions run correctly. Our first use case is to test for the effective call to a partner.

You can achieve that in two ways using Cerberus Testing:

  1. Collect all network traffic and verify the API call using the control “verifyElementPresent” on “$.stat.thirdparty.<partner>”
  2. Filter the network traffic content first on the “setNetworkTrafficContent” parameter, to then verify the number of calls is greater than one for that partner

The second case is shown below. The first one is only different for the control.

You can rely on that technique to test any API calls, internal or external. The case of testing for privacy is a mandatory one with the new consent regulation. Access the full article here.

We can enrich our tests by verifying the various return codes.

Check the API call return status

The reliability of the user experience is a game-changer for digital organizations. The response time, stability and reactivity are criteria now impacting the SEO and ranking of websites. It is therefore important to verify the return codes.

You can leverage the same structure with Cerberus Testing. The only difference is the control to define. Cerberus Testing provides you with a counter for each return code that your control can be based on.

You can systematically use control for each test using the assertion library and the simplified JSON locator:

  • Ensure that no errors 500 happen with “x.stat.total.requests.nb5XX” equals to 0
  • Ensure no errors for internal calls with “x.stat.internal.requests.nbError” equals to 0
  • Verify the Kargo partner don’t have 1xx error code with “x.stat.thirdparty.Kargo.requests.nb1XX” equals to 0

You can continue to grow your test suite by accessing different counters, for example on the loading time.

Ensure page load remains under a threshold

The loading time of a user interface is critical. The users have no time to lose and you must guarantee the response time remains under control. You can achieve that by adding controls on the loading time.

You can equally leverage the Cerberus Testing ecosystem with control of different response time counters such as “x.stat.total.time.avg” for the average loading time. Here’s the entire set of counters available:

These controls are very helpful in CI/CD and production monitoring scenarios. You can ensure the loading time remains acceptable during software changes and in the actual user experience. For more details, you can consult this article on how to test for speed.

Bit by bit, your library is ready for scalable test automation.

Make the difference with an end-to-end framework

The repeatable structure with a simplified interface is what enables you to accelerate. You have no time to lose in your test automation effort for coding the network traffic capture, the JSON parser or the control library.

You can truly accelerate your software delivery and quality using a ready-to-use test automation framework. Your team needs your support to ensure reliable software changes. You can make a difference by building an awesome test automation library.

Cerberus Testing exists to let the teams focus on what matters for the business. The fully open-source model enables you to access a mature product that is continuously evolving and maintained.

Stop coding and start testing for Free.

Leave a comment

Your email address will not be published. Required fields are marked *

Cerberus-Testing Terms Of Service


Website Terms and Conditions of Use

1. Terms

By accessing this Website, accessible from http://vgeouyk.cluster030.hosting.ovh.net, you are agreeing to be bound by these Website Terms and Conditions of Use and agree that you are responsible for the agreement with any applicable local laws. If you disagree with any of these terms, you are prohibited from accessing this site. The materials contained in this Website are protected by copyright and trade mark law. These Terms of Service has been created with the help of the Terms of Service Generator and the Privacy Policy Template.

2. Use License

Permission is granted to temporarily download one copy of the materials on Cerberus Testing's Website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:

  • modify or copy the materials;
  • use the materials for any commercial purpose or for any public display;
  • attempt to reverse engineer any software contained on Cerberus Testing's Website;
  • remove any copyright or other proprietary notations from the materials; or
  • transferring the materials to another person or "mirror" the materials on any other server.

This will let Cerberus Testing to terminate upon violations of any of these restrictions. Upon termination, your viewing right will also be terminated and you should destroy any downloaded materials in your possession whether it is printed or electronic format.

3. Disclaimer

All the materials on Cerberus Testing’s Website are provided "as is". Cerberus Testing makes no warranties, may it be expressed or implied, therefore negates all other warranties. Furthermore, Cerberus Testing does not make any representations concerning the accuracy or reliability of the use of the materials on its Website or otherwise relating to such materials or any sites linked to this Website.

4. Limitations

Cerberus Testing or its suppliers will not be hold accountable for any damages that will arise with the use or inability to use the materials on Cerberus Testing’s Website, even if Cerberus Testing or an authorize representative of this Website has been notified, orally or written, of the possibility of such damage. Some jurisdiction does not allow limitations on implied warranties or limitations of liability for incidental damages, these limitations may not apply to you.

5. Revisions and Errata

The materials appearing on Cerberus Testing’s Website may include technical, typographical, or photographic errors. Cerberus Testing will not promise that any of the materials in this Website are accurate, complete, or current. Cerberus Testing may change the materials contained on its Website at any time without notice. Cerberus Testing does not make any commitment to update the materials.

6. Links

Cerberus Testing has not reviewed all of the sites linked to its Website and is not responsible for the contents of any such linked site. The presence of any link does not imply endorsement by Cerberus Testing of the site. The use of any linked website is at the user’s own risk.

7. Site Terms of Use Modifications

Cerberus Testing may revise these Terms of Use for its Website at any time without prior notice. By using this Website, you are agreeing to be bound by the current version of these Terms and Conditions of Use.

8. Your Privacy

Please read our Privacy Policy.

9. Governing Law

Any claim related to Cerberus Testing's Website shall be governed by the laws of fr without regards to its conflict of law provisions.

Thank you for your interest in cerberus,

In order to proceed with your SaaS we need some in order to confirm your instances accesses.

Please provide accurate contacts to secure the process.

You can cancel any time the subscription, please read Terms of Use.