<div dir="auto"><div dir="auto">Hi, </div><div dir="auto"><br></div><div dir="auto">I try to move strings of common part (copypast) in uitest clearCells.py[1] to separate method setUp. It can allow a qa-dev to do not copy-paste and do not care about initialization, but think only in the test case itself. I chose the file because it contains unused variables and is short enough to study.</div><div dir="auto"><br></div><div dir="auto"><br></div>class clearCells(UITestCase):<br>
<br>
    def setUp(self):<br>
        super(clearCells, self).setUp()<br>
        with self.ui_test.create_doc_in_start_center("calc") as self.document:<br>
            xCalcDoc = self.xUITest.getTopFocusWindow()<br>
            self.gridwin = xCalcDoc.getChild("grid_window")<br>
            enter_text_to_cell(self.gridwin, "A1", "aa")<br>
            enter_text_to_cell(self.gridwin, "A2", "1")  <br>
<br>
<br>
    def test_clear_cells_text(self):<br>
        self.gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))<br>
        with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog:<br>
            xdeleteall = xDialog.getChild("deleteall")<br>
            xtext = xDialog.getChild("text")<br>
            xdatetime = xDialog.getChild("datetime")<br>
            xcomments = xDialog.getChild("comments")<br>
            xobjects = xDialog.getChild("objects")<br>
            xnumbers = xDialog.getChild("numbers")<br>
            xformulas = xDialog.getChild("formulas")<br>
            xformats = xDialog.getChild("formats")<br>
<br>
            if (get_state_as_dict(xdeleteall)["Selected"]) == "true":<br>
                xdeleteall.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xtext)["Selected"]) == "false":<br>
                xtext.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xdatetime)["Selected"]) == "true":<br>
                xdatetime.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xcomments)["Selected"]) == "true":<br>
                xcomments.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xobjects)["Selected"]) == "true":<br>
                xobjects.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xnumbers)["Selected"]) == "true":<br>
                xnumbers.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xformulas)["Selected"]) == "true":<br>
                xformulas.executeAction("CLICK", tuple())<br>
            if (get_state_as_dict(xformats)["Selected"]) == "true":<br>
                xformats.executeAction("CLICK", tuple())<br>
<br>
        #Verify<br>
        self.assertEqual(get_cell_by_position(self.document, 0, 0, 0).getString() , "")<br>
        self.assertEqual(get_cell_by_position(self.document, 0, 0, 1).getValue() , 1) <div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">The test executes the plan of test, but has error. To me this error looks like the document is created before the setUp() and destroyed before the threadDown() that is strange. </div><div dir="auto"><br></div><div dir="auto"><br>
lera@infineco:~/project/libreoffice$ UITEST_TEST_NAME="clearCells.clearCells.test_clear_cells_text" ../execute.sh                                                      <br>
test_clear_cells_text (clearCells.clearCells) ... OfficeConnection: connecting to: uno:pipe,name=pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60;urp;StarOffice.ComponentContext<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:vcl.app:330430:330430:vcl/unx/generic/app/i18n_im.cxx:131: I18N: Operating system doesn't support locale "en_US".<br>
warn:<a href="http://desktop.app:330430" target="_blank" rel="noreferrer">desktop.app:330430</a>:330430:unotools/source/ucbhelper/localfilehelper.cxx:87: error removing directory file:///tmp/libreoffice/7/user/extensions<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:vcl.app:330436:330436:vcl/unx/generic/app/i18n_im.cxx:131: I18N: Operating system doesn't support locale "en_US".<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/startcenter/StartCenter<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/startcenter/box1<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/startcenter/all_buttons_box<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/startcenter/box2<br>
warn:io.connector:330399:330399:io/source/connector/connector.cxx:93: Connector : couldn't connect to pipe "pytest5e4b8bdc-dcb9-11ec-96e9-711de109ee60": 10<br>
NoConnectException: sleeping...<br>
warn:opencl:330436:330436:desktop/source/app/opencl.cxx:206: Failed to initialize OpenCL for test<br>
warn:vcl.gdi:330436:330436:vcl/unx/generic/gdi/salbmp.cxx:139: 32-bit images not supported, converting to 24-bit<br>
warn:vcl.gdi:330436:330436:vcl/unx/generic/gdi/salbmp.cxx:139: 32-bit images not supported, converting to 24-bit<br>
warn:vcl.gdi:330436:330436:vcl/unx/generic/gdi/salbmp.cxx:139: 32-bit images not supported, converting to 24-bit<br>
warn:vcl.gdi:330436:330436:vcl/unx/generic/gdi/salbmp.cxx:139: 32-bit images not supported, converting to 24-bit<br>
warn:vcl.gdi:330436:330436:vcl/unx/generic/gdi/salbmp.cxx:139: 32-bit images not supported, converting to 24-bit<br>
['OnNew']<br>
OnCreate<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
['OnNew']<br>
OnStorageChanged<br>
['OnNew']<br>
OnTitleChanged<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 25917<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26189<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26190<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: modules/scalc/ui/inputbar/background<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/deck/titlebar<br>
['OnNew']<br>
OnFocus<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 25917<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26189<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26190<br>
['OnNew']<br>
OnViewCreated<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox: sfx/ui/deck/titlebar<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 25917<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26189<br>
warn:sfx.control:330436:330436:sfx2/source/control/dispatch.cxx:1206: Childwindow slot missing: 26190<br>
['OnNew']<br>
OnTitleChanged<br>
['OnNew']<br>
OnModifyChanged<br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
warn:vcl.layout:330436:330436:vcl/source/window/layout.cxx:288: nExtraSpace went negative, setting to zero for VclBox:  <br>
['OnNew']<br>
OnTitleChanged<br>
['OnNew']<br>
OnViewClosed<br>
['OnNew']<br>
OnUnload<br>
['OnNew']<br>
OnUnfocus<br>
warn:svl.items:330436:330451:svl/source/items/itempool.cxx:441: old secondary pool: EditEngineItemPool of pool: XOutdevItemPool must be empty.<br>
Execution time for clearCells.clearCells.test_clear_cells_text: 8.792<br>
Binary URP bridge already disposed at /home/lera/project/libreoffice/binaryurp/source/bridge.cxx:1048<br>
ERROR<br>
ERROR<br>
<br>
======================================================================<br>
ERROR: test_clear_cells_text (clearCells.clearCells)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
 File "/home/lera/project/libreoffice/sc/qa/uitest/calc_tests3/clearCells.py", line 34, in test_clear_cells_text<br>
   self.gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))<br>
clearCells.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call at /home/lera/project/libreoffice/binaryurp/source/bridge.cxx:615<br>
<br>
======================================================================<br>
ERROR: test_clear_cells_text (clearCells.clearCells)<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
 File "/home/lera/project/libreoffice/uitest/uitest/framework.py", line 46, in tearDown<br>
   self.connection.tearDown()<br>
 File "/home/lera/project/libreoffice/uitest/libreoffice/connection.py", line 182, in tearDown<br>
   self.connection.tearDown()<br>
 File "/home/lera/project/libreoffice/uitest/libreoffice/connection.py", line 121, in tearDown<br>
   if self.xContext:<br>
uno.com.sun.star.uno.RuntimeException: Binary URP bridge already disposed at /home/lera/project/libreoffice/binaryurp/source/bridge.cxx:1048<br>
<br>
----------------------------------------------------------------------<br>
Ran 1 test in 16.835s<br>
<br>
FAILED (errors=2)<br>
Tests run: 1<br>
Tests failed: 0<br>
Tests errors: 2<br>
Tests skipped: 0<br>
<br></div><div dir="auto"><br></div><div dir="auto">I would be grateful for any ideas.</div><div dir="auto"><br></div><div dir="auto">[1] <a href="https://opengrok.libreoffice.org/xref/core/sc/qa/uitest/calc_tests3/clearCells.py?r=8b71bc7e#17">https://opengrok.libreoffice.org/xref/core/sc/qa/uitest/calc_tests3/clearCells.py?r=8b71bc7e#17</a></div><div dir="auto"><br></div><div dir="auto">Best regards, </div><div dir="auto">Lera</div></div>