AI-generated unit tests for ABAP

Automation is becoming increasingly important in software development. The rapid development of artificial intelligence is opening up new opportunities to increase efficiency in development. 

Writing unit tests is a central step in quality assurance at Mercoline. A unit test consists of predefined values or algorithms that check the correct functioning of individual methods of a programme. The creation of these tests is time-consuming and has so far been almost impossible to automate - especially as writing creative scenarios requires specific expertise. With the growing capabilities of modern AI, we have now tested the potential of using it to generate unit tests. 

Our tool for AI-supported test data generation is presented in more detail below. 

Functionality

The AI-supported unit test generator works as follows: Developers select a specific class and method for which the AI automatically generates suitable test cases. The system analyses method signatures and the source code and generates test data for various scenarios. A user-friendly interface makes it easy to control and check the process. 

In addition, information on the business logic can be transmitted via a free text field, which the AI incorporates into the tests.

Testdaten-Erstellung über die Azure AI API

To generate the test data, we use the Azure AI API and the cost-effective GPT-4o-mini model, which delivers reliable results. Model parameters and the prompts used are configurable and are provided in various profiles so that they can be selected and customised depending on the application. 

Using a specially developed parsing framework, we transfer the method data to the AI and the generated unit tests are converted into ABAP objects. The tool also supports the storage of generated tests for later reuse. 

Verification and execution of the generated test data

The test data generated by the AI consists of input values and the expected outputs and is verified by the developers before it is ready for use. 
Once saved, data can be selected directly and executed via a test class to confirm its functionality. 

Conclusion

Mercoline's AI-supported unit test generator demonstrates the potential that AI can unfold in software development. This solution is particularly suitable for simple to moderately complex methods and represents a promising opportunity to expand automation in quality assurance. 

Wir beraten Sie gern!
Contact

+49 (0)711 49005 17 03 

Wir beraten Sie gern!
Contact

+49 (0)711 49005 17 03