Java reflection allows a program to inspect and manipulate program structure at run time and is a powerful mechanism used in many Java frameworks, including testing frameworks such as JUnit. However, reflection shifts key checks from compile time to run time and can introduce runner-level overhead; therefore, it is often desirable to avoid it when comparable functionality can be achieved with ordinary, statically checked mechanisms. In this paper, we present JNRTEST (Java no reflection Test), a Java testing framework built from scratch that avoids reflection, runtime annotations, and dynamic class loading. Instead, JNRTEST relies on object-oriented and functional programming mechanisms provided by modern Java: tests and lifecycle hooks are registered through explicit, typed APIs and executed directly by the runner, while integrations are implemented via an event-driven listener model. Overall, JNRTEST serves as a proof of concept that a practical Java testing framework can be built around a reflection-free core using ordinary, statically checked language mechanisms.
Implementing a Java testing framework from scratch without reflection / Bettini, Lorenzo. - In: JOURNAL OF OBJECT TECHNOLOGY. - ISSN 1660-1769. - ELETTRONICO. - 25:(2026), pp. 37-65. [10.5381/jot.2026.25.2.a2]
Implementing a Java testing framework from scratch without reflection
Bettini, Lorenzo
2026
Abstract
Java reflection allows a program to inspect and manipulate program structure at run time and is a powerful mechanism used in many Java frameworks, including testing frameworks such as JUnit. However, reflection shifts key checks from compile time to run time and can introduce runner-level overhead; therefore, it is often desirable to avoid it when comparable functionality can be achieved with ordinary, statically checked mechanisms. In this paper, we present JNRTEST (Java no reflection Test), a Java testing framework built from scratch that avoids reflection, runtime annotations, and dynamic class loading. Instead, JNRTEST relies on object-oriented and functional programming mechanisms provided by modern Java: tests and lifecycle hooks are registered through explicit, typed APIs and executed directly by the runner, while integrations are implemented via an event-driven listener model. Overall, JNRTEST serves as a proof of concept that a practical Java testing framework can be built around a reflection-free core using ordinary, statically checked language mechanisms.| File | Dimensione | Formato | |
|---|---|---|---|
|
Implementing a Java testing framework from scratch without reflection.pdf
accesso aperto
Tipologia:
Pdf editoriale (Version of record)
Licenza:
Open Access
Dimensione
1.23 MB
Formato
Adobe PDF
|
1.23 MB | Adobe PDF |
I documenti in FLORE sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.



