Exemple #1
0
    def validate(self):
        """validates the testrun: parse the testplan macro for testcase names and
        testers, and parse those testcases (wiki pages) to get and validate the
        actions and expected results.

        A test plan macrco looks like this:
        #! TestPlan
        Id: TA14
        Testart: UsecaseTest
        Build: DC-3.1.1
        Konfiguration: IE7-Win, FF-LUX
        Usecases: BaugruppenVerwalten, ObjekteSuchen

        Testcases/SaveAsEinerBaugruppe mmuster
        TcErzeugenEinerBaugruppe lmende, mmuster
        """
        self.dbg("TestRun.validate()")

        try:
            attributes, tc_tester_tups = parsers.TestPlanMacroParser(self.env).parse_config(
                self._testplan_macro_content(self.wikiplan.text)
            )
        except TracError, e:
            self.env.log.error(e)
            raise TracError(safe_unicode("Testplan error on %s, %s" % (self.wikiplan.name, e.message)))
Exemple #2
0
def normalize_story(story_info):
    story_info = tokenizer.predict(story_info)
    story_info = normalize_special_mark.sub(u' \g<special_mark> ', story_info)
    story_info = normalize_space.sub(u' ', story_info)
    story_info = tokenizer.spliter.split(story_info)
    story_info = filter(lambda x: len(x.strip()) > 0, story_info)
    story_info = map(lambda x: fix_missing_period(x), story_info)
    story_info = u' '.join(story_info)
    # convert unicode to bytes string
    story_info = utils.safe_unicode(story_info)
    story_info = story_info.encode('utf-8')
    return story_info
Exemple #3
0
    def setup(self, pagename, manager):
        """ Sets up a new testrun and inserts a new  trac ticket of type
        testrun into the database.
        """
        self.dbg("TestRun.setup( %s, %s )" % (str(pagename), str(manager)))

        self.wikiplan = WikiPage(self.env, pagename)

        # add new testrun ticket
        data = {OWNER: manager, "reporter": manager, SUMMARY: self.wikiplan.name, "type": "testrun"}
        self.dbg("ticket data: %s" % data)

        try:
            self.ticket.populate(data)
            self.runid = self.ticket.insert()
            self.ticket["description"] = self.description
            self.ticket.save_changes()
        except TracError, e:
            self.env.log.error(e)
            raise TracError(safe_unicode("TestRun ticket could not be created: %s" % e.message))
Exemple #4
0
        self.testcases = list()

        for pagename, testers in tc_tester_tups:
            for tester in testers:
                try:
                    tc = parser.parseTestcase(pagename=pagename)
                    tc.testrun = self.runid
                    tc.status = NOT_TESTED
                    tc.tester = tester

                    for ta in tc.actions:
                        ta.testrun = self.runid
                        ta.status = NOT_TESTED
                except TracError, e:
                    self.env.log.error(e)
                    errors[pagename] = safe_unicode(e.message)
                    continue

                self.testcases.append(tc)

        if errors:
            self._set_defect(errors)
            raise TracError(
                "Testplan could not be started, for more information "
                "review the testplan page '%s' and restart the testplan" % self.wikiplan.name
            )

    def _testplan_macro_content(self, wikitext):
        """ searches the testplan macro text in a wiki page.
        """
        self.dbg("TestRun._testplan_macro_content()")