Index: src/gnuboat/device/tests/__init__.py
===================================================================
--- src/gnuboat/device/tests/__init__.py	(revision 0c8a692854a1f8c132f84ecd9e6c7d5af43de307)
+++ src/gnuboat/device/tests/__init__.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -15,2 +15,21 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 '''
+
+import time
+import sys
+
+
+def gpsd_fakehook(linenumber, fakegps):
+    """
+        Used as pred for gps fake device,
+        and indicates, when the device is ready
+        to generate data
+    """
+    if not fakegps.testload.sentences:
+        sys.stderr.write("fakegps: no sentences in test load.\n")
+        raise SystemExit(1)
+    if linenumber % len(fakegps.testload.sentences) == 0:
+        if linenumber > 0:
+            return False
+    time.sleep(1)
+    return True
Index: src/gnuboat/device/tests/conftest.py
===================================================================
--- src/gnuboat/device/tests/conftest.py	(revision 0c8a692854a1f8c132f84ecd9e6c7d5af43de307)
+++ src/gnuboat/device/tests/conftest.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -17,19 +17,11 @@
 
 import pytest
-from werkzeug.utils import import_string
 import time
 
-from gnuboat.common.webservice.Config import (
-    config_get
-)
-
-
-@pytest.fixture(scope='session')
-def configuration():
-    return import_string('gnuboat.device.Config.TestingConfig')
+from . import n2kdfake
 
 
 @pytest.fixture(scope='module')
-def gps_fake(configuration):
+def gps_fake():
     """
         Supplies a GPS Fake instance and cleans it up after the test ends.
@@ -43,5 +35,5 @@
     # is ended shortly after the fakelog has been at the end
     testsession = TestSession(
-        port=int(config_get(configuration, 'GPSD_PORT', 2947)),
+        port=2947,
         options="", verbose=0, timeout=1)
     testsession.spawn()
@@ -50,6 +42,19 @@
         testsession.cleanup()
     except gps.fake.TestSessionError as e:
-        if e.message == 'daemon died':
+        if e.message == 'Daemon died':
             pass
         else:
             raise e
+
+
+@pytest.fixture(scope='module')
+def n2kd_fake():
+    """
+        Supplies a N2KD Fake instance and cleans it up after the test ends.
+        To use it, you need to
+        1. add a n2kd fake request handler
+        2. call testsession.start()
+    """
+    n2kdfakesession = n2kdfake.N2kdFakeSession(host='127.0.0.1', port=2597)
+    yield n2kdfakesession
+    n2kdfakesession.shutdown()
Index: src/gnuboat/device/tests/data/n2kdfake-1.log
===================================================================
--- src/gnuboat/device/tests/data/n2kdfake-1.log	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
+++ src/gnuboat/device/tests/data/n2kdfake-1.log	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -0,0 +1,54 @@
+[
+	{
+		"128267":
+			{"description":"Water Depth"
+				,"35":{"timestamp":"2020-05-12-17:41:53.000","prio":3,"src":35,"dst":255,"pgn":128267,"description":"Water Depth","fields":{"Offset":0.000}}
+			},
+		"128259":
+			{"description":"Speed"
+				,"35":{"timestamp":"2020-05-12-17:41:53.000","prio":2,"src":35,"dst":255,"pgn":128259,"description":"Speed","fields":{"Speed Water Referenced":0.00,"Speed Water Referenced Type":"Paddle wheel"}}
+			},
+		"130311":
+			{"description":"Environmental Parameters"
+				,"35":{"timestamp":"2020-05-12-17:41:53.000","prio":5,"src":35,"dst":255,"pgn":130311,"description":"Environmental Parameters","fields":{"Temperature Source":"Sea Temperature","Temperature":24.73}}
+			},
+		"128275":
+			{"description":"Distance Log"
+				,"35":{"timestamp":"2020-05-12-17:41:53.000","prio":6,"src":35,"dst":255,"pgn":128275,"description":"Distance Log","fields":{"Log":16102,"Trip Log":16102}}
+			},
+		"130316":
+			{"description":"Temperature Extended Range"
+				,"35_0":{"timestamp":"2020-05-12-17:41:53.000","prio":5,"src":35,"dst":255,"pgn":130316,"description":"Temperature Extended Range","fields":{"Instance":0,"Source":"Sea Temperature","Temperature":24.72}}
+			},
+		"126720":
+			{"description":"Manufacturer Proprietary fast-packet addressed"
+				,"0":{"timestamp":"2020-05-12-17:41:53.000","prio":7,"src":0,"dst":255,"pgn":126720,"description":"Manufacturer Proprietary fast-packet addressed","fields":{ "Manufacturer Code": "Garmin","Industry Code":"Marine","Data":"f1 08 02 02 00 12 8c 00 00 "}}
+			}
+	},
+	{
+		"128267":
+			{"description":"Water Depth"
+				,"35":{"timestamp":"2020-05-16-09:35:50.000","prio":3,"src":35,"dst":255,"pgn":128267,"description":"Water Depth","fields":{"Offset":0.000}}
+			},
+		"128259":
+			{"description":"Speed"
+				,"35":{"timestamp":"2020-05-16-09:35:50.000","prio":2,"src":35,"dst":255,"pgn":128259,"description":"Speed","fields":{"Speed Water Referenced":0.50,"Speed Water Referenced Type":"Paddle wheel"}}
+			},
+		"130311":
+			{"description":"Environmental Parameters"
+			,"35":{"timestamp":"2020-05-16-09:35:50.000","prio":5,"src":35,"dst":255,"pgn":130311,"description":"Environmental Parameters","fields":{"Temperature Source":"Sea Temperature","Temperature":22.20}}
+			},
+		"128275":
+			{"description":"Distance Log"
+				,"35":{"timestamp":"2020-05-16-09:35:49.000","prio":6,"src":35,"dst":255,"pgn":128275,"description":"Distance Log","fields":{"Log":16109,"Trip Log":16109}}
+			},
+		"126720":
+			{"description":"Manufacturer Proprietary fast-packet addressed"
+				,"0":{"timestamp":"2020-05-16-09:35:50.000","prio":7,"src":0,"dst":255,"pgn":126720,"description":"Manufacturer Proprietary fast-packet addressed","fields":{ "Manufacturer Code": "Garmin","Industry Code":"Marine","Data":"f1 08 02 02 00 12 8c 00 00 "}}
+			},
+		"130316":
+			{"description":"Temperature Extended Range"
+				,"35_0":{"timestamp":"2020-05-16-09:35:49.000","prio":5,"src":35,"dst":255,"pgn":130316,"description":"Temperature Extended Range","fields":{"Instance":0,"Source":"Sea Temperature","Temperature":22.21}}
+			}
+	}
+]
Index: src/gnuboat/device/tests/n2kdfake.py
===================================================================
--- src/gnuboat/device/tests/n2kdfake.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
+++ src/gnuboat/device/tests/n2kdfake.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -0,0 +1,88 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+from socketserver import StreamRequestHandler, TCPServer
+import types
+import json
+import threading
+import time
+
+
+class N2kdFakeRequestHandler(StreamRequestHandler):
+    """
+        Returns a message per request from top to bottom
+    """
+    log = None
+    finished_event = None
+
+    def handle(self):
+        if self.log is None:
+            raise ValueError('No log to serve set or log is empty')
+        if len(self.log) < 1:
+            self.finished_event.set()
+            self.log = None
+            return
+        log_entry = self.log[0]
+        self.log.pop(0)
+        self.wfile.write(json.dumps(log_entry).encode('utf-8'))
+
+
+class N2kdFakeServer(TCPServer):
+    def __init__(self):
+        self.allow_reuse_address = True
+        super().__init__()
+
+
+class N2kdFakeSession:
+    """
+        Simulates an n2kd server from canboat.
+        To get messages, add a request_handler_log()
+        and than call start(). With every request,
+        one messages (from top to bottom) is served to the
+        client, until all messages are send out
+    """
+    def __init__(self, host='127.0.0.1', port=2597):
+        self._host = host
+        self._port = port
+        self._logfile = None
+        self._server = None
+        self._server_thread = None
+        self._finished_event = threading.Event()
+
+    def request_handler_log(self, logfile):
+        with open(logfile) as f:
+            self._log = json.load(f)
+
+    def start(self):
+        N2kdFakeRequestHandler.log = self._log
+        N2kdFakeRequestHandler.finished_event = self._finished_event
+        self._server = TCPServer((self._host, self._port),
+                                 N2kdFakeRequestHandler)
+        self._server_thread = threading.Thread(
+            target=self._server.serve_forever
+        )
+        self._server_thread.start()
+        time.sleep(0.5)
+        return self._finished_event
+
+    def shutdown(self):
+        if self._server is None:
+            return
+        self._server.shutdown()
+        if self._server_thread is None:
+            return
+        self._server_thread.join(10)
Index: src/gnuboat/device/tests/test_daemon.py
===================================================================
--- src/gnuboat/device/tests/test_daemon.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
+++ src/gnuboat/device/tests/test_daemon.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -0,0 +1,102 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import pytest
+import os
+import datetime
+import time
+import math
+import pytz
+import tempfile
+from pathlib import Path
+import shutil
+import threading
+
+from gnuboat.device.daemon import Daemon
+
+from . import gpsd_fakehook
+
+
+@pytest.fixture
+def gnuboat_daemon():
+    test_dir = Path(tempfile.mkdtemp(suffix='gnuboat-daemon-test'))
+    rrd_file = test_dir.joinpath('rrd.db')
+
+    daemon = Daemon.Daemon(
+        rrd_file, test_dir,
+        gpsd_host='127.0.0.1', gpsd_port=2947,
+        n2kd_host='127.0.0.1', n2kd_port=2597,
+    )
+    yield daemon
+    daemon.shutdown()
+    daemon.join(5)
+    shutil.rmtree(daemon.log_directory())
+
+
+@pytest.mark.sitepackages
+@pytest.mark.parametrize(
+    'n2kd_logfile, gps_logfile, results', [
+        (
+            os.path.join(os.path.dirname(__file__), 'data/n2kdfake-1.log'),
+            os.path.join(os.path.dirname(__file__), 'data/gpsfake-1.log'),
+            [
+                {
+                    'speed_through_water': 0,
+                    'distance_log': 16102,
+                    'distance_log_trip': 16102,
+                    'water_depth': 0,
+                    'water_depth_valid': False,
+                    'water_temperature': 24.73,
+                },
+                {
+                    'speed_through_water': 0,
+                    'distance_log': 16102,
+                    'distance_log_trip': 16102,
+                    'water_depth': 0,
+                    'water_depth_valid': False,
+                    'water_temperature': 24.77,
+                },
+            ]
+        )
+    ]
+)
+def test_daemon(gps_fake, n2kd_fake, gnuboat_daemon,
+                n2kd_logfile, gps_logfile, results):
+    n2kd_fake.request_handler_log(n2kd_logfile)
+    gps_fake.gps_add(
+        gps_logfile, pred=gpsd_fakehook,
+        speed=4800, oneshot=True)
+
+    n2kd_finished = n2kd_fake.start()
+    time.sleep(1)
+    gnuboat_daemon.start()
+    # get daemon a chance to start up
+    time.sleep(1)
+    # run gps fake
+    thread = threading.Thread(target=gps_fake.run)
+    thread.start()
+
+    found = []
+    while thread.is_alive() or not n2kd_finished.is_set():
+        time.sleep(0.25)
+        if thread.is_alive():
+            print('GPS running')
+        if n2kd_finished.is_set():
+            print('n2kd running')
+
+    assert gnuboat_daemon.rrd_database_file().is_file()
+    assert len(list(gnuboat_daemon.log_directory().glob('*.log'))) == 1
Index: src/gnuboat/device/tests/test_gpsd_poller.py
===================================================================
--- src/gnuboat/device/tests/test_gpsd_poller.py	(revision 0c8a692854a1f8c132f84ecd9e6c7d5af43de307)
+++ src/gnuboat/device/tests/test_gpsd_poller.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -25,23 +25,6 @@
 
 from gnuboat.device.daemon import gpsdpoller
-from gnuboat.common.webservice.Config import (
-    config_get
-)
 
-
-def fakehook(linenumber, fakegps):
-    """
-        Used as pred for gps fake device,
-        and indicates, when the device is ready
-        to generate data
-    """
-    if not fakegps.testload.sentences:
-        sys.stderr.write("fakegps: no sentences in test load.\n")
-        raise SystemExit(1)
-    if linenumber % len(fakegps.testload.sentences) == 0:
-        if linenumber > 0:
-            return False
-    time.sleep(1)
-    return True
+from . import gpsd_fakehook
 
 
@@ -51,9 +34,13 @@
 
 
-def assert_custom(result, error_text, gps_client):
-    if not result:
-        gps_client.stop()
-        gps_client.join()
-    assert result, error_text
+@pytest.fixture
+def gpsd_poller():
+    ready_event = threading.Event()
+    gps_client = gpsdpoller.GpsdPoller(
+        port=2947,
+        ready_event=ready_event)
+    yield (gps_client, ready_event)
+    gps_client.stop()
+    gps_client.join(5)
 
 
@@ -108,12 +95,10 @@
     ]
 )
-def test_gpsdpoller(configuration, gps_fake, gps_logfile, results):
+def test_gpsdpoller(gps_fake, gpsd_poller, gps_logfile, results):
     gps_fake.gps_add(
-        gps_logfile, pred=fakehook,
+        gps_logfile, pred=gpsd_fakehook,
         speed=4800, oneshot=True)
-    ready_event = threading.Event()
-    gps_client = gpsdpoller.GpsdPoller(
-        port=int(config_get(configuration, 'GPSD_PORT', 2947)),
-        ready_event=ready_event)
+    gps_client = gpsd_poller[0]
+    ready_event = gpsd_poller[1]
     gps_client.start()
     ready_event.wait(10)
@@ -130,39 +115,24 @@
             key = gps_time.strftime('%d%m%y%H%M%S')
             if key in results:
-                assert_custom(
-                    math.isclose(
+                assert math.isclose(
                         longitude, results[key]['longitude'], rel_tol=1e-6
-                    ),
-                    'Wrong longitude {} vs. {}'.format(
+                    ), 'Wrong longitude {} vs. {}'.format(
                         longitude, results[key]['longitude']
-                    ), gps_client
-                )
-                assert_custom(
-                    math.isclose(
+                    )
+                assert math.isclose(
                         latitude, results[key]['latitude'], rel_tol=1e-6
-                    ),
-                    'Wrong latitude {} vs. {}'.format(
+                    ), 'Wrong latitude {} vs. {}'.format(
                         latitude, results[key]['latitude']
-                    ), gps_client
-                )
-                assert_custom(fix >= 2, 'No fix, where expected', gps_client)
-                assert_custom(
-                    gps_time == results[key]['datetime'],
+                    )
+                assert fix >= 2, 'No fix, where expected'
+                assert gps_time == results[key]['datetime'], \
                     'Wrong time {} vs {}'.format(
                         gps_client.time_utc().isoformat('T'),
                         results[key]['datetime'].isoformat('T')
-                    ), gps_client
-                )
+                    )
                 if key not in found:
                     found.append(key)
         time.sleep(0.25)
     missed = abs(len(results) - len(found))
-    assert_custom(
-        missed < 2,
-        'Missed {} out of {} messages'.format(missed, len(results)),
-        gps_client
-    )
-
-    gps_fake.cleanup()
-    gps_client.stop()
-    gps_client.join()
+    assert missed < 2, \
+        'Missed {} out of {} messages'.format(missed, len(results))
Index: src/gnuboat/device/tests/test_n2kd_poller.py
===================================================================
--- src/gnuboat/device/tests/test_n2kd_poller.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
+++ src/gnuboat/device/tests/test_n2kd_poller.py	(revision fffb0742608aa726325595724bfd387ec5db3f4f)
@@ -0,0 +1,66 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import pytest
+import os
+
+from gnuboat.device.daemon import n2kdpoller
+
+
+@pytest.mark.parametrize(
+    'n2kd_logfile, results', [
+        (
+            os.path.join(os.path.dirname(__file__), 'data/n2kdfake-1.log'),
+            [
+                {
+                    'speed_through_water': 0,
+                    'distance_log': 16102,
+                    'distance_log_trip': 16102,
+                    'water_depth': 0,
+                    'water_depth_valid': False,
+                    'water_temperature': 24.73,
+                },
+                {
+                    'speed_through_water': 0.50,
+                    'distance_log': 16109,
+                    'distance_log_trip': 16109,
+                    'water_depth': 0,
+                    'water_depth_valid': False,
+                    'water_temperature': 22.20,
+                },
+            ]
+        )
+    ]
+)
+def test_n2kdpoller(n2kd_fake, n2kd_logfile, results):
+    n2kd_fake.request_handler_log(n2kd_logfile)
+    n2kd_fake.start()
+
+    n2kd_client = n2kdpoller.N2kdPoller(host='127.0.0.1', port=2597)
+
+    assert not n2kd_client.water_depth_valid()
+    for result in results:
+        n2kd_client._loadData()
+        assert n2kd_client.speed_through_water() == \
+            result['speed_through_water']
+        assert n2kd_client.distance_log() == result['distance_log']
+        assert n2kd_client.distance_log_trip() == result['distance_log_trip']
+        assert n2kd_client.water_depth() == result['water_depth']
+        assert n2kd_client.water_depth_valid() == result['water_depth_valid']
+        assert n2kd_client.water_temperature() == result['water_temperature']
+    n2kd_client._loadData()
+    assert not n2kd_client.water_depth_valid()
