{"id":13675933,"url":"https://github.com/becheran/ntest","last_synced_at":"2025-05-16T03:03:31.353Z","repository":{"id":36891553,"uuid":"230762522","full_name":"becheran/ntest","owner":"becheran","description":"Testing framework for rust enhancing the built-in library with some useful features.","archived":false,"fork":false,"pushed_at":"2025-04-24T07:06:24.000Z","size":145,"stargazers_count":63,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-24T08:23:28.037Z","etag":null,"topics":["assert","library","rust","rust-lang","test-cases","testing","timeout"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/becheran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2019-12-29T14:37:24.000Z","updated_at":"2025-04-24T07:06:28.000Z","dependencies_parsed_at":"2025-03-03T01:00:26.624Z","dependency_job_id":"0b19e9ae-0ce2-47b7-a0ae-17e72771d132","html_url":"https://github.com/becheran/ntest","commit_stats":{"total_commits":131,"total_committers":9,"mean_commits":"14.555555555555555","dds":0.5572519083969465,"last_synced_commit":"caca65cfc6f35497e8cddf3617043552724da23f"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becheran%2Fntest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becheran%2Fntest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becheran%2Fntest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becheran%2Fntest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/becheran","download_url":"https://codeload.github.com/becheran/ntest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459083,"owners_count":22074604,"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":["assert","library","rust","rust-lang","test-cases","testing","timeout"],"created_at":"2024-08-02T12:01:06.126Z","updated_at":"2025-05-16T03:03:26.342Z","avatar_url":"https://github.com/becheran.png","language":"Rust","funding_links":[],"categories":["Crates"],"sub_categories":["Extensions"],"readme":"# NTest\n\n[![docs](https://docs.rs/ntest/badge.svg)](https://docs.rs/ntest)\n[![crates](https://img.shields.io/badge/crates.io-ntest-orange)](https://crates.io/crates/ntest)\n[![downloads](https://badgen.net/crates/d/ntest)](https://crates.io/crates/ntest)\n[![build status](https://github.com/becheran/ntest/actions/workflows/ci.yml/badge.svg)](https://github.com/becheran/ntest/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTesting framework for rust which enhances the built-in library with some useful features. Inspired by the *.Net* unit-testing framework [NUnit](https://github.com/nunit/nunit).\n\n## Getting Started\n\nSome functions of *NTest* use [procedural macros](https://doc.rust-lang.org/reference/procedural-macros.html) which are stable for rust edition 2018.\nIf you use the library make sure that you are using the *2018 version* of rust. Update the *Cargo.toml* file:\n\n```toml\n[package]\nedition = \"2018\"\n# ..\n```\n\nAdd the *NTest library* to your developer dependencies in the *Cargo.toml* file:\n\n```toml\n[dev-dependencies]\nntest = \"*\"\n```\n\n## Content\n\n- `#[timeout()]` Attribute used for timeouts in tests.\n- `#[test_case()]` Attribute used to define multiple test cases for a test function.\n- `assert_about_equal!()` Compare two floating point values or vectors for equality.\n- `assert_false!()` Expects false argument for test case.\n- `assert_true!()` Expects true argument for test case.\n- `assert_panics!()` Expects block to panic. Otherwise the test fails.\n\nFor more information read the [documentation](https://docs.rs/ntest/).\n\n## Examples\n\n### Create test cases\n\n```rust\nuse ntest::test_case;\n\n#[test_case(\"https://doc.rust-lang.org.html\")]\n#[test_case(\"http://www.website.php\", name=\"important_test\")]\nfn test_http_link_types(link: \u0026str) {\n    test_link(link, \u0026LinkType::HTTP);\n}\n```\n\n### Timeout for long running functions\n\n```rust\nuse ntest::timeout;\n\n#[test]\n#[timeout(10)]\n#[should_panic]\nfn timeout() {\n    loop {};\n}\n```\n\n### Combine attributes\n\n```rust\nuse std::{thread, time};\nuse ntest::timeout;\nuse ntest::test_case;\n\n#[test_case(200)]\n#[timeout(100)]\n#[should_panic]\n#[test_case(10)]\n#[timeout(100)]\nfn test_function(i : u32) {\n    let sleep_time = time::Duration::from_millis(i);\n    thread::sleep(sleep_time);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecheran%2Fntest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecheran%2Fntest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecheran%2Fntest/lists"}