{"id":13772563,"url":"https://github.com/tesonep/ParametrizedTests","last_synced_at":"2025-05-11T04:31:35.775Z","repository":{"id":80273502,"uuid":"142874853","full_name":"tesonep/ParametrizedTests","owner":"tesonep","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-23T16:26:20.000Z","size":16,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T11:12:45.280Z","etag":null,"topics":["pharo","testing"],"latest_commit_sha":null,"homepage":null,"language":"Smalltalk","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/tesonep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2018-07-30T12:48:42.000Z","updated_at":"2024-11-26T18:24:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb9abd8a-876b-4a4b-b2a6-aad739485843","html_url":"https://github.com/tesonep/ParametrizedTests","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesonep%2FParametrizedTests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesonep%2FParametrizedTests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesonep%2FParametrizedTests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesonep%2FParametrizedTests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tesonep","download_url":"https://codeload.github.com/tesonep/ParametrizedTests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"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":["pharo","testing"],"created_at":"2024-08-03T17:01:05.432Z","updated_at":"2025-05-11T04:31:30.747Z","avatar_url":"https://github.com/tesonep.png","language":"Smalltalk","funding_links":[],"categories":["Testing"],"sub_categories":[],"readme":"This is an small implementation of parametrized tests for Pharo.\nIt allows to generate different test cases for each of the possible configurations in a matrix.\n\n# Installing\n\nTo use it, it should be installed in Pharo. To install it with Metacello execute\n\n```Smalltalk\n\n\tMetacello new\n\t  baseline: 'ParametrizedTests';\n\t  repository: 'github://tesonep/parametrizedTests';\n\t  load.\n\t\n```\n\n# Using\n\nOnce installed, there is a new subclass of *TestCase* called *ParametrizedTestCase*.\nThis is the class all the test cases using parametrized tests should use.\nIt extends the default *TestCase* with support for parametrized tests.\n\nA parametrized tests is a test that is run with different configurations.\nThese configurations are generated from a Matrix.\n\nTo Parametrized tests just extend this class as a normal tests, \nadd accessors for the properties to configure and implement the class side method #testParameters.\n\nWhen the test class is executed a TestSuite is generated with an instance for each of the configured cases. This instances are populated using the accessors to the described properties. \n\nThe class side method #testParameters returns a test matrix. \nThis test matrix can be generated with cartesian product configurations or a set of well known cases.\n\nAn example of #testParameters is: \n\n```Smalltalk\nMyTestCase class \u003e\u003e testParameters\n\n\t^ ParametrizedTestMatrix new\n\t\tforSelector: #option1 addOptions: #(a b c);\n\t\tforSelector: #option2 addOptions: {[1].[2].[3]};\n\t\tyourself.\n``` \n\nEach option is constituted from a set of possible values and a selector that is the name of the property to set in the test case instance.\n\nAlso each option can be a literal or a block to generate that value. The block has an optional parameter, the parameter is the test case to configure.\n\nIn this example the generated cases will be 9. One per each combination of #option1 and #option2. \nThe test Case should have a setter for \n\nCheck the Examples to see how to use the different possible configurations.\n\n# Examples\n\nThe API is quite simple, but there are two simple examples to show the use of generated matrix and set of cases.\nThe example class *PaSimpleMatrixExampleTest* shows an example of a matrix. \n\n```Smalltalk\nPaSimpleMatrixExampleTest class \u003e\u003e testParameters\n\n\t^ ParametrizedTestMatrix new\n\t\tforSelector: #item1 addOptions: { 1. 'a'. $c };\n\t\tforSelector: #item2 addOptions: { 2. 'b'. $d };\n\t\tforSelector: #collectionClass addOptions: \t{ Set. Bag. OrderedCollection }\n```\n\nThis example generates 81 different cases, with all the combinations. \n\nThe second example uses a set of given cases. This example is shown in the test class *PaSelectedCasesExampleTest*\n\n```Smalltalk\nPaSelectedCasesExampleTest class \u003e\u003e testParameters\n\n\t^ ParametrizedTestMatrix new\n\t\taddCase: { #number1 -\u003e 2. #number2 -\u003e 1.0. #result -\u003e 3 };\n\t\taddCase: { #number1 -\u003e (2/3). #number2 -\u003e (1/3). #result -\u003e 1 };\n\t\tyourself\n```\n\nThis example generates exactly the two cases listed in the test.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesonep%2FParametrizedTests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftesonep%2FParametrizedTests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesonep%2FParametrizedTests/lists"}