Chapter 1. Introduction to Full Stack Testing

In today’s world, ‘digitalization’ is inevitable to sustain and grow any business. Many businesses are leading the way in this aspect, while some are in the early phases of modernizing their existing digital platforms.

Digitalization is key to broadening a business’s reach from a local community to a global scale, translating to more adoption and more revenue. Almost all small and large-scale enterprises in various sectors, like health care, retail, travel, academics, social media, banking, entertainment, devise plans to advance their digital strategies as a critical measure to yield higher profits.

In this journey towards digitalization and modernization, innovation becomes a crucial driver. We can see the businesses that innovate constantly continue to thrive over many decades. Netflix is a classic example. It started as an online DVD rental portal in the 1990s. It ventured into movie streaming, making its own DVD rental business obsolete in the 2000s. It later started producing original content called Netflix Originals. As of 2021, Netflix is the largest online media subscription platform with over 200 million subscribers.

The technology space has been evolving in parallel to these innovative businesses to accommodate their increasingly advanced needs. Gone are the days where we were willing to wait in line to buy movie tickets, visit a store in a remote location to buy a specialty product, or carry around a hand-written shopping list searching for specifics. Technology eases everyday tasks extensively. We can sit at home and stream our favorite entertainment programs in one touch, try a new dress virtually, schedule our shopping list to be delivered regularly, and do even more—brew a coffee with voice command!

With such rapid evolution in technology, product strategy must be versatile, catering to different customer needs to survive the ongoing competition in their respective sectors. It has to expand its horizons beyond just building websites. Consider the ride-hailing companies, such as Uber and Lyft, which provide their services at our fingertips in various ways—the web, Android, and iOS mobile platforms. In some regions, they even provide tele-booking services through interactive voice response systems (IVR) and call centers. This kind of versatile product strategy has helped them expand across the globe and outgrow competitors.

With such versatile product strategy and innovation, the businesses become successful in acquiring a critical mass of customers. But now, the next challenge is to thrive further—earn more revenue and more customers. We can see the giants in the industry, such as Amazon, leveraging their existing customer base to cross-sell services & products as a strategy to expand beyond. Amazon, which started as an online bookstore, now cross-sells various products ranging from fresh pantry items to electronics to retail products and more, meeting customer demand for consumer goods in nearly every market segment.

Today’s software industry caters to all these business needs—innovate new product ideas, bring them to life, and scale them to reach new customer segments across the globe. To aid the process, they continuously learn new technologies. Unquestionably, the software development teams are standing on the edge, especially when the need for the hour is to deliver all of that with high quality!

Software quality is a non-negotiable criterion when it comes to sustaining a business in the long term. There are many examples of how a glitch in software quality can affect reputation and result in big loss for the businesses. For example, in October 2014, on “Big Billion Day” sale,1 the two Indian eCommerce giants SnapDeal and Flipkart went head to head on their seasonal sale. Flipkart’s website crashed multiple times during the day due to overwhelming demand, losing their sales to Snapdeal.

We can see many such examples across the globe, where businesses albeit their novel product ideas, slip down a steep slope as customers quickly move on to more reliable competitors when quality is compromised. As a result, we can firmly say that quality is quintessential for sustaining a business in the long term.

Such high software quality can be reaped only by a combination of skillful development and meticulous testing. In particular, when I say meticulous testing, I refer to paying attention to every aspect of the application throughout its stack in various facets. This chapter will introduce the breadth of such full stack testing, which has to be performed for a typical web or mobile application.

Full Stack Testing for High Quality

So, to begin with, let us come together on a common understanding of software quality.

Software quality was once equated to a bug-free application. Anyone in the software world today will agree that it’s not just that anymore. If you ask end-users to define quality, we will hear them speak of ease of use, look and feel, data privacy, swiftness in rendering information, and availability of services 24/7. If you ask businesses to define quality, we will hear them speak about reusable code, real-time analytics, zero downtime, no vendor lock-in, scalable infrastructure, data security, legal compliance, and more. All of these are what make an application a high-quality software. A slack in any of these aspects would affect the quality in some way or the other, which is why we need to test for them meticulously!

Though the list of quality requirements looks tall, we have tools and methodologies to cater to most of these needs. So, the bridge to high quality is the knowledge around the tools and, more importantly, the skill to apply them in a given context, both from a development and a testing perspective. This book aims to serve as that bridge between learning the testing skills needed and delivering high-quality software.

Testing, in a nutshell, is a practice to validate the behavior of the application to be as expected throughout. For testing to be successful, it needs to be practiced at the micro and macro levels. It has to be entwined with the granular aspects of the application, such as testing every method in a class, every input data, log message, error code, etc. Similarly, it has to focus on the macro aspects such as testing features, integration between features, end-to-end workflows, etc. But we cannot stop testing there! We need to further test at micro and macro levels for the holistic quality aspects of the application such as security, performance, accessibility, usability, and more from the list mentioned earlier to achieve the end goal of delivering high-quality software. We can encapsulate that to say we need to do full stack testing! As represented in Figure 1-1, full stack testing is to test for different quality aspects of the application at each stack and application as a whole.

A representation of full stack testing
Figure 1-1. A representation of full-stack testing

Full stack testing and development should be inseparable indeed, as the two tracks of a railway line. We must build both tracks simultaneously to build quality-in;2 otherwise, we are guaranteed to derail. For example, suppose you are writing a small block of code to calculate the total order amount for an e-commerce application. Parallelly, you need to test if the code is computing the right amount and if it is a secure code. If you do not test, then you have a broken rail line. When you continue to develop on top of such a fractured rail-line, you will have poor integration and broken functionality.

To ingrain testing at such elementary levels, teams need to stop conceiving testing as a siloed post-development activity, as it has been traditionally done. Full stack testing needs to begin parallel to development and practiced throughout the delivery cycle, giving faster feedback. The practice of starting testing early in the delivery cycle is referred to as shift-left testing, and for full stack testing to yield the required results, you need to follow shift-left testing.

Shift-Left Testing

If we were to write down the sequence of activities in a traditional software development lifecycle (SDLC), they’d read: requirements analysis, design, development, and testing, where testing comes at the end. As seen in Figure 1-2, ‘shift left testing’ suggests shifting the testing activities to the beginning of the cycle instead to yield high-quality results.

Shift left testing
Figure 1-2. Shift left testing

Let us take an analogy to understand this concept better. Let us say your team is building a new house. Does it seem sensible to complete the construction fully and then check for quality at the end of construction? What if you find out the rooms are not of the correct measurements then? What if there is no space to place the door? Those are the issues shift-left testing tries to overcome. The approach believes the quality checks should start right from the planning stage and continue throughout the development phase for the end product to be of the highest quality.

When it says quality checks should continue throughout the development phase, it means the quality checks have to be repeated iteratively for every small chunk of work so that the changes can be incorporated smoothly. In the house construction analogy, it means to do quality checks for each wall when it is getting built so that the issues are corrected immediately.

To perform such extensive testing, shift-left testing heavily relies on automated testing and Continuous Integration (CI), where the quality checks are automated and continuously run in the CI for every small chunk of work. This ensures the application is continuously tested at less cost and effort than manually testing every small chunk of work for multiple quality aspects.

To elaborate this further, some of the steps teams take while shifting left are:

  • Writing unit tests as part of each story and integrating with CI to be run for every commit.

  • Including linting tools and plugins for static code analysis during development and also integrating them with CI.

  • Adding functional tests for every story and integrating with CI.

  • In general, running all types of tests (unit, service, integration, end-to-end tests, etc.) for every commit on the local machine and CI to ensure frequent feedback.

Doing them will ensure almost 50% of the testing tasks are completed even before the newly developed code is deployed to the testing environment. In other words, testing is shifted to the left.

This concept of incorporating testing earlier in the delivery cycle is not restricted just to functional application testing. It can be applied to testing in general, including security testing, performance testing, and others. For example, one of the many ways to shift security testing to the left is to add a pre-commit scanning tool like Talisman, which scans the commit for secrets and alerts, even before checking in the code. In each of the upcoming chapters, you will get to see practical approaches to do shift-left testing.

Overall, shift left testing embodies the aphorism, ‘Quality is the team’s responsibility’ as performing quality checks at every phase of the software development life cycle—starting from performing quality checks on application design prototypes, requirements, and so on, requires every team member to own testing for different quality aspects in collaboration. A few examples of how collaboration between team members has proven to work well while shifting left are: the developers and testers together design and implement the test strategy; analysts and testers together refine the quality of the requirements; analysts and designers refine the quality of the prototypes and so on. So building relevant testing skills to perform various quality checks is vital for all roles in a team to deliver high-quality software successfully.

Ten Full Stack Testing Skills

When we think of testing skills, we tend to consolidate them as two broad skills—manual and automated testing. But technology has evolved over many decades, and these broad terms mask the essential new skills that one has to learn to perform various quality checks and deliver high-quality software. Let’s break down these two monolith terms and look at the ten testing skills that will enable us to perform full stack testing efficiently! Figure 10-3 shows the ten full stack testing skills.

Ten full stack testing skills
Figure 1-3. Ten full stack testing skills

I will explain briefly what these ten skills are and why we should care to learn them:

Manual Exploratory Testing

Manual testing refers to the activity where someone verifies a given list of requirements. But manual exploratory testing is the ability to think/analyze different test cases beyond the given requirement list with the intention to break the system and find issues. For instance, the requirement states the application should give an error when it cannot create an order. The exploratory mindset is to think of all possible technical and business scenarios that will result in an error and how the error affects the integrating systems. This is the most preliminary skill to create a bug-free application.

Automated Functional Testing

In simple terms, this is the skill to write code to automate feature requirements and test cases discovered during exploratory testing. It includes the skill to strategize the automation approach and also the knowledge of various tools to automate web applications, APIs, and desktop applications in some cases. This is a core skill for shift-left testing, as we discussed earlier. It reduces the manual testing efforts significantly as the application grows with more features.

Continuous Testing

Continuous Delivery (CD) is a practice where features are delivered incrementally to customers in short cycles instead of a single big-bang release. CD allows businesses to see profits early and keep their customers engaged. To power CD, you have to build and test the application for each release continuously. The wise way is to automate and integrate tests with the CI pipelines and run them frequently to ease the release process. Continuous testing is the skill to integrate the tests to CI/ CD tools for delivering high-quality releases.

Data Testing

You may have heard the sayings, ‘data is money’ and ‘data is the new oil,’ which shows how important is testing for data quality. This skill is the knowledge about various types of databases, query languages, fundamentals about consistency models in distributed systems, and testing for data quality.

Cross-Functional Requirements (CFR) Testing

There are so many cross-functional requirements for any given application, such as availability, scalability, maintainability, observability, and so on. A common practice is to do a prioritization exercise to call out the critical ones and the nice to haves. Teams have to focus extensively on testing the CFR; failing to test for them will sometimes result in a massive business loss. (Data testing and the upcoming four are a few major items among the many CFR).

Visual Testing

The UI look and feel of the application is a major contributor to brand quality. It is essential to test the visual quality, especially for the B2C (business to customers) applications, such as Amazon, as it is directly exposed to millions of customers. The knowledge to strategize and execute the manual and automated tests for validating the UI look and feel of the application is included in the visual testing skill. It may seem like it overlaps with automated functional testing, but we will explore the stark differences in Chapter 7.

Security Testing

Even giants such as Facebook and Twitter have encountered security issues. Indeed, security bugs tend to be too costly in terms of legal penalties and brand reputation. Security testing is the skill to think like a hacker and attack the system to find issues early. We should also be able to automate security test cases and integrate them with CI pipelines for frequent feedback.

Performance Testing

Even a slight slack in web performance leads to a huge revenue and reputation loss for businesses—recall the Flipkart example. Performance testing is the skill to measure the key performance indicators at different application layers and automate and integrate performance tests in CI. Shifting performance testing left is the best path forward for software teams to avoid major performance mishaps. I’ll discuss this more in Chapter 9.

Accessibility Testing

Websites have become everyday commodities. Making the web accessible to everyone is not only mandated by legal regulations in many countries but also proves lucrative for businesses. The accessibility testing skill includes knowledge about recommended accessibility standards, various accessibility testing tools, and automating them to run as part of CI.

Mobile Testing and Automation

As per the data, there are more mobile consumers than desktop across the globe.3 So every product has a mobile variant these days, and learning to test mobile applications has become mandatory. Mobile testing skill encompasses the ability to strategize testing across multiple mobile platforms, test for mobile-specific CFR, and knowledge of tools to automate and integrate with CI pipelines.

The ten full stack testing skills will enable us to test for the holistic quality aspects of the application. As mentioned earlier, every role in the team has to upskill themselves to a varied degree of competency in each of these skills. The book dedicates one chapter for each skill, where we explore how to shift-left and also apply them at various layers of the application with practical examples.

Key Takeaways

Here are the key takeaways from this chapter:

  • Software quality cannot be equated to just bug-free software anymore. Quality dimensions have grown to include various facets like security, performance, etc.

  • To ensure high quality, we need to test for all the quality aspects.

  • Teams should focus on testing and development equally to deliver high-quality software.

  • For testing to be successful, it has to be practiced at the micro and macro levels of the application.

  • Shift-left testing calls for automation and CI/CD practices to build quality-in.

  • Shift-left testing embodies the aphorism “Quality is the team’s responsibility.”

  • All team members have to possess testing skills at a certain competency level.

  • The two monolith terms, manual and automation testing, mask a vast set of testing skills in them.

  • Full stack testing is to apply a set of ten different testing skills at different layers of the application individually and holistically while shifting testing to the left.

1 The Hindu: Technical glitches mar Flipkart’s ‘Big Billion Day’, thehindu.com, October 06, 2014

2 Scaled Agile Framework (SAFe): Built-in Quality, scaledagileframework.com, February 10, 2021

3 Statcounter GlobalStats: Mobile vs. Desktop usage, gs.statcounter.com

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.89.163.120