{"id":17358764,"url":"https://github.com/tvd12/test-util","last_synced_at":"2025-04-15T00:43:20.547Z","repository":{"id":7941035,"uuid":"56928692","full_name":"tvd12/test-util","owner":"tvd12","description":"A java test utilities library, it supports assertion, random, performance and reflections test","archived":false,"fork":false,"pushed_at":"2023-06-06T01:03:39.000Z","size":289,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T00:43:11.612Z","etag":null,"topics":["assertions","java-test","performance-testing","random-test","test","test-utilities","test-utils","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tvd12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-04-23T16:17:25.000Z","updated_at":"2024-10-24T08:44:32.000Z","dependencies_parsed_at":"2022-08-06T20:15:22.374Z","dependency_job_id":"a4547707-441f-4f1d-a708-5feb754f568b","html_url":"https://github.com/tvd12/test-util","commit_stats":null,"previous_names":["tavandung12/test-util"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvd12%2Ftest-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvd12%2Ftest-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvd12%2Ftest-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvd12%2Ftest-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tvd12","download_url":"https://codeload.github.com/tvd12/test-util/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986271,"owners_count":21194024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertions","java-test","performance-testing","random-test","test","test-utilities","test-utils","testing"],"created_at":"2024-10-15T19:06:59.468Z","updated_at":"2025-04-15T00:43:20.517Z","avatar_url":"https://github.com/tvd12.png","language":"Java","readme":"[![Build Status](https://travis-ci.org/tvd12/test-util.svg?branch=master)](https://travis-ci.org/tvd12/test-util)\n[![Dependency Status](https://www.versioneye.com/user/projects/5717990efcd19a00415b1f61/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5717990efcd19a00415b1f61)\n[![Coverage Status](https://coveralls.io/repos/github/tvd12/test-util/badge.svg?branch=master)](https://coveralls.io/github/tvd12/test-util?branch=master)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.tvd12/test-util/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.tvd12/test-util)\n[![Javadocs](https://www.javadoc.io/badge/com.tvd12/test-util.svg)](https://www.javadoc.io/doc/com.tvd12/test-util)\n\n# Synopsis \u003cimg src=\"https://github.com/tvd12/test-util/blob/master/logo.png\" width=\"64\" /\u003e\n\nThis project support for: \n- testing private, protected, package access and public method\n- testing script performance\n\n# Documentation\n\n[https://youngmonkeys.org/projects/test-utilities](https://youngmonkeys.org/projects/test-utilities)\n\n# Code Example\n\n**1. Test script performance**\n\n```java\nlong time = Performance.create()\n\t.threadCount(100) // set 0 if you want to run in sync mode\n\t.loop(1000000000) // optional, default 1000000\n\t.test(() -\u003e System.out.println(\"Hello World\"))\n\t.getTime();\n```\n\n**2. Assertion**\n\n```java\nAsserts.assertEquals(expected, actual);\n\nAsserts.assertThat(actual).isEqualsTo(expected);\n\nAsserts.assertThat(future).isEqualsTo(expected);\n```\n\n**3. Random**\n\n```java\nRandomUtil.randomSmallInt();\n\nRandomUtil.randomShortAlphabetString();\n\nRandomUtil.randomMap(size, int.class, String.class);\n```\n\n**4. Get method by name**\n\n```java\n// with no arguments\nMethod nothing = MethodUtil.getMethod(\"nothing\", ClassA.class);\n\n// with one argument (Integer)\nMethod add = MethodUtil.getMethod(\"add\", ClassA.class, Integer.class);\n```\n\n**5. Invoke method**\n\n```java\n// invoke method\nInteger result = MethodUtil.invokeMethod(add, new ClassA(), new Integer(1));\n\n//invoke method by name\nInteger result = MethodUtil.invokeMethod(\"add\", new ClassA(), new Integer(1));\n\n// invoke static method by name\nMethodUtil.invokeStaticMethod(\"hello\", ClassA.class, \"tvd12.com\");\n\n// use builder syntax\nInteger result = MethodInvoker.create()\n        .method(\"add\")\n        .param(new Integer(1))\n        .object(new ClassA())\n        .invoke(Integer.class);\n```\n\n# Motivation\n\nBecause sometimes we want to call private, protected, package access and public method,\nwe need test performance to our script and export result to file\nso, we need create a library to support them\n\n# Installation\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.tvd12\u003c/groupId\u003e\n\t\u003cartifactId\u003etest-util\u003c/artifactId\u003e\n\t\u003cversion\u003e1.1.7\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nYou need create file `AllTests.tng.xml` in your `src/test/resources` folder with content, example:\n\n```xml\n\u003c!DOCTYPE suite SYSTEM \"http://testng.org/testng-1.0.dtd\"\u003e\n\u003csuite name=\"All-Test\"\u003e\n    \u003ctest name=\"All\"\u003e\n    \t\u003cpackages\u003e\n    \t\t\u003cpackage name=\"your_test_package\"/\u003e\n    \t\u003c/packages\u003e\n    \u003c/test\u003e\n\u003c/suite\u003e\n```\n\n### Gradle\n\n```groovy\ntestImplementation 'com.tvd12:test-util:1.1.7'\n```\n\n# API Reference\n\nhttp://www.javadoc.io/doc/com.tvd12/test-util\n\n# Tests\n\nmvn test\n\n# Contact us\n\n- Touch us on [Facebook](https://www.facebook.com/youngmonkeys.org)\n- Ask us on [stackask.com](https://stackask.com)\n- Email to me [Dzung](mailto:itprono3@gmail.com)\n\n# License\n\n- Apache License, Version 2.0\n\t\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvd12%2Ftest-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftvd12%2Ftest-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvd12%2Ftest-util/lists"}