# Blockly Tests

This folder contains the test are currently available.
Blockly doesn't really an option to write good automated test but this is at least a collection of tests that can be used for regression testing.
It is not perfect but at least a good start.

To use the test, create a new rule and copy the content of any of the files into the code tab.
As it sometimes uses items or things of the specific openHAB setup, these might have to be adapted.

The folder contains

- the code of the tests with the postfix "test"
- and a visual representation of all the blocks for each test.

#Overview of the tests

## Color, List, Text blocks

![blockly_colors_list_text_dict](blockly_colors_list_text_dict.png)

## Datetime between

![blockly_datetime_between](blockly_datetime_between.png)

## Datetime comparison

![blockly_datetime_creation_comparison1](blockly_datetime_creation_comparison1.png)
![blockly_datetime_creation_comparison2](blockly_datetime_creation_comparison2.png)

## Ephemeris and Notifications

![blockly_ephemeris_and_notifications](blockly_ephemeris_and_notifications.png)

## Items and Things
![blockly_items_and_things](blockly_items_and_things.png)

## Metadata

The test is based on an item name _teststate_ with the namespace _namespaceTest_

The metadata of that namespace _namespaceTest_ is configured as follows:

```
value: Stefan
config:
  ooone: "123"
  oone:
    two: "456"
  one:
    two:
      three: "756"
  field1: 1
  field2: 2
  field3: 3
```
![metadata read test](blockly_metadata_1.png)
![metadata write test](blockly_metadata_2.png)
![metadate loop index test](blockly_metadata_3.png)


## Persistence
![blockly_persistence](blockly_persistence.png)

## Persistence

![blockly_quantities](blockly_quantities.png)

## Scripts and Transformations

![blockly_scripts](blockly_scripts.png)

## Timers and Delays
![blockly_timers_and_delays](blockly_timers_and_delays.png)
![blockly_timers_and_delays_triggered](blockly_timers_and_delays_triggered.png)

## Voice and Multimedia
![blockly_voice_and_multimedia](blockly_voice_and_multimedia.png)
