14 Sep

Unit test

Versino Financial Suite

A unit test is an automated test that tests a single functional unit of a program in isolation. Isolated means: without a database, without a network, without other parts of the program. The test calls a method or function with defined inputs and checks whether the result matches the expected value.

Good unit tests run automatically at the push of a button, independently of one another, and each test precisely one property. They are usually written alongside production code, sometimes even before it. This sequence is called test-driven development and forces the developer to think about the desired behaviour before implementation. The real benefit becomes apparent later: anyone refactoring a function immediately notices if they have broken something in the process. Without these tests, "broken" often remains undiscovered until the next customer call. A failing unit test should also immediately show which single function is affected, instead of sending the developer on a hunt for errors through the entire application. If such tests are missing, testing usually shifts to manual click testing by a human, which works somehow, but has to be repeated from scratch every single time.

Unit tests appear less frequently in SAP Business One development than in classical web development because a lot of logic is located in form events rather than in isolated functions.

Demarcation

A unit test checks a single unit in isolation. An integration test checks whether multiple units interact correctly, such as a function together with the real database. An end-to-end test goes even further and checks the complete workflow from the user's perspective, from the input form to the saved receipt. All three types of test complement each other. Anyone who only writes unit tests has many tested individual parts and still no guarantee that they work together. A clean set of all three levels nevertheless remains the exception, not the rule.


 

AI in everyday work: Person starts with their own task instead of the learning pile

AI in everyday work: Here's how to find the right start

Anyone who wants to use AI in their daily work is familiar with this: You read an article about prompts. A new model appears in it ...
AI-SHOP

AI assistant meets SAP Business One: Two paths out of the Versino AI shop

AI assistants like Claude or Copilot write emails, compile documents, and explain technical terms. But when you ask them about the open-source code...
SPRINT & SWIRL

Sprint and Swirl: How an AI agent divides work and learns from trials

This series deals with artificial intelligence in conjunction with SAP Business One. It takes a close look at fundamental AI principles...
LATS

LATS: Considering several paths simultaneously with AI — and the availability check in SAP B1

This series focuses on artificial intelligence in conjunction with SAP Business One. Not as a collection of product announcements, but as...
ReAct and RLEF

ReAct and RLEF: How Artificial Intelligence Learns from Real Mistakes — and What Automated Bank Reconciliation in SAP Business One Has to Do with It

This is the fourth instalment in a series on this blog dealing with AI fundamentals in conjunction with SAP Business One...
Service Layer AI as a transactional layer

SAP B1 10.0 FP2608: Service Layer AI as a transactional layer

The SAP Business One Service Layer has previously served predominantly as a passive data provider: applications requested data via OData, each ...
Wird geladen …