Sustainable Software Testing: 5 Strategies for a Greener and Efficient Tomorrow

Sustainable Software Testing: 5 Strategies for a Greener and Efficient Tomorrow

In an era where technological advancement is synonymous with progress & growth, the ecological footprint of software development is often ignored. 

  • A study by ShiftProject estimated that the information and communication technology (ICT) sector’s carbon footprint accounted for about 2–3% of global greenhouse gas emissions in 2018.

  • Projections by Bloomberg suggest that by 2030, IT systems will account for a staggering 20% of the global energy demand. To put this into perspective, the transportation industry currently represents 25% of the global energy consumption.

  • According to the International Energy Agency (IEA), data centres were responsible for about 200 terawatt-hours (TWh) of electricity consumption globally in 2018.

Green software development emerges as a beacon of responsibility, offering a paradigm shift towards eco-friendly practices that align with the urgent global call for sustainability. Beyond a mere buzzword, this approach calls for a commitment to resource efficiency, reduced energy consumption and a holistic consideration of environment in the software lifecycle. 

By optimising resource utilisation and energy requirements in software testing processes, organisations can reduce overall cost of testing. This can be a significant money saved especially for large-scale testing projects. As a byproduct, the testing process becomes more efficient and streamlined, enabling faster delivery cycles and shorter time-to-market.

The objective is simple- fine-tune Test Strategy and Automation Practices to save resources which in turn would save energy.


Here are 5 strategies to kick-off "Green QA" in your organisation today.

1. Make all Test Executions “Contextual”

  • Execute only those tests that are relevant in context of the code change. Avoid mindless executions; do not run every test on every environment. Refrain from large batches of test executions. This will reduce resource consumption and minimise energy usage.

  • Avoid scheduled executions like nightly, multiple times in a day etc. These executions consume too many resources and might not provide any value if the code deployed hasn’t change since last execution.

  • Isolate tests to ensure that each test suite or test case runs independently without affecting others. This prevents resource contention and improves the overall efficiency of parallel execution. Reduce inter-test dependencies to make it easier to execute tests concurrently without waiting for others to complete.

  • Leverage cloud platforms for test execution as they can dynamically allocate resources as needed. This can significantly contribute to energy efficiency.

  • Refactor & redesign CI and CD pipelines to incorporate above principles in various “test” stages.

These can be achieved by possibly moving to a trunk-based development and tagging the tests with requirements in the code (using annotations) and passing these annotations as parameters to the CI/CD pipelines.

2. Implement energy-efficient test automation (coding) practices

Energy (test execution) = Energy(active code) + Energy(waiting code) + Energy(idle code).

  • Containerize test automation framework and scripts. Containers provide a lightweight and isolated environment, making it easy to scale horizontally. They also reduce network traffic generated by code checkout and build process every time.

  • Minimize file I/O operations, especially in loops or frequent file access scenarios. Use buffered I/O operations to reduce the number of disk accesses. For example: reading test data from a file or reading configs from a file or pushing results to test management tool.

  • Learn to write optimized code which include dead code elimination, loop optimization, common subexpression elimination, etc. Also, analyse the performance characteristics of different algorithms and select the most appropriate ones for your specific use case.

  • Keep testing tools and libraries up to date to benefit from any performance improvements.

  • Release resources in the code promptly, especially in resource-constrained environments like mobile device or IoT device testing.

  • Minimize background processes, tasks and threads that can shoot up the CPU and memory utilization thereby increasing power consumption.

  • Adjust the level of detail in logging and reporting to avoid unnecessary resource consumption.

These can be achieved by documenting all above in Automation Guidelines document, socializing with quality engineers and covering them as probe areas during the Code-review process.

3. Optimise Test Environments

  • Have a clear test-to-environment mapping (define which tests should run on which environment and their cadence) to avoid redundant and overlapping test executions. 

  • Every environment should serve a unique purpose from testing point of view. Do not test everything everywhere.

  • Implement dynamic resource allocation to allocate resources based on the current testing demands. For example, resource requirements for running load tests will be very different from resource requirements for running API tests.

  • Tear-down test environment after use. For example, spin a dynamic environment, deploy the build, run the tests, record the evidence and then tear it down.

  • Leverage cloud-based testing services that are designed for efficiency and scalability. Cloud platforms often optimize resource usage and are more energy-efficient than traditional infrastructure.

  • Think how many environments are really required. Do you really need 2 or 3 environments and whats the justification. Many organizations these days are moving to 1 environment policy.

These can be achieved by consciously co-designing environment configs with SRE team, keeping Testing in mind and by introducing sustainability checks in Compliance Tests.

4. Set Sustainability OKRs in QA

Here are some example OKRs to start with:

Objective 1: Improve Software Test Execution Efficiency

  • Key Result 1: Achieve a 20% reduction in overall energy consumption for the test executions by optimizing code and infrastructure.

  • Key Result 2: Implement a way to monitor and report energy usage during the test executions, providing visibility into environmental impact.

  • Key Result 3: Conduct an audit and identify at least three areas for improvement in energy efficiency.

Objective 2: Minimize Resource Utilization during Test Execution

  • Key Result 1: Reduce server resource usage by 15% through the adoption of containerization and efficient resource allocation.

  • Key Result 2: Implement an automated system to track and manage resource consumption in real-time.

  • Key Result 3: Evaluate and adopt eco-friendly testing tool providers or services, considering renewable energy usage and resource efficiency.

Objective 3: Socialize Sustainable Testing Practices

  • Key Result 1: Train 100% of the testing team on sustainable coding practices and the importance of energy-efficient algorithms.

  • Key Result 2: Integrate sustainability considerations into the code review process, with a goal of catching and addressing at least 80% of energy-inefficient code.

  • Key Result 3: Implement a rewards system to recognize and celebrate developers who consistently contribute to sustainable coding practices.

Objective 4: Increase Stakeholder Awareness

  • Key Result 1: Develop and launch an awareness campaign with internal and external stakeholders highlighting the importance and need of sustainability.

  • Key Result 2: Publish a sustainability report, detailing the environmental impact of the testing and the steps taken to mitigate it.

  • Key Result 3: Engage with at least three external organizations or partners to collaborate on sustainability initiatives in software development.

These can be achieved by adopting Resource Monitoring tools as well as Energy Monitoring tools. Choose the best-fit from several options available in market.

5. Foster Energy-Aware Culture

  • Educate engineers and teams on Sustainability & Green Software Development practices and the need for it.

  • Promote a culture of defect prevention. Use principles of test pyramid, shift-left and other modern quality engg practices to ensure that defects are caught as early as possible. Every defect has a development cost as well as an environmental cost to fix.

  • Include Green QA Guidelines & Standards as part of the Test Strategy document.

  • Create a tradition of energy-efficient coding practices within your development team. Conduct regular reviews and retrospectives to identify opportunities for improving sustainability in the development process.

  • Establish a forum for knowledge sharing and collaboration on sustainable development practices.

  • Create "Sustainability Champions" in teams- people who are sustainability SMEs and flag-bearers of the cause and can educate and coach others as well.

  • Recognize and reward teams that consistently demonstrate a commitment to sustainable test automation development.

Meghna Arora

Quality Assurance Project Manager at IBM

5mo

Your #ISTQB certification journey starts here: www.processexam.com/istqb. 💡 #TestSuccess 🌐

Like
Reply
Mohit Mair

Quality Engg Evangelist | Green QA Practitioner

6mo

This article has been featured in https://softwaretestingweekly.com/issues/191

Ashish Maheshwari

Software Quality Engineer

6mo

Thank you for sharing these strategies. Time to debug code and strategy for more sustainable future

Rahul Verma

Quality Manager | Java | Python | Java Script | Protractor | Cucumber | Selenium | RestAssured | DevOps | Git | RPA

6mo

Nicely written and upto the point.👍

Sridhar Vuttarkar

Manager Quality Engineer at Publicis Sapient

7mo

Great article Mohit Mair! Very nicely written and informative for QEs. Kudos for your good thought process!

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics