Recent developments in the capabilities of LLMs have made them a tool to consider in a wide variety of fields. This includes software development. Our teammate Nico explores how you can use LLMs to write accurate unit tests for cross-platform projects.
Effectiveness is key
The challenge with these kinds of projects is twofold: for tests to be effective, they have to be written and adapted independently of the application code. In the case of cross-platform projects, the effort needed to maintain the code thus grows by the number of languages required.
At the same time, software tests consist of a lot of fairly standardized code that requires little creativity to produce. Tasking humans with this may mean that a project needs lots of testers – a cost factor – and that these software developers are then asked to type up a lot of standardized code. Conversely, their expertise is missing when the project requires developers to solve complex and unique problems.
Writing software tests
Here is where ChatGPT and other LLMs can come in handy: they are well-suited to writing standardized code that is identical across different scenarios. Nico illustrates this by writing tests for an Angular app that collects user data from a public JSONPlaceholder API. The tests are written in Cyprus and Jasmine.
Finally, to show ChatGPT’s versatility when it comes to writing unit tests, Nico also shows how to write tests in additional frameworks for iOS and Android.
LLMs do not replace human ingenuity
The article also takes care to indicate the limits of using ChatGPT: A large language model (LLM) – or any other artificial intelligence (AI) – cannot replace human ingenuity, at least for the time being. Instead, it can supplement human ingenuity and free capacities without necessarily increasing costs. Thus, an LLM enables software developers to focus on those parts of the software development process that only humans can do: solving complex problems—and creating value.
Read the full article here (in German).
About Heise Developer
Heise Developer is a news website of Heise Medien that focuses on software engineering and related development methods and technologies. Together with Heise Online heise.de is the leading IT news portal in German-speaking countries. It also includes the media brands c't, iX, Make, Mac & i, Technology Review, and other print and online magazines.