Exemple #1
0
def test_no_must_fails():
    txt = """
        #MF is the commented YAML text, having the following convention:
        #MF - field for MF id
        #Comment - field for comments
        #Other fields may be introduced in later versions
        #Regular comments should not break the MF feature
        #Here the MF begins
        #MF NOBUG
        #extrafield: 123
        Feature: feature for test
            As developer I want to have my feature tested

        #Example 1:
            #MF BUG-45
            #Comment: |
            # first line of comment
            # second line
            # last line
            Scenario: some scenario
               Step 1
               Step 2

        #Example 2:
            Scenario: some another scenario
               #MF http://mybugtracker/ID33
               #Comment: bla bla bla
               Some step
               Another step

        """
    feature = Feature.from_string(txt, with_file="dummy.txt")
    mfp = InplaceMustfailParser(feature)
    mustfails = mfp.as_dict()
    assert_false('MustFail' in mustfails, "must not find mustfails")
Exemple #2
0
 def __get_setup_requirements(self):
     feature = Feature.from_file(self.test)
     for scenario in feature.scenarios:
         if scenario.name == self.setup_scenario:
             for step in scenario.steps:
                 setup_names = self.__find_setup_definitions(step.original_sentence)
                 return setup_names
Exemple #3
0
 def __load_inplace_mustfails(self):
     mustfail_definitions = {}
     for feature_filename in self.__find_feature_files():
         feature = Feature.from_file(feature_filename)
         inplace_mfp = InplaceMustfailParser(feature)
         if len(inplace_mfp) > 0:
             mustfail_definitions = self.__merge_mfs(mustfail_definitions, inplace_mfp.as_dict())
         return mustfail_definitions
Exemple #4
0
def generate_stubs(test):
    stubs = set()
    feature = Feature.from_file(test)
    for scenario in feature.scenarios:
        for step in scenario.steps:
            stub = Stub.make(step.proposed_sentence, step.proposed_method_name)
            if stub:
                stubs.add(stub)
    return stubs
Exemple #5
0
def test_must_fails_feature_scenario_step():
    txt = """
        #MF is the commented YAML text, having the following convention:
        #MF - field for MF id
        #Comment - field for comments
        #Other fields may be introduced in later versions
        #Regular comments should not break the MF feature
        #Here the MF begins
        #MF: NOBUG
        #extrafield: 123
        Feature: feature for test
            As developer I want to have my feature tested

        #Example 1:
            #MF: BUG-45
            #Comment: |
            # first line of comment
            # second line
            # last line
            Scenario: some scenario
               Step 1
               Step 2

        #Example 2:
            Scenario: some another scenario
               #MF: http://mybugtracker/ID33
               #Comment: bla bla bla
               Some step
               Another step

        """
    feature = Feature.from_string(txt, with_file="dummy.txt")
    mfp = InplaceMustfailParser(feature)
    mustfails = mfp.as_dict()
    assert_true('MustFail' in mustfails, "No mustfails found")
    mustfails = mustfails['MustFail']
    assert_equals(len(mustfails), 3, "Not all inplace mustfails found")
    assert_true('scenarios' in mustfails)
    assert_true(len(mustfails['scenarios']) == 1)
    assert_true(len(mustfails['steps']) == 1)
    assert_true(len(mustfails['features']) == 1)