GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - foiovituh/uva-tester: Java library for unit testing πŸ‡

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src/main/java/com/github/foiovituh/uvatester
src/main/java/com/github/foiovituh/uvatester
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

πŸ‡ UVATester

GitHub License GitHub Release

A Java library that uses annotations and reflection to discover and execute custom unit tests.

logo

Note: UVATester is my own implementation of a unit testing library, built from scratch as a study project to explore Java annotations and reflection. Although fully functional, it is intended for educational purposes rather than as a production-ready alternative to established frameworks such as JUnit.

πŸ“¦ Installation

Add the JitPack repository and the dependency to your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.foiovituh</groupId>
        <artifactId>uva-tester</artifactId>
        <version>v1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

πŸ”— Requirements

Required:

  • Java
  • Maven

Optional:

  • JitPack

πŸ’‘ How It Works

UVATester loads a test class using Java reflection and verifies that it is annotated with @TestClass.

It then discovers every method annotated with @TestMethod that is public, static, returns void, and accepts no arguments. Each compatible method is invoked automatically.

If the test class is invalid or a test throws an exception during execution, UVATester logs the error and terminates the execution.

πŸš€ Usage

Create a test class

Annotate the class with @TestClass and every test method with @TestMethod.

Each test method must:

  • be annotated with @TestMethod
  • be public
  • be static
  • return void
  • receive no arguments

Example:

@TestClass
public class CalculatorTests {

    @TestMethod
    public static void sumShouldReturnFour() {
        int result = 2 + 2;

        Feedback.showResult(
            "sumShouldReturnFour",
            result == 4 ? "PASS" : "FAIL"
        );
    }

}

Run the tests

Instantiate UVATester with the fully qualified name of the test class and call run().

public class Main {

    public static void main(String[] args) {
        new UVATester(
            CalculatorTests.class.getName()
        ).run();
    }

}

Example output:

sumShouldReturnFour => PASS

Assertions

The Assertor class provides reusable validation methods that can simplify assertions inside your test methods.

Example:

boolean validAge = Assertor.isWithinRange(age, 18, 65);

Feedback.showResult(
    "validAge",
    validAge ? "PASS" : "FAIL"
);

⚠️ Limitations

Current limitations include:

  • Test methods must be public static void and receive no arguments.
  • Tests are executed sequentially.
  • Execution stops immediately if a test throws an exception.

πŸ—ΊοΈ Roadmap

  • Add more assertion methods
  • Continue executing tests after failures

⭐ Support the Project

If you like this project or find it useful, please give it a star! It helps increase its visibility and supports future development.

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.

About

Java library for unit testing πŸ‡

Topics

javajava-annotationsjava-librarymaventestingunit-testingunit-testsuvauva-testeruvatester

Resources

Readme
MIT license

Code of conduct

Code of conduct

Security policy

Security policy
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.