# This header is for providing additional information to hugo for the website generation it ignored by asciidoctor

title: "SWTBot UI Test Set and Test Structure" url: doc/development/swtbottestsstructure.html page_css_file: /4diac/css/4diac_doc.css sidebar: - sb-doc ---

# SWTBot UI Test Set and Test Structure

- Where are the SWTBot UI tests located in the 4diac IDE source code?

- SWTBot Hierachy with Extentions for 4diac IDE

- SWTBot UI Test Structure

- SWTBot UI Test Set

- 4diac Developer SWTBot UI Test Documentation

## Where are the SWTBot UI tests located in the 4diac IDE source code?

The UI tests with Eclipse SWTBot can be found in the package /org.eclipse.fordiac.ide.test.ui. Is is devided into the following packages:

### SWTBot Hierachy with Extentions for 4diac IDE

In the package org.eclipse.fordiac.ide.test.ui.swtbot contains the 4diac IDE specific extensions, as 4diac has some characteristics that require these extensions to the test framework. E.g. SWTBot would jump from one point to another when dragging a FB. However, 4diac also needs a small mouse movement to perform this action. The overwritten method mouseDrag of the class SWTBot4diacFigureCanvas adds the necessary mouse movement, and also the necessary changes of the calling classes were made.

The 4 classes are:

- SWT4diacGefBot extends SWTGefBot

- SWTBot4diacGefEditor extends SWTBotGefEditor

- SWTBot4diacGefViewer extends SWTBotGefViewer and

- SWTBot4diacFigureCanvas extends SWTBotGefFigureCanvas.

### SWTBot UI Test Structure

The base class for all SWTBot UI tests is the Abstract4diacUITests class in package org.eclipse.fordiac.ide.test.ui. It takes care of the generally defined @BeforeAll, @AfterEach and test execution methods. The class is not intended for tests but for smooth test execution so that every test has the same execution conditions.

An exception is the class New4diacProjectTest, which does not require any preparatory actions, as it tests whether a project can be created with permitted and non-permitted names.

The Abstract4diacUITests class is the base class for all SWTBot UI Tests and it has 2 types of assisting classes in the package org.eclipse.fordiac.ide.test.ui.helpers. The final helper classes and the supporting Bot classes.

In the final helper classes (blue) are all static constants of names outsourced. As the name suggests, the supporting Bot classes (orange) contain a Bot for a particular sub-test task.

### SWTBot UI Test Set

The tests are divided into serveral packages and classes.

## 4diac IDE Developer SWTBot UI Test Documentation

Development documentation has been created so that all 4diac IDE developers can contribute new tests.
This can be found in the installed 4diac IDE under
Help → Help Contents → 4diac User Guide → Development Documentation → 4DIAC-IDE → SWTBot testing
or
SWT Bot Tests Documentation