{"id":15612170,"url":"https://github.com/serradura/microtest","last_synced_at":"2025-08-11T14:33:12.901Z","repository":{"id":138272290,"uuid":"153207357","full_name":"serradura/microtest","owner":"serradura","description":"Microtest - A xUnit family unit testing microframework for Ruby. (https://rubygems.org/gems/u-test)","archived":false,"fork":false,"pushed_at":"2019-01-18T11:57:13.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-29T15:12:34.494Z","etag":null,"topics":["ruby","test-framework","testing","testing-framework"],"latest_commit_sha":null,"homepage":"https://gist.github.com/serradura/d26f7f322977e35dd508c8c13a9179b1","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serradura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-16T01:59:29.000Z","updated_at":"2019-01-18T11:57:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a88b112-e4aa-4c99-a78e-fdf7599cddc8","html_url":"https://github.com/serradura/microtest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/serradura/microtest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Fmicrotest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Fmicrotest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Fmicrotest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Fmicrotest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serradura","download_url":"https://codeload.github.com/serradura/microtest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Fmicrotest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269903481,"owners_count":24493943,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ruby","test-framework","testing","testing-framework"],"created_at":"2024-10-03T06:22:07.443Z","updated_at":"2025-08-11T14:33:12.820Z","avatar_url":"https://github.com/serradura.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microtest\n\nA xUnit family unit testing microframework for Ruby.\n\n## Prerequisites\n\n\u003e Ruby \u003e= 2.2.2\n\n## Installation\n\nAdd this line to your application's Gemfile:\n```\ngem 'u-test'\n```\n\nAnd then execute:\n```\n$ bundle\n```\n\nOr install it yourself as:\n```\n$ gem install u-test\n```\n\n## How to use\n\n### 1) Create your awesome project\n```ruby\n# number.rb\nmodule Number\n  ALL = [\n    ONE = 1\n    TWO = 2\n  ]\nend\n```\n\n### 2) Create your test suite\n```ruby\n# test_number_one.rb\nclass TestNumberOne \u003c Microtest::Test\n  def test_with_assert_method\n    assert Number::ONE == Number::ONE\n  end\nend\n\n# test_number_two.rb\nclass TestNumberTwo \u003c Microtest::Test\n  def test_with_refute_method\n    refute Number::TWO == Number::ONE\n  end\nend\n\n# test_all_numbers.rb\nclass TestAllNumbers \u003c Microtest::Test\n  def test_all_numbers_constant\n    assert Number::ALL == [1, 2]\n  end\nend\n```\n\n### 3) Create the test runner\n```ruby\n# test_runner.rb\nrequire_relative 'number'\n\n# If you decided to embed the microtest code with your project (case of usage: a gist).\nrequire_relative 'microtest'\n# Or install and use it via rubygems (gem install 'u-test') and `require 'microtest'`.\n\nDir['test_number*.rb']\n  .reject { |file| file.include?(__FILE__.split('/').last) }\n  .each { |file| require_relative file }\n\nMicrotest.call\n```\n\n### 4) Run your tests\n```sh\nruby test_runner.rb\n```\n\n## Features\n\n### Hooks\n```ruby\nclass TestSomething \u003c Microtest::Test\n  def setup_all\n    # Runs once and before all tests.\n  end\n\n  def setup\n    # Runs before each test.\n    #   NOTE: you can receive the method in execution as the hook argument.\n    #   def setup(test_method)\n    #   end\n  end\n\n  def teardown\n    # Runs after each test.\n    #   NOTE: you can receive the method in execution as the hook argument.\n    #   def teardown(test_method)\n    #   end\n  end\n\n  def teardown_all\n    # Runs once and after all tests.\n  end\nend\n```\n\n### Declarative approach\n```ruby\nclass TestSomething \u003c Microtest::Test\n  test('a') { assert 1 == 1}\n\n  test 'b' do\n    assert 1 == 1\n  end\n\n  # The above examples are the same thing as:\n  # def test_a\n  #   assert 1 == 1\n  # end\nend\n```\n\n### Randomized execution\n\nUse a seed value if do you want a random execution.\n```sh\nSEED=1234 ruby test_runner.rb\n```\n\nOr enable it via `Microtest.call`. e.g:\n```ruby\nMicrotest.call randomized: true\n```\n\n## Running the tests\n\n```sh\n  rake test\n  # or\n  ruby test_runners.rb\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Fmicrotest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserradura%2Fmicrotest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Fmicrotest/lists"}