Giter VIP home page Giter VIP logo

one-wise's Introduction

one-wise

One-wise combinatorial testing generator

npm version Build Status Coverage Status

A 1-wise (a.k.a. 1-way) testing generator guarantees that at least one value of each group appears in the generated tests. The produced array has exactly the length of the largest input array.

About

This is a fast and simple implementation of a 1-wise testing generator. No external dependencies. Uses semantic versioning.

Install

npm install one-wise

Example

oneWise( {
    "foo": [ "x", "y" ],
    "bar": [ "a", "b", "c", "d" ],
    "baz": [ "f", "g" ]
} )

will return

[
   { "foo": "x", "bar": "a", "baz": "f" },
   { "foo": "y", "bar": "b", "baz": "g" },
   { "foo": "x", "bar": "c", "baz": "f" },
   { "foo": "y", "bar": "d", "baz": "g" }
]

Note: the values of foo and bar in the last two lines are picked randomly.

It uses JavaScript's Math.random(), but a predictive pseudo-random generator function (e.g., seedrandom) can be passed as a second argument. Such function must work like Math.random() and return a number >= 0 and < 1.

oneWise( /* your object */, myPseudoRandomNumberGenerator );

Declaration

Browser

<script crossorigin src="https://unpkg.com/one-wise" ></script>
<script>
console.log(
	oneWise( {
		"foo": [ "x", "y" ],
		"bar": [ 1, 2, 3 ]
	} )
);
</script>

Option 2: Using unpkg and ESM:

<script crossorigin src="https://unpkg.com/one-wise/index.esm.js" ></script>
<script>
import oneWise from 'one-wise';
</script>

CommonJS (NodeJS)

const oneWise = require('one-wise');

ESM/TypeScript

import oneWise from 'one-wise';

API

oneWise( obj [, prngFunc ] )

  • obj {object} - The given object.
  • prngFunc {function} - Pseudo-random number generator function used to pick array elements to repeat. Defaults to Math.random.

See also

License

MIT © Thiago Delgado Pinto

one-wise's People

Contributors

greenkeeper[bot] avatar thiagodp avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

one-wise's Issues

Generates too few pairs

When using following data:

const pairwiseConfiguration = {
    flow: ['1 to 1'],
    doctor_browser: [
        'linux-chrome-stable',
        'beta',
        'unstable'
    ],
    doctor_network: [
        'WifiHighPacketLoss',
        '3GPoor',
        'DSL',
        'Regular 4G'
    ],
    doctor_firewall: [
        'FW_NO_FW'
    ],
    doctor_location: [
        'East-US',
        'West-US',
        'Central US',
    ],
    doctor_media: [
        'Salsa-720p.mp4',
        '1080p',
        'VGA'
    ],
    patient_browser: [
        'linux-chrome-stable',
        'beta',
        'unstable'
    ],
    patient_network: [
        'WifiHighPacketLoss',
        '3GPoor',
        'DSL',
        'Regular 4G'
    ],
    patient_firewall: [
        'FW_NO_FW'
    ],
    patient_location: [
        'East-US',
        'West-US',
        'Central US',
    ],
    patient_media: [
        'Salsa-720p.mp4',
        '1080p',
        'VGA'
    ]
};

I getting only 4 combinations as result. Which is pretty low, since total number of combinations is 11664

I tried to debug with another tool, and it shows much more combinations (more than 30)
https://sqamate.com/tools/pairwise

flow1,
'linux-chrome-stable', 'beta', 'unstable'
'WifiHighPacketLoss', '3GPoor', 'DSL', 'Regular 4G'
'Yes', 'FW_NO_FW'
'East-US', 'West-US', 'Central US', 'Europe', 'Asia'
'Salsa-720p.mp4', '1080p', 'VGA'
'linux-chrome-stable', 'beta', 'unstable'
'WifiHighPacketLoss', '3GPoor', 'DSL', 'Regular 4G'
'Yes', 'FW_NO_FW'
'East-US', 'West-US', 'Central US', 'Europe', 'Asia'
'Salsa-720p.mp4', '1080p', 'VGA'

Not quite sure whats the reason for this. I just see it makes number of combos as biggest array length

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.