def OperationDataGenerator(self, operation):
        myFile = open(
            'performance_testing/performance_datasets/' + self.operation_type +
            '_data_performance.csv', 'w')
        writer = csv.writer(myFile)
        writer.writerows([["Features", "Seconds", "Percent_cons"]])
        for cons in self.percent_cons:
            for feat in self.features:
                path = "models/synthetic/simple_betty_gen_models/" + str(
                    feat) + "/" + str(cons) + "-9.xml"
                parser = XMLTransformation(path)
                fm = parser.transform()

                if self.operation_type in ("vc", "f"):
                    configuration = self.get_config(fm)
                    operation.set_configuration(configuration)

                transform = FmToPysat(fm)
                transform.transform()

                if self.operation_type == "vp":
                    product = self.get_product(fm, transform)
                    operation.set_configuration(product)

                t0 = time.time()
                operation.execute(transform.destination_model)
                t1 = time.time() - t0

                writer.writerows([[feat, t1, cons]])

        print(
            "Generated data!\nNow you can see it with Seaborn Visualizer file")
Beispiel #2
0
    def setUp(self):
        xmlreader = XMLTransformation(
            "models/fama_test_suite/relationships/allrelationships/allrelationships.xml"
        )
        fm = xmlreader.transform()

        transform = FmToPysat(fm)
        return fm, transform.transform()
Beispiel #3
0
    def setUp(self, model_path):
        xmlreader = XMLTransformation(model_path)
        fm = xmlreader.transform()

        transform = FmToPysat(fm)
        return transform.transform()
Beispiel #4
0
from metamorphic_testing.Glucose3Metamorphic import Glucose3Metamorphic

from famapy.metamodels.fm_metamodel.transformations.xml_transformation import XMLTransformation

parser = XMLTransformation("models/simple/example.xml")
fm = parser.transform()

'''
The method Glucose3Metamorphic has 4 parameters, the initial feature model, the inital products of
these feature model, the number of iterations or metamorphic relations that will be generated and
the type of the operation to be proven, following the next semantic:

- core features -> cf
- dead features -> df
- products -> p
- products number -> pn
- valid -> v
- false optional features -> fof
'''

testing = Glucose3Metamorphic(fm, [["A","C"],["A","B","C"]], 20, "v")
testing.run()
Beispiel #5
0
from famapy.metamodels.fm_metamodel.transformations.json_writter import JsonWriter
from famapy.metamodels.fm_metamodel.transformations.xml_transformation import XMLTransformation

from famapy.metamodels.pysat_metamodel.models.pysat_model import PySATModel
from famapy.metamodels.pysat_metamodel.operations.glucose3_products import Glucose3Products
from famapy.metamodels.pysat_metamodel.operations.glucose3_valid import Glucose3Valid
from famapy.metamodels.pysat_metamodel.transformations.fm_to_pysat import FmToPysat

# Parse a file
xmlreader = XMLTransformation("example.fama")
fm = xmlreader.transform()

# print the model
print(fm)

# Create a detination metamodel (Pysat for the record)
sat = PySATModel()

# Transform the first onto the second
transform = FmToPysat(fm, sat)
transform.transform()

# Create the operation
valid = Glucose3Valid()

# Execute the operation . TODO Investigate how t avoid that sat parameter
valid.execute(sat)

# Print the result
print("Is the model valid: " + str(valid.isValid()))