6.2 El Convenio entre España e Italia
6.2.4 Los rendimientos derivados de los servicios personales dependientes
The approach mutates input data by applying six mutation operators on the data loaded into memory (i.e. on the field data object). The identification of the mutation operators to apply and the selection of the data fields to mutate is guided by stereotypes used in the data model. Section 5.4 describes how we enhanced the modelling methodology presented in Chapter 3 to enable automatic data mutation.
The stereotype «InputData» is used by the software engineer to annotate the classes that model input data, to distinguish them from the configuration and output data classes, which do not need to be mutated. The two stereotypes «Identifier» and «Measure» are used to annotate class attributes; data that correspond to an attribute tagged by one of these stereotypes is mutated by applying a specific mutation operator or, otherwise, by applying an operator that simply flips bits. The stereotype «Derived»is used to annotate class attributes that need to be updated after certain mutations in order to prevent trivial inconsistencies; Section 5.3 provides additional details about the role of this stereotype. We defined six mutation operators: three working at the class instance level (Class Instance Dupli- cation, Class Instance Removal, Class Instances Swapping), and three working at the attribute level
5.2. Data Mutation Operators
(Attribute Replacement with Random, Attribute Replacement using Boundary Condition, Attribute Bit Flipping).
The six mutation operators do not include operators for the generation of class instances from scratch (e.g. we do not include an operator whose goal is to create a new class instance and add it to a sequence). This choice mainly depends on the fact that the generation of a portion of a complex test input from scratch would require a detailed specification of the characteristics of such inputs, for example by means of a grammar. One of the benefits of the approaches presented in this dissertation is that they do not require software developers to provide a complete specification of the format of the input data.
The following subsections detail the six mutation operators. For each operator, an informal description is provided along with an example that refers to the input data of SES-DAQ (refer to Figs. 3.1 and 3.2).
5.2.1
Class Instance Duplication (CID)
Description: The operator Class Instance Duplication duplicates an instance of a class belonging to a collection of elements. This operator copies a randomly chosen instance of a class in a collection and then inserts it at a random position in the collection. This operator simulates unexpected data in a collection.
Example: For the SES-DAQ, this operator can be applied to the containment associations between the classes ChannelData and Cadu, and between the classes ChannelDataPerVcid and Isp. In both cases, the duplicated data generated by this operator simulates a transmission error.
5.2.2
Class Instance Removal (CIR)
Description: This mutation operator deletes a randomly selected instance of a class from a collection of elements.
Example: For the SES-DAQ, this operator can be applied to the containment associations between the classes ChannelData and Cadu, and between the classes ChannelDataPerVcid and Isp. The removal of an instance of class Cadu, for example, simulates a transmission error that may lead to either missing or broken packets; in this case, when processing erroneous data created with this mutation operator, SES-DAQ should report a VIRTUAL_COUNTER_JUMP error as indicated by the constraint in Fig. 3.5.
5.2.3
Class Instances Swapping (CIS)
Description: Swaps the positions of two randomly chosen instances of a class in a collection of elements.
Example: For the SES-DAQ, this operator can be applied to the containment associations between the classes ChannelData and Cadu, and between the classes ChannelDataPerVcid and Isp. The effect of swapping two packets belonging to the association between the classes ChannelDataPerVcid and Ispsimulates the presence of transmission data sequence errors.
Chapter 5. Automatic Test Input Generation
5.2.4
Attribute Replacement with Random (ARR)
Description: This mutation operator replaces the value of an identifier attribute in an instance of a class with a different, randomly chosen, value. In principle, all the attributes of a class can be replaced with randomly chosen values, but in the general case a randomly generated value is not necessarily erroneous. We are interested in mutations that lead to errors; for this reason, we introduced the UML stereotype «Identifier» that allows software engineers to indicate which attributes are used as identifiers, and thus can be mutated according to the ARR operator. The «Identifier» stereotype enables software engineers to specify a numeric range for the random value to generate.
Example: This mutation operator can be applied to all the attributes annotated with the stereotype «Identifier». For example, a random mutation of the attribute versionNumber belonging to an instance of class VcduHeader simulates an invalid frame version, which should be reported by the software in the error logs.
5.2.5
Attribute Replacement using Boundary Condition (ARBC)
Description: This mutation operator changes the value of an attribute according to a boundary condi- tion criterion. This operator is particularly useful for mutating attributes that should be bound within a range, these attributes are usually measures. We thus introduced the UML stereotype «Measure» to annotate the attributes that belong to this category. This stereotype enables software engineers to indicate the minimum and maximum values allowed for the annotated attribute. The mutation opera- tor generates (up to) six values according to traditional boundary testing strategies: minimum value, minimum value plus/minus one, maximum value, and maximum value plus/minus one. The operator ensures that the generated values are in the range representable with the data type (e.g. unsigned bytes cannot represent negative values).
Example: This operator can be applied to all the attributes annotated with the UML stereotype «Mea- sure». For the SES-DAQ, this operator can be applied to the attribute vcFrameCount of class Vcdu- Header.
5.2.6
Attribute Bit Flipping (ABF)
Description: This operator randomly selects an attribute that corresponds to transmitted data and alters the value of a randomly selected bit. This mutation operator is particularly effective for intro- ducing errors in attributes that cannot be designated as an «Identifier» or a «Measure». The operator works by flipping a single bit of an attribute.
Example: This mutation operator can be applied to the attribute data of class PacketData of the SES- DAQ. The attribute data is a byte array: the mutation of one of its bits simulates the presence of a realistic transmission error that should be identified thanks to the presence of a Cyclic Redundancy Check (CRC) error detection code (contained in the field data of class PacketErrorControl).