{"id":19468960,"url":"https://github.com/ryanrosello-og/pict-pairwise-testing","last_synced_at":"2025-04-25T11:32:44.085Z","repository":{"id":48818427,"uuid":"369927588","full_name":"ryanrosello-og/pict-pairwise-testing","owner":"ryanrosello-og","description":"PICT pairwise testing for nodejs","archived":false,"fork":false,"pushed_at":"2021-07-10T05:17:00.000Z","size":869,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T07:52:59.667Z","etag":null,"topics":["automation","javascript","pairwise","pairwise-testing","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ryanrosello-og.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}},"created_at":"2021-05-22T23:56:45.000Z","updated_at":"2024-12-02T11:12:42.000Z","dependencies_parsed_at":"2022-09-26T20:10:54.253Z","dependency_job_id":null,"html_url":"https://github.com/ryanrosello-og/pict-pairwise-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanrosello-og%2Fpict-pairwise-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanrosello-og%2Fpict-pairwise-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanrosello-og%2Fpict-pairwise-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanrosello-og%2Fpict-pairwise-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanrosello-og","download_url":"https://codeload.github.com/ryanrosello-og/pict-pairwise-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250808389,"owners_count":21490657,"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":["automation","javascript","pairwise","pairwise-testing","testing"],"created_at":"2024-11-10T18:45:11.565Z","updated_at":"2025-04-25T11:32:43.585Z","avatar_url":"https://github.com/ryanrosello-og.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔬 pict-pairwise-testing\n\n![tests](https://github.com/ryanrosello-og/pict-pairwise-testing/actions/workflows/run_tests.yml/badge.svg)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ryanrosello-og/pict-pairwise-testing/blob/main/LICENSE)\n\nA simple Nodejs wrapper for PICT, this brings the goodness of pairwise (aka all pairs) testing into the Javascript world. All models can be defined using either a simple JSON structure, inline text, or file-based models are also supported. The generated set of test cases will be in an easy to consume JSON array.\n\nFor a full overview of capabilities of PICT, visit [Microsoft's gitub repo](https://github.com/Microsoft/pict/blob/main/doc/pict.md) or [PICT's detailed documentation](https://github.com/Microsoft/pict/blob/main/doc/pict.md)\n\n# Installing\n\n`npm install pict-pairwise-testing`\n\n# Basic Usage\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\n\n// model for a fictitious mortgage calculator application\nconst model = {\n  parameters: [\n    { property: 'Principal', values: [300000, 350000, 4000000] },\n    { property: 'Number of years', values: [20, 21, 22, 23, 24] },\n    { property: 'Repayment type', values: ['Interest only 1 year', 'Interest only 2 years'] },\n    { property: 'Interest Rate', values: [1, 1, 99, 2.99, 3.5, 4] }\n  ],\n};\n\nlet result = pict(model);\n\nconsole.log('Generated test cases', result.testCases)\n```\n\nPict will then generate the following test cases:\n\n```javascript\n[\n  {\n    principal: '350000',\n    number_of_years: '23',\n    repayment_type: 'Interest only 1 year',\n    interest_rate: '1'\n  },\n  {\n    principal: '300000',\n    number_of_years: '21',\n    repayment_type: 'Interest only 2 years',\n    interest_rate: '99'\n  },\n  {\n    principal: '4000000',\n    number_of_years: '21',\n    repayment_type: 'Interest only 1 year',\n    interest_rate: '1'\n  },\n  ...\n  ...\n  ...\n  {\n    principal: '4000000',\n    number_of_years: '23',\n    repayment_type: 'Interest only 2 years',\n    interest_rate: '3.5'\n  },\n  {\n    principal: '300000',\n    number_of_years: '22',\n    repayment_type: 'Interest only 2 years',\n    interest_rate: '1'\n  }\n]\n```\nInline text models are also supported, this can be achieved by defining the model as follows:\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\n\nconst model = `\n          Principal: 300000,350000,4000000\n          Number of years: 20,21,22,23,24\n          Repayment type: Interest only 1 year,Interest only 2 years\n          Interest Rate: 1,1,99,2.99,3.5,4\n`\n\nlet result = pict(model);\n\nconsole.log('Generated test cases', result.testCases)\n```\n\nYou can even use old school PICT model file by using the package like so:\n\n*my_model.pict*\n```text\nPrincipal: 300000,350000,4000000\nNumber of years: 20,21,22,23,24\nRepayment type: Interest only 1 year,Interest only 2 years\nInterest Rate: 1,1,99,2.99,3.5,4\n```\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\nconst __dirname = path.resolve(path.dirname(''));\nconst modelFile = path.resolve(__dirname, 'fixtures/my_model.model');\n\nlet results = pict(modelFile);\nconsole.log('Generated test cases', result.testCases)\n```\n\n# Supported cli parameters\n\nThe following set of command-line options are supported:\n| key                             | mapped to PICT option | description                          |\n|---------------------------------|-----------------------|--------------------------------------|\n| order_of_combinations           | /o:N                  | - Order of combinations (default: 2) |\n| randomize_generation            | /r[:N]                | - Randomize generation, N - seed     |\n| case_sensitive_model_evaluation | /c                    | - Case-sensitive model evaluation    |\n| show_model_statistics           | /s                    | - Show model statistics              |\n\nCLI parameters can be invoked by passing an option object into PICT:\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\n\nconst model = {\n  parameters: [\n    { property: 'Status', values: ['Open', 'Closed'] },\n    { property: 'Threshold', values: [10, 100, 500] },\n    { property: 'Approved', values: ['yes', 'no'] },\n  ],\n};\n\nlet result = pict(model, {\n  options: { randomize_generation: 10, order_of_combinations: 1 },\n});\n```\n\nThe `show_model_statistics` option can be used to preview model statistics derived by PICT:\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\n\nconst model = {\n  parameters: [\n    { property: 'Status', values: ['Open', 'Closed'] },\n    { property: 'Threshold', values: [10, 100, 500] },\n    { property: 'Approved', values: ['yes', 'no'] },\n  ],\n};\n\nlet result = pict(model, {\n  options: { show_model_statistics: true }\n});\n\nconsole.log(result.statistics)\n```\n\nThis yields\n```javascript\n{\n  combinations: 16,\n  generated_tests: 6,\n}\n```\n\n# Unsupported cli parameters\n\n- separator_for_values:  /d:C    - Separator for values  (default: ,)\n- separator_for_aliases: /a:C    - Separator for aliases (default: |)\n- negative_value_prefix: /n:C    - Negative value prefix (default: ~)\n\n# Constraints example\n\nConstraints can be defined by passing a constraints array into the model, for example:\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\nconst modelWithConstraints = {\n  parameters: [\n    { property: 'Size', values: [10, 100, 500, 1000, 5000, 10000, 40000] },\n    { property: 'Format method', values: ['quick', 'slow'] },\n    { property: 'File system', values: ['FAT', 'FAT32', 'NTFS'] },\n    {\n      property: 'Cluster size',\n      values: [512, 1024, 2048, 4096, 8192, 16384, 32768, 65536],\n    },\n    { property: 'Compression', values: ['on', 'off'] },\n  ],\n  constraints: [\n    'IF [File system] = \"FAT\"   THEN [Size] \u003c= 4096;',\n    'IF [File system] = \"FAT32\" THEN [Size] \u003c= 32000;',\n  ],\n};\n\nlet result = pict(modelWithConstraints);\n```\n\n# Sub-models\n\nSub-models can be defined by passing a submodels array into the model, for example:\n\n```javascript\nconst pict = require('pict-pairwise-testing').pict\nconst modelWithSubmodel = {\n  parameters: [\n    { property: 'PLATFORM', values: ['x86', 'x64', 'arm'] },\n    { property: 'CPUS', values: [1, 2, 4] },\n    { property: 'RAM', values: ['1GB', '4GB', '64GB'] },\n    { property: 'HDD', values: ['SCSI', 'IDE'] },\n    { property: 'OS', values: ['Win7', 'Win8', 'Win10'] },\n    { property: 'Browser', values: ['Edge', 'Opera', 'Chrome', 'Firefox'] },\n    { property: 'APP', values: ['Word', 'Excel', 'Powerpoint'] },\n  ],\n  submodels: ['{ PLATFORM, CPUS, RAM, HDD } @ 3', '{ OS, Browser } @ 2'],\n};\n\nlet result = pict(modelWithSubmodel);\n```\n\n# Credits\n\nThere is nothing special about this package. All its doing is parsing the JSON pict model into text model which PICT can understand. PICT then performs the necessary heavy lifting to generate the test cases. Under the hood, this package fully relies on the PICT executable from [Microsoft's gitub repo](https://github.com/Microsoft/pict/blob/main/doc/pict.md)\n\n# License\n\n[MIT][mit]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanrosello-og%2Fpict-pairwise-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanrosello-og%2Fpict-pairwise-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanrosello-og%2Fpict-pairwise-testing/lists"}