When you write unit-tests it's good practice to use the AAA-principle. It is derived from the initial letters of following actions:
Arrange
Initialize all data needed to execute the test.
Here you create all variables and load data from external resources.
Act
Execute the test
The execution of the test should only consist of a single line: the call of the function you want to test.
Assert
Compare the result with the expected value.
At last an assert-statement of the test-framework is called on the expected value and the result of the function under test. In JUnit it is called assertEquals or assertTrue, but also other options for verification are available.
You should only use one assert-statement in each testfunction, because a failing assertion stops execution and no other line of code will be executed. In that case it can be difficult to localize the origin of a failed test.
Settings for privacy
This page uses cookies to save the user's privacy-settings. We do not have a stake in how linked pages analyze, process or save data. Since, we only show such content after the agreement of the user.
This applies to sharing-functions of social-media-content like twitter or facebook and embedded videos of youtube.
Einstellungen für Datenschutz
Diese Seite verwendet Cookies, um die Datenschutzeinstellungen des Benutzers zu speichern. Wir haben keinen Einfluss darauf, welche Daten verlinkte Seiten analysieren, verarbeiten oder speichern. Aus diesem Grund werden solche Inhalte nur nach vorheriger Einwilligung des Benutzers angezeigt.
Dies betrifft Funktionen für das Teilen von Inhalten auf sozialen Medien (Twitter und Facebook) sowie eingebundene Videos von youtube.