Example #1
0
    def test_can_run_funkload(self):
        conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
        test = conf.tests[0]
        result = FunkLoadTestRunner.run(root_path, test, self.base_url)

        expect(result).not_to_be_null()
        expect(result.exit_code).to_equal(0)

        text = re.sub(r"\d[.]\d{3}s", "", result.text)

        expect(text).to_be_like("""
            test_healthcheck: [ftest] sleep_time_min not found
            test_healthcheck: [ftest] sleep_time_max not found
            test_healthcheck: [ftest] log_path not found
            test_healthcheck: [ftest] result_path not found
            .
            ----------------------------------------------------------------------
            Ran 1 test in

            OK
        """)

        log = re.sub("\d*\-\d*\-\d*\s\d*[:]\d*[:]\d*[,]\d*\s", "", result.log)
        log = re.sub(r"\d[.]\d{3}s", "", log)

        expect(log).to_be_like("""
        INFO test_healthcheck: [test_healthcheck] description not found
        DEBUG test_healthcheck: Starting -----------------------------------
        DEBUG test_healthcheck: GET: http://localhost:2368/HealthCheck
            Page 1: Get url ...
        DEBUG test_healthcheck:  Done in
        """)
Example #2
0
    def test_can_run_funkload(self):
        conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
        test = conf.tests[0]
        result = FunkLoadTestRunner.run(root_path, test, self.base_url)

        expect(result).not_to_be_null()
        expect(result.exit_code).to_equal(0)

        text = re.sub(r"\d[.]\d{3}s", "", result.text)

        expect(text).to_be_like("""
            test_healthcheck: [ftest] sleep_time_min not found
            test_healthcheck: [ftest] sleep_time_max not found
            test_healthcheck: [ftest] log_path not found
            test_healthcheck: [ftest] result_path not found
            .
            ----------------------------------------------------------------------
            Ran 1 test in

            OK
        """)

        log = re.sub("\d*\-\d*\-\d*\s\d*[:]\d*[:]\d*[,]\d*\s", "", result.log)
        log = re.sub(r"\d[.]\d{3}s", "", log)

        expect(log).to_be_like("""
        INFO test_healthcheck: [test_healthcheck] description not found
        DEBUG test_healthcheck: Starting -----------------------------------
        DEBUG test_healthcheck: GET: http://localhost:2368/HealthCheck
            Page 1: Get url ...
        DEBUG test_healthcheck:  Done in
        """)
Example #3
0
 def test_can_run_funkload_with_dep(self):
     test_path = join(root_path, 'tests', 'functional')
     copy(join(test_path, 'with_deps.yml'), join(root_path, 'bench', 'with_deps.yml'))
     conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
     test = conf.tests[0]
     result = FunkLoadTestRunner.run(root_path, test, self.base_url)
     expect(result).not_to_be_null()
     expect(result.exit_code).to_equal(0)
Example #4
0
 def test_can_run_funkload_with_dep(self):
     test_path = join(root_path, 'tests', 'functional')
     copy(join(test_path, 'with_deps.yml'),
          join(root_path, 'bench', 'with_deps.yml'))
     conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
     test = conf.tests[0]
     result = FunkLoadTestRunner.run(root_path, test, self.base_url)
     expect(result).not_to_be_null()
     expect(result.exit_code).to_equal(0)
Example #5
0
    def test_can_report_failure(self):
        test_path = join(root_path, 'tests', 'functional')
        conf = WightConfig.load(join(test_path, 'failures.yml'))
        test = conf.tests[0]
        result = FunkLoadTestRunner.run(test_path, test, self.base_url)

        expect(result).not_to_be_null()
        expect(result.exit_code).to_equal(1)
        expect(result.text).to_include("ImportError: No module named fail")
Example #6
0
    def test_can_report_failure(self):
        test_path = join(root_path, 'tests', 'functional')
        conf = WightConfig.load(join(test_path, 'failures.yml'))
        test = conf.tests[0]
        result = FunkLoadTestRunner.run(test_path, test, self.base_url)

        expect(result).not_to_be_null()
        expect(result.exit_code).to_equal(1)
        expect(result.text).to_include("ImportError: No module named fail")
Example #7
0
    def validate_tests(self, base_path, config, load_test):
        logging.debug("test validation")
        if not config:
            logging.debug("not config")
            raise TestNotValidError("The wight.yml file was not found in project repository bench folder.")

        for test in config.tests:
            result = FunkLoadTestRunner.run(base_path, test, load_test.base_url)
            if result.exit_code != 0:
                logging.debug("test not valid: %s" % test.test_name)
                logging.error(result.log)
                raise TestNotValidError("The test '%s.%s.%s' running in '%s' is not valid (%s)" %
                                        (test.module, test.class_name,
                                        test.test_name, load_test.base_url, result.text))
        logging.debug("finish test validation")