Exemplo n.º 1
0
 def WhenTheGeneratorIsCppscenarios(self):
     """Gherkin DSL step"""
     self.output = "cpp/cppscenarios"
     self.folder = "cpp/cppscenarios"
     self.ext = ".h"
     self.header = "// Copyright (c) 2019 ...\n\n"
     self.settings = cornichon.Settings(self.output)
Exemplo n.º 2
0
 def WhenTheGeneratorIsVbscenarios(self):
     """Gherkin DSL step"""
     self.output = "vb/vbscenarios"
     self.folder = "vb/vbscenarios"
     self.ext = ".vb"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
Exemplo n.º 3
0
 def WhenTheGeneratorIsUnittesting(self):
     """Gherkin DSL step"""
     self.output = "cs/unittesting"
     self.folder = "cs/unittesting"
     self.ext = ".cs"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
Exemplo n.º 4
0
 def WhenTheGeneratorIsNunit(self):
     """Gherkin DSL step"""
     self.output = "vb/nunit"
     self.folder = "vb/nunit"
     self.ext = ".vb"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
Exemplo n.º 5
0
 def WhenTheGeneratorIsPyscenarios(self):
     """Gherkin DSL step"""
     self.output = "py/pyscenarios"
     self.folder = "py/pytests"
     self.ext = "_scenarios.py"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
Exemplo n.º 6
0
 def WhenTheGeneratorIsCppunittest(self):
     """Gherkin DSL step"""
     self.output = "cpp/cppunittest"
     self.folder = "cpp/cppunittest"
     self.ext = ".cpp"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
     self.settings["scenarios file"] = "../cppscenarios/%s.h" % self.name
Exemplo n.º 7
0
 def WhenTheGeneratorIsPytests(self):
     """Gherkin DSL step"""
     self.output = "py/pytests"
     self.folder = "py/pytests"
     self.ext = ".py"
     self.header = ""
     self.settings = cornichon.Settings(self.output)
     self.settings["scenarios file"] = self.name + "_scenarios"
Exemplo n.º 8
0
 def WhenTheGeneratorIsGoogletest(self):
     """Gherkin DSL step"""
     self.output = "cpp/googletest"
     self.folder = "cpp/googletest"
     self.ext = ".cpp"
     self.header = "// Copyright (c) 2019 ...\n\n"
     self.settings = cornichon.Settings(self.output)
     self.settings["scenarios file"] = "../cppscenarios/%s.h" % self.name
Exemplo n.º 9
0
 def TestAModule(self, output):
     try:
         settings = cornichon.Settings(output)
         mod = gherkin.Import(output)
         help = mod.HelpSettings()
         self.TestALevel(settings, help, output)
     except TypeError:
         self.undoc = True
Exemplo n.º 10
0
        def ThenItHasCorresponding(self, output):
            """Gherkin DSL step"""
            settings = {}
            if self.language == "cpp":
                settings = cornichon.Settings("cpp/cppscenarios")
            elif self.language == "python":
                settings = cornichon.Settings("py/pyscenarios")

            formats = {}
            argModifier = common.UnmodifiedArg
            if self.declaration:
                formats = settings["types"]
            else:
                formats = settings["values"]
                if self.language == "cpp":
                    argModifier = cpputils.ArgModifier
                elif self.language == "python":
                    argModifier = pyutils.ArgModifier

            out = common.ArgumentList(self.args, self.types, formats, argModifier)
            if out != output:
                print("\n{} isn't {}".format(out, output))
            self.assertEqual(out, output)
Exemplo n.º 11
0
def Process(stub):
    # Read the Gherkin DSL
    f = open(stub + '.feature', "r")
    gherkin = f.readlines()
    f.close()

    # Only need to call Settings for the test framework as it builds
    # on those settings for the scenarios
    settings = cornichon.Settings("py/pyunit_tests")
    settings["scenarios file"] = 'scenarios_' + stub

    # Overwrite the tests
    fp = open('test_' + stub + '.py', "w")
    fp.write(cornichon.Generate(gherkin, settings, "py/pyunit_tests"))
    fp.close()

    # Overwrite the test scenarios
    fp = open('scenarios_' + stub + '.py', "w")
    fp.write(cornichon.Generate(gherkin, settings, "py/pyscenarios"))
    fp.close()
Exemplo n.º 12
0
header = "// Copyright (c) 2019 ...\n\n"

for filename in os.listdir('Examples/tests'):
    inFileName = os.path.join('Examples/tests', filename)
    stub, ext = os.path.splitext(filename)
    if ext == '.feature':
        # Read the Gherkin DSL
        print(filename)
        f = open(inFileName, "r")
        gherkin = f.readlines()
        f.close()

        # Only need to call Settings for the test framework as it builds
        # on those settings for the scenarios
        settings = cornichon.Settings("cpp/cppunittest")
        settings["rootnamespace"] = "Cornichon::"
        settings["scenarios file"] = "../cppscenarios/" + stub + ".h"

        # Generate the tests
        ofilename = 'Examples/output/cpp/cppunittest/' + stub + ".cpp"
        if os.path.exists(ofilename):
            ofilename = 'Examples/output/cpp/cppunittest/' + stub + ".fpp"
        fp = open(ofilename, "w")
        fp.write(cornichon.Generate(gherkin, settings, "cpp/cppunittest"))
        fp.close()

        # Generate the test scenarios
        ofilename = 'Examples/output/cpp/cppscenarios/' + stub + ".h"
        if os.path.exists(ofilename):
            ofilename = 'Examples/output/cpp/cppscenarios/' + stub + ".f"