예제 #1
0
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + '/../grinder/test.log')
        obj.engine = EngineEmul()
        obj.settings.merge(
            {'path': __dir__() + "/../grinder/fake_grinder.jar"})
        obj.execution.merge({
            "concurrency": {
                "local": 2
            },
            "hold-for": 5,
            "scenario": {
                "requests": ['http://blazedemo.com']
            }
        })
        obj.prepare()

        self.assertEqual(len(obj.cmd_line), 5)
        cmd_line = ' '.join(obj.cmd_line)
        self.assertTrue(cmd_line.startswith('java -classpath'))
        self.assertNotEqual(cmd_line.find('net.grinder.Grinder'), -1)

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder" + EXE_SUFFIX
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        obj.post_process()
        self.assertFalse(obj.has_results())
예제 #2
0
 def test_diagnostics(self):
     obj = GrinderExecutor()
     obj.kpi_file = os.path.abspath(__dir__() + '/../resources/grinder/test.log')
     obj.engine = EngineEmul()
     obj.settings.merge({'path': __dir__() + "/../resources/grinder/fake_grinder.jar"})
     obj.execution.merge({"hold-for": 2,
                          "scenario": {"keepalive": False, "requests": ['http://blazedemo.com']}})
     obj.prepare()
     try:
         obj.cmd_line = __dir__() + "/../resources/grinder/grinder" + EXE_SUFFIX
         obj.startup()
         while not obj.check():
             time.sleep(obj.engine.check_interval)
     finally:
         obj.shutdown()
     obj.post_process()
     self.assertIsNotNone(obj.get_error_diagnostics())
예제 #3
0
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + "/../grinder/test.log")
        obj.engine = EngineEmul()
        obj.execution.merge(
            {"concurrency": {"local": 2}, "hold-for": 5, "scenario": {"requests": ["http://blazedemo.com"]}}
        )
        obj.prepare()

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder.sh"
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        self.assertRaises(RuntimeWarning, obj.post_process)
예제 #4
0
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + '/../grinder/test.log')
        obj.engine = EngineEmul()
        obj.execution.merge({"concurrency": {"local": 2},
                             "hold-for": 5,
                             "scenario": {"requests": ['http://blazedemo.com']}})
        obj.prepare()

        self.assertEqual(len(obj.cmd_line), 5)
        cmd_line = ' '.join(obj.cmd_line)
        self.assertTrue(cmd_line.startswith('java -classpath'))
        self.assertNotEqual(cmd_line.find('net.grinder.Grinder'), -1)

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder" + EXE_SUFFIX
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        self.assertRaises(RuntimeWarning, obj.post_process)
예제 #5
0
    def test_full_Grinder(self):
        obj = GrinderExecutor()
        obj.kpi_file = os.path.abspath(__dir__() + '/../grinder/test.log')
        obj.engine = EngineEmul()
        obj.execution.merge({
            "concurrency": {
                "local": 2
            },
            "hold-for": 5,
            "scenario": {
                "requests": ['http://blazedemo.com']
            }
        })
        obj.prepare()

        try:
            obj.cmd_line = __dir__() + "/../grinder/grinder.sh"
            obj.startup()
            while not obj.check():
                time.sleep(obj.engine.check_interval)
        finally:
            obj.shutdown()
        self.assertRaises(RuntimeWarning, obj.post_process)