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.

Item Types

Icon
SID
Name
Description
View(s)
10IFM
Feature model
The Feature model includes all Feature Families (a.k.a. Variant Families) and Features of a product line, including also optional constraints.
  • Product Feature Content
  • Feature Mode Editor
10FV
Feature family
A Feature family is included in the Feature model, and acts as an abstract "variation point" that can be specialized by Features.
  • Product Feature Content
  • Feature Mode Editor
10PC
Product class

  • Product Feature Content


Part Types

IconSIDNameDescriptionView(s)
 (Feature structure)

(Feature family)
10IFV
Feature variation
  • Product Feature Content
  • Feature Mode Editor


10IVPFeature variation 2


10IFPFeature variation 3


10IVAFeature


10INCInclusion


Attribute Types

SIDNameObject Assigned to Type and Dimension
10INInclusion


Feature Families and Features

The feature model contains Feature families and 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.



<FeatureModellingConfiguration>
  <FeatureFamilyScope partTypes="10IVA;10IFP"/>
    <CanAddFamily itemTypes="10FM;10ST"/>
    <Version nr="2"/>
  <Attributes>
      <StructureCardinality sid="10SC"/>
    <VariantCardinality sid="10VC"/>
    <Cardinality sid="10CA"/>
  </Attributes>
</FeatureModellingConfiguration>

Explanation of the Configuration Elements

The <FeatureModellingConfiguration> element build the structure of the configuration.


<FeatureFamilyScope> refers to the scope of the Feature Families and is valid for the calculation of families out of scope. 


<Version> refers to what version of the meta model is being used. 1 is for the previous version and 2 is for the updated meta model.


<Attributes> contains the cardinality attributes: 

  • <Variant cardinality> refers to the relationship between Features in a Family. * equals an OR relationship whereas 1 equals an XOR relationship. The sid attribute is the SID of the attribute.
  • <Structure cardinality> refers to the cardinality of the Family within the specific Structure Item. The sid attribute is the SID of the attribute.
  • <Structure Cardinality> in an attribute for Structure Items and is part of the version 2 meta model.


Product Builder View

The Product Builder is a view that is configurable and, in the context of Variability, is used to create product configurations from the feature model. It is active when the top item type, as defined in the configuration, is selected. It needs to be activated in Configure the explorer



<ProductBuilderConfigs>
  <ProductBuilderConfig id="1">  
    <ViewSettings> 
      <Caption>Product Builder</Caption> 
      <RibbonGroup>Feature Model</RibbonGroup>
      <Image guiImage="21"/>
    </ViewSettings>
    <TopItemType itemType="10PP"/>
    <BaselineItemType itemType="3PTA"/>
    <FeatureModelPartType partType="10IFM"/>
  </ProductBuilderConfig>
</ProductBuilderConfigs>

Explanation of the Configuration Elements

The <ProductBuilderConfigs> and <ProductBuilderConfig> elements build the structure of the multiple configurations and the individual configurations.


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


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


<TopItemType/> is the SID of the item type that activates the view.


<BaselineItemType/> is the SID of the element representing the baseline.


<FeatureModelPartType/> is the SID of the Feature Model Part Type.




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>