summaryrefslogtreecommitdiff
path: root/uitest/UITestCase.py
blob: 5e088042e713814ee30c90232c16ebb6aaa17c6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

import unittest
import time

from uitest_helper import UITest

from connection import PersistentConnection, OfficeConnection

class UITestCase(unittest.TestCase):

    def __init__(self, test_name, opts):
        unittest.TestCase.__init__(self, test_name)
        self.opts = opts

    def setUp(self):
        self.connection = PersistentConnection(self.opts)
        self.connection.setUp()
        self.xContext = self.connection.getContext()
        self.xUITest = self.xContext.ServiceManager.createInstanceWithContext(
                "org.libreoffice.uitest.UITest", self.xContext)

        self.ui_test = UITest(self.xUITest, self.xContext)
        self.startTime = time.time()

    def tearDown(self):
        t = time.time() - self.startTime
        print("Execution time for %s: %.3f" % (self.id(), t))
        self.connection.tearDown()

# vim:set shiftwidth=4 softtabstop=4 expandtab: */