diff --git a/.gitignore b/.gitignore
index 04aa2b084ddc6d8d1b58fc698e19b2ed5282f148..3220182041870c28f9cd133e996d01f2e884dbd4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,18 @@
 docs/_build/
 dist/
 
+# coverage
+.coverage
+htmlcov
+coverage.xml
+
+# pytest
+report.xml
+
+# pylint
+pylint.html
+codeclimate.json
+
 *.egg-info
 __pycache__
 *.pyc
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f9e37d8da52edafab41db5b09eeeb5b33b29dd2..6717ddc8a0552d34003104fea7d41c06bc51e276 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ linter:
   stage: test
   image: python:3.7
   script:
-  - pip3 install pylint-gitlab # this force-updates jinja2 and some other packages!
+  - pip install pylint-gitlab
   - python3 -m pylint --exit-zero --rcfile .pylintrc --output-format=pylint_gitlab.GitlabCodeClimateReporter src/ldapserver > codeclimate.json || true
   - python3 -m pylint --exit-zero --rcfile .pylintrc --output-format=pylint_gitlab.GitlabPagesHtmlReporter src/ldapserver > pylint.html || true
   - python3 -m pylint --rcfile .pylintrc --output-format=text src/ldapserver
@@ -14,8 +14,28 @@ linter:
     reports:
       codequality: codeclimate.json
 
+test:
+  stage: test
+  image: python:3.7
+  script:
+  - pip install pytest coverage
+  - PYTHONPATH=src coverage run --include 'src/*.py' -m pytest --junitxml=report.xml
+  - coverage report -m
+  - coverage html
+  - coverage xml
+  artifacts:
+    when: always
+    paths:
+    - htmlcov/index.html
+    - htmlcov
+    expose_as: 'Coverage Report'
+    reports:
+      cobertura: coverage.xml
+      junit: report.xml
+  coverage: '/^TOTAL.*\s+(\d+\%)$/'
+
 build-docs:
-  stage: build
+  stage: deploy
   image: python:3.7
   script:
   - pip install Sphinx sphinx-rtd-theme
diff --git a/tests/test_dummy.py b/tests/test_dummy.py
new file mode 100644
index 0000000000000000000000000000000000000000..6308729829b85d737d0b1d73aad6ef83815532b4
--- /dev/null
+++ b/tests/test_dummy.py
@@ -0,0 +1,8 @@
+import unittest
+
+# Test if imports work in tests
+from ldapserver.dn import DN
+
+class TestDummy(unittest.TestCase):
+	def test_dummy(self):
+		DN('cn=foobar') == DN('CN=foobar')