.. _cit-varianter-plugin:

====================
CIT Varianter Plugin
====================

This plugin is an implementation of a Combinatorial Interaction
Testing algorithm for the Avocado varianter functionality.  It
generates an optimal number of variants, which in turn become
different test scenarios.

.. note:: The publication by Ahmed, Bestoun S., Kamal Z. Zamli, and
          Chee Peng Lim, entitled `“Application of particle swarm
          optimization to uniform and variable strength covering array
          construction”
          <https://www.sciencedirect.com/science/article/pii/S1568494611004716>`__,
          Applied Soft Computing, 12(4), 2012, pp. 1330-1347, contains
          the basis for the algorithm and implementation of this
          feature.

Files
=====

- ``optional_plugins/varianter_cit/avocado_varianter_cit/__init__.py``: The
  plugin implementation.

- ``examples/varianter_cit/params.ini``: An example parameters file.

Usage
=====

To see the variants generated by this demo implementation, execute::

    $ avocado variants --cit-parameter-file examples/varianter_cit/params.ini
    CIT Variants (14):
    Variant gold-triangle-solid-aluminum-cathodic:    /run
    Variant red-circle-gas-leather-cathodic:    /run
    Variant gold-square-gas-plastic-anodic:    /run
    Variant black-circle-liquid-aluminum-anodic:    /run
    Variant green-triangle-liquid-leather-anodic:    /run
    Variant green-circle-solid-plastic-cathodic:    /run
    Variant black-square-solid-leather-cathodic:    /run
    Variant red-square-liquid-aluminum-anodic:    /run
    Variant red-triangle-liquid-plastic-cathodic:    /run
    Variant black-triangle-gas-plastic-anodic:    /run
    Variant green-square-gas-aluminum-anodic:    /run
    Variant gold-circle-solid-leather-anodic:    /run
    Variant gold-triangle-liquid-plastic-anodic:    /run
    Variant red-circle-solid-aluminum-cathodic:    /run

.. note:: The exact variants generated are not guaranteed to be the same
          across executions.

You can enable more verbosity, making each variant to show its content::

    $ avocado variants --cit-parameter-file examples/varianter_cit/params.ini -c
    CIT Variants (15):

    Variant black-square-solid-leather-cathodic:    /run
        /:coating     => cathodic
        /:color       => black
        /:material    => leather
        /:shape       => square
        /:state       => solid

    Variant red-circle-gas-aluminum-cathodic:    /run
        /:coating     => cathodic
        /:color       => red
        /:material    => aluminum
        /:shape       => circle
        /:state       => gas

    Variant red-triangle-liquid-plastic-anodic:    /run
        /:coating     => anodic
        /:color       => red
        /:material    => plastic
        /:shape       => triangle
        /:state       => liquid

    Variant green-square-gas-aluminum-anodic:    /run
        /:coating     => anodic
        /:color       => green
        /:material    => aluminum
        /:shape       => square
        /:state       => gas

    Variant gold-circle-solid-leather-anodic:    /run
        /:coating     => anodic
        /:color       => gold
        /:material    => leather
        /:shape       => circle
        /:state       => solid

    Variant green-triangle-solid-plastic-cathodic:    /run
        /:coating     => cathodic
        /:color       => green
        /:material    => plastic
        /:shape       => triangle
        /:state       => solid

    Variant gold-square-liquid-plastic-cathodic:    /run
        /:coating     => cathodic
        /:color       => gold
        /:material    => plastic
        /:shape       => square
        /:state       => liquid

    Variant black-triangle-gas-leather-anodic:    /run
        /:coating     => anodic
        /:color       => black
        /:material    => leather
        /:shape       => triangle
        /:state       => gas

    Variant black-circle-liquid-plastic-anodic:    /run
        /:coating     => anodic
        /:color       => black
        /:material    => plastic
        /:shape       => circle
        /:state       => liquid

    Variant gold-triangle-gas-aluminum-anodic:    /run
        /:coating     => anodic
        /:color       => gold
        /:material    => aluminum
        /:shape       => triangle
        /:state       => gas

    Variant green-circle-liquid-leather-anodic:    /run
        /:coating     => anodic
        /:color       => green
        /:material    => leather
        /:shape       => circle
        /:state       => liquid

    Variant red-square-solid-aluminum-anodic:    /run
        /:coating     => anodic
        /:color       => red
        /:material    => aluminum
        /:shape       => square
        /:state       => solid

    Variant black-triangle-liquid-aluminum-anodic:    /run
        /:coating     => anodic
        /:color       => black
        /:material    => aluminum
        /:shape       => triangle
        /:state       => liquid

    Variant red-square-gas-plastic-anodic:    /run
        /:coating     => anodic
        /:color       => red
        /:material    => plastic
        /:shape       => square
        /:state       => gas

    Variant red-square-liquid-leather-cathodic:    /run
        /:coating     => cathodic
        /:color       => red
        /:material    => leather
        /:shape       => square
        /:state       => liquid

To execute tests with those combinations use::

    $ avocado run passtest.py --cit-parameter-file examples/varianter_cit/params.ini
    JOB ID     : 6abd9e9f1ff9ed33a353ca8f3ef845cd4cc404a5
    JOB LOG    : $HOME/avocado/job-results/job-2018-07-23T08.46-6abd9e9/job.log
     (01/15) passtest.py:PassTest.test;gold-circle-gas-plastic-cathodic: PASS (0.06 s)
     (02/15) passtest.py:PassTest.test;green-square-solid-plastic-anodic: PASS (0.02 s)
     (03/15) passtest.py:PassTest.test;black-triangle-liquid-aluminum-anodic: PASS (0.02 s)
     (04/15) passtest.py:PassTest.test;red-triangle-solid-leather-cathodic: PASS (0.02 s)
     (05/15) passtest.py:PassTest.test;red-square-liquid-aluminum-cathodic: PASS (0.02 s)
     (06/15) passtest.py:PassTest.test;green-circle-gas-leather-anodic: PASS (0.02 s)
     (07/15) passtest.py:PassTest.test;gold-circle-solid-aluminum-anodic: PASS (0.02 s)
     (08/15) passtest.py:PassTest.test;black-square-gas-leather-cathodic: PASS (0.02 s)
     (09/15) passtest.py:PassTest.test;red-circle-liquid-plastic-anodic: PASS (0.02 s)
     (10/15) passtest.py:PassTest.test;green-triangle-gas-aluminum-cathodic: PASS (0.02 s)
     (11/15) passtest.py:PassTest.test;gold-triangle-liquid-leather-cathodic: PASS (0.02 s)
     (12/15) passtest.py:PassTest.test;black-circle-solid-plastic-anodic: PASS (0.02 s)
     (13/15) passtest.py:PassTest.test;red-triangle-gas-plastic-cathodic: PASS (0.02 s)
     (14/15) passtest.py:PassTest.test;gold-square-liquid-leather-anodic: PASS (0.02 s)
     (15/15) passtest.py:PassTest.test;green-circle-liquid-aluminum-anodic: PASS (0.02 s)
    RESULTS    : PASS 15 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
    JOB TIME   : 1.21 s
    JOB HTML   : $HOME/avocado/job-results/job-2018-07-23T08.46-6abd9e9/results.html
