This article provides an overview of the Feature Model meta model, and how to configure the views that support feature modelling and variability. 


Prerequisites


Product Line Engineering Solution

  • One product line containing variability from which a range of products can be configured
  • Functionality introduced once
  • Bugs fixed once – used for all products
  • Fewer software to maintain




The Feature Model

The feature model captures how the product varies. Solutions developed are related to how the product varies. This means that if a specific product is built that contains a feature, all solutions related to that feature will be part of the specific product. This also means that the feature model needs to be concrete and the features in the feature model cannot change their meaning over time since this means that the solutions connected to the feature would not be valid any longer.


The feature model contains:

  • Feature families
  • Features


Feature families specify what can vary within a product, whereas features are the specific ways that the feature family varies.



A feature owns the part to the feature family. This meta model solution makes it possible to expand the feature family without changing the version of the feature family. Since many artifacts relate to the feature model, the contents of the feature model should be kept stable – no changes to versions, etc.


Restrictions in terms of which features are compatible can be added as “Variant restrictions”.


Product configurations can be created as a combination of features to be used for the specific product.


Feature Model Views

The following views are hard-coded to support feature modelling work.

  • Feature Model Editor - For editing the feature model
  • Product Builder - For creating product configurations from the feature model
  • Product Feature Content - For describing feature options for models - what is standard, optional and excluded per machine model for new feature model
  • Variability editor - For connecting artifacts in the solution to the feature model


To make any of these views available for users, they must be activated in Configure the explorer.

  1. Go to File > Configure the explorer
  2. On the Item views tab, select the view.
  3. When you are ready to test and make it available to users, check the Active box. Users must log out and back in to see the new option.


Feature Model Editor Extension View

The Feature Model Editor is an extension view that is hard-coded for the Feature Model meta model. It is active when a Variability Model item is selected. Although no configuration is needed, it does need to be activated in Configure the explorer



Note: With the R32 release, this extension view replaces the built-in Feature Model Editor view in swExplorer. The older, built-in version is deprecated.


Product Builder View

The Product Builder is a view that is hard-coded for the Feature Model meta model. It is active when a Product item is selected. Like the Feature Model Editor, it only needs to be activated in Configure the explorer.





Artifacts are related to the feature model either directly to features or through logic expressions using “and” and “or”.



Variability Editor View

The Variability Editor view is used to aid in creating the connections between artifacts and the feature model. Unlike the above views, the Variability Editor supports one or more configurations, and needs to be configured for each of the types that is related to the feature model. 



Example Configuration

<Configs>
  <VariabilityEditorConfig id="Unique identifier">
    <ViewSettings>
      <Caption>Variability editor</Caption>
      <RibbonGroup>Variability</RibbonGroup>
      <Description>Specify variability for item</Description>
    </ViewSettings>
    <TopItem sid="4BAS"/>
    <FeatureModelPath sid="/4SPE/10IFM"/>
    <FeatureItemType sid="10FE"/>
    <FeatureDependants>
      <FeatureDependant sid="DREQ" useRefObj="False">
        <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>
        <ExistsForPart sid="10RE"/>
        <FunctionalDesignItem sid="BISG"/>
        <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>
      </FeatureDependant>
    </FeatureDependants>
  </VariabilityEditorConfig>
</Configs>

Explanation of the Configuration Elements

The <Configs> and <VariabilityEditorConfig> elements build the structure of the multiple configurations and the individual configurations.


The id attribute in <VariabilityEditorConfig> identifies the specific configuration, and should be a unique string value when multiple configurations exist in <Configs>. 


The variability editor aids in creating the “Exists for” part relating the artifact to the feature model.




Each configuration can be used for multiple artifacts.


<ViewSettings> enables you to set a custom view label, hover-tip, icon, etc. See How to Configure Item View Menu Button Settings.


<TopItem sid=""/> specifies the type that contains both the artifact to connect to the feature model and the feature model. It is the item type (identified by the sid attribute) for which the configuration is valid.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

 </Configs>

<FeatureModelPath sid="/4SPE/10IFM"/> specifies how to reach the feature model from the <TopItem/>.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>

<FeatureItemType sid="10RF"/> specifies the type of the feature.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<FeatureDependants> specifies all artifacts that should be part of this variability editor configuration. Each configuration can contain several different artifacts.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<FeatureDependant sid="DREQ" useRefObj=“False"> specifies the artifact that should be related to the feature model. useRefObj should always be “False”.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<PathTopToSelected> is the path from the <TopItem/> to the artifact.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

         <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<ExistsForPart/> is the part connecting the artifact to the feature model.



<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<FunctionalDesignItem> specifies the type of a smaller context in which logic expressions connecting to the feature model can be reused.



<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


<PathFunctionalDesignToSelected/> specifies the path from <FunctionalDesignItem> to the artifact.


<Configs>

  <VariabilityEditorConfig id="Unique identifier">

    <ViewSettings>

       <Caption>Variability editor</Caption>

       <RibbonGroup>Variability</RibbonGroup>

       <Description>Specify variability for item</Description>

    </ViewSettings>

    <TopItem sid="4BAS"/>

    <FeatureModelPath sid="/4SPE/10IFM"/>

    <FeatureItemType sid="10RF"/>

    <FeatureDependants>

       <FeatureDependant sid="DREQ" useRefObj=“False">

          <PathTopToSelected sids="4SPE;3VDA;ITFD;ITAP;ITFC;IDRE"/>

          <ExistsForPart sid=“10RE"/>

          <FunctionalDesignItem sid="BISG"/>

          <PathFunctionalDesignToSelected sids="ITAP;ITFC;IDRE"/>

       </FeatureDependant>

       </FeatureDependants>

  </VariabilityEditorConfig>

</Configs>


The variability editor will be active on all types specified as a < FeatureDependant/>.



Right-click to create connection to feature model.



The result is that the conditions under which the artifact is applicable is specified in terms of features.



Test - Feature Model Meta Model

Connecting test cases to the feature model makes it possible to filter out test cases applicable for a specific product configuration when creating test executions.



Configuring Test to work with the feature model is done under Feature configuration in “Configure the Explorer”.




<TestConfig>

  <TestCaseVariantPartSIDs>ITXF;10VB</TestCaseVariantPartSIDs>

  <TestSystemVariantPartSID>10IFE</TestSystemVariantPartSID>

  <TestSystemVariantContainerPartSID>ITST</TestSystemVariantContainerPartSID>    

  <TestSpecificationVariantPartSID>TSVA</TestSpecificationVariantPartSID>

</TestConfig>


The configuration specifies what is noted in the meta model pictures previously.

<TestCaseVariantPartSIDs> specifies all parts needed to find features from a Test case.


<TestConfig>

  <TestCaseVariantPartSIDs>ITXF;10VB</TestCaseVariantPartSIDs>

  <TestSystemVariantPartSID>10IFE</TestSystemVariantPartSID>

  <TestSystemVariantContainerPartSID>ITST</TestSystemVariantContainerPartSID>    

  <TestSpecificationVariantPartSID>TSVA</TestSpecificationVariantPartSID>

</TestConfig>


Since Test is performed on a product configuration and test cases are related to features, a variant containing all test cases relevant for this configuration can be created.

Create Test


Script Language

The feature model can be used in the script language to filter out a configuration valid for a product configuration.

Next is a function that can be used to implement this filtering function. 

Call the function on an artifact that should be filtered with these parameters. 

  • <Parameter name="featureSet" as="Items"/>
    • A variable containing all features in the product that should be used as filter.
  • <Parameter name="useFeature" as="Boolean"/>
    • A Boolean – shows the superset if false, filters if true.
  • <Parameter name="variant" as="Items"/>
    • The variant condition on the artifact that should be filtered.
    • For the design requirements the call would look like VariantFilter($SelectedFeatures, $Switch,/10RE).


 <Function name="VariantFilter" as="Boolean">

    <Parameter name="featureSet" as="Items"/>

    <Parameter name="useFeature" as="Boolean"/>

    <Parameter name="variant" as="Items"/>

   <Choose>

    <When test=“not $useFeature">

        <Value select="true"/>

    </When>

    <When test="$useFeature">

   <Choose>                             

      <When test="not Type.SID = '10AN' and not Type.SID = '10OR' and not Type.SID = '10RF' and not Type.SID = '10PC'">

        <Value select="not($variant) or any $variant satisfies VariantFilter($featureSet, $useFeature, [])"/>

      </When>

      <When test="Type.SID = '10AN'">

        <Value select="all /10VB satisfy VariantFilter($featureSet, $useFeature, [])"/>

      </When>

      <When test="Type.SID = '10OR'">

        <Value select="any /10VB satisfies VariantFilter($featureSet, $useFeature, [])"/>

      </When>

      <When test="Type.SID = '10RF' or Type.SID = '10PC'">

        <Value select=". in $featureSet"/>

      </When>

      <Otherwise>

        <Value select="true"/>

      </Otherwise>

    </Choose>

    </When>

    <Otherwise>

        <Value select="true"/>

    </Otherwise>

   </Choose>

  </Function>