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