Skip to main content

Generative AI and software testing: Here’s what our experiments with generative AI and software testing found

Amid the cacophony of noise about generative AI and software development, we haven’t seen much thoughtful discussion about software testing specifically. We’ve been experimenting with ChatGPT’s test writing capabilities and wanted to share our findings. In short: we conclude that ChatGPT is only somewhat useful for writing tests today, but we expect that to change dramatically in the next few years and developers should be thinking now about how to future-proof their careers.

We’re the cofounders of CodeCov, a company acquired by Sentry that specializes in code coverage, so we’re no strangers to testing. For the past two months, we’ve been exploring the ability of ChatGPT and other generative AI tools to write unit tests. Our exploration primarily involved providing ChatGPT with coverage information for a particular function or class and code for that class. We then prompted ChatGPT to write unit tests for any part of the provided code that was uncovered, and determined whether or not the generated tests successfully exercised the uncovered lines of code.

We’ve found that ChatGPT can reliably handle 30-50% of test writing currently, though the tests it handles well are primarily the easier tests, or those that test trivial functions and relatively straightforward code paths. This suggests that ChatGPT is of limited use for test writing today, since organizations with any amount of testing culture will typically have written their most straightforward tests already. Where generative AI will be most helpful in future is in correctly testing more complex code paths, allowing developer time and attention to be diverted to more challenging problems.

However, we already have seen improvements in the quality of test generation, and we expect this trend to continue in the coming years. First, very large, tech-forward organizations like Netflix, Google, and Microsoft are likely to build models for internal use trained on their own systems and libraries. This should allow them to achieve substantially better results, and the economics are too compelling for them not to do so. Given the rapid rates of improvement that we’re seeing from generative AI programs, a well trained LLM could be writing a large portion of these companies’  software tests in the near future.

Further out, in the next three to five years, we anticipate that all organizations will be impacted. The companies developing generative AI tools – whether Scale AI, Google, Microsoft, or someone else – will train models to better understand code, and once AI is smart enough to understand the structure of code and how it executes, there is no reason that future-gen AI tools won’t be able to handle all unit testing. (Google had an announcement along these lines just last month). In addition, Microsoft’s ownership of GitHub gives them an enormous platform to distribute AI coding tools to millions of software developers easily, meaning large-scale adoption can happen very quickly. 

Whether the world will be ready for fully automated testing is another question. Much like self-driving cars, we expect that AI will be able to write 100% of code before humans are 100% ready to trust it. In other words, even when AI can handle all unit testing, organizations will still want humans as a backstop to review any code that AI has written, and may still prefer human-authored tests for the most critical code paths.  Additionally, developers will still want metrics like code coverage to demonstrate the veracity of an AI’s efforts. Trust may take a long time to build.

 

Looking further out, AI may redefine how we approach software testing in its entirety. Rather than generating and executing automated tests, the testing framework may be the AI itself. It’s not out of the question that a sufficiently advanced and trained AI with access to enough computing resources could simply exercise all code paths for us, return any executions that fail and recommend fixes for those failing paths, or just automatically correct them in the course of analyzing and executing the code. This could obviate the need for software testing in the traditional sense altogether.  

In any event, it’s likely that in the coming years AI will be able to do much of the work that developers do today, testing included. This could be bad news for junior engineers, but it remains to be seen how this will play out. We can also imagine a scenario in which “AI + junior engineers” could do the work of a mid-level engineer at lower cost, so it’s unclear who will be most affected.

Whatever the case, it’s important to experiment with these tools now if you’re not doing so already. Ideally, your organization is already providing opportunities to test generative AI tools and determine how they can make teams productive and efficient, now or in the near future. Every company should be doing this. If that’s not the case where you work, then you should still be experimenting with your own code on your own time.

One way to think about the role AI will fill is to think of it as a junior developer. If you want to stay “above the algorithm” and have a continuing role alongside AI, pay attention to where junior developers tend to fail today, because that’s where humans will be needed. 

The ability to review code will always be important. Instead of writing code, think of your role as a reviewer or mentor, the person who supervises the AI and helps it to improve. But whatever you do, don’t ignore it, because it’s clear to us that change is coming and our roles are all going to shift.

The post Generative AI and software testing: Here’s what our experiments with generative AI and software testing found appeared first on SD Times.



from SD Times https://ift.tt/zneI7fK

Comments

Popular posts from this blog

Difference between Web Designer and Web Developer Neeraj Mishra The Crazy Programmer

Have you ever wondered about the distinctions between web developers’ and web designers’ duties and obligations? You’re not alone! Many people have trouble distinguishing between these two. Although they collaborate to publish new websites on the internet, web developers and web designers play very different roles. To put these job possibilities into perspective, consider the construction of a house. To create a vision for the house, including the visual components, the space planning and layout, the materials, and the overall appearance and sense of the space, you need an architect. That said, to translate an idea into a building, you need construction professionals to take those architectural drawings and put them into practice. Image Source In a similar vein, web development and design work together to create websites. Let’s examine the major responsibilities and distinctions between web developers and web designers. Let’s get going, shall we? What Does a Web Designer Do?

A guide to data integration tools

CData Software is a leader in data access and connectivity solutions. It specializes in the development of data drivers and data access technologies for real-time access to online or on-premise applications, databases and web APIs. The company is focused on bringing data connectivity capabilities natively into tools organizations already use. It also features ETL/ELT solutions, enterprise connectors, and data visualization. Matillion ’s data transformation software empowers customers to extract data from a wide number of sources, load it into their chosen cloud data warehouse (CDW) and transform that data from its siloed source state, into analytics-ready insights – prepared for advanced analytics, machine learning, and artificial intelligence use cases. Only Matillion is purpose-built for Snowflake, Amazon Redshift, Google BigQuery, and Microsoft Azure, enabling businesses to achieve new levels of simplicity, speed, scale, and savings. Trusted by companies of all sizes to meet

2022: The year of hybrid work

Remote work was once considered a luxury to many, but in 2020, it became a necessity for a large portion of the workforce, as the scary and unknown COVID-19 virus sickened and even took the lives of so many people around the world.  Some workers were able to thrive in a remote setting, while others felt isolated and struggled to keep up a balance between their work and home lives. Last year saw the availability of life-saving vaccines, so companies were able to start having the conversation about what to do next. Should they keep everyone remote? Should they go back to working in the office full time? Or should they do something in between? Enter hybrid work, which offers a mix of the two. A Fall 2021 study conducted by Google revealed that over 75% of survey respondents expect hybrid work to become a standard practice within their organization within the next three years.  Thus, two years after the world abruptly shifted to widespread adoption of remote work, we are declaring 20