diff --git a/.gitignore b/.gitignore
index 4554ccf6728b440fa6f258522eba887cf2a52002..f3533710ef7a0e1cbbcb5b7cb2cdafa7fa65182e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,9 @@
 *.pytest_cache*
 # ignore Sphinx documentation output
 *docs/build
+# Ignore coverage files
+.coverage
+htmlcov
 # Ignore pip folder
 *egg-info/*
 # Ignore venv files
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f5d26fc7251ed9be14c3ecc5b2cb3b8ed5a6a5b9..cf48a9893491dfad76186cc52280e827e6dcf4e3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -49,7 +49,13 @@ test:
   tags:
     - docker
   script:
-    - python -m pytest # Run the tests
+    -  pytest --cov=fxdgm --cov-report=term --cov-report=html tests/ # Run the tests and store coverage 
+  artifacts:
+    paths:
+      - htmlcov # Save the coverage report
+    expire_in: 12 month  # Optional: Set how long to keep the artifacts (default: 30 days)
+  coverage: '/^TOTAL.*\s+(\d+\%)$/'
+
   
 # Job to deploy documentation to GitLab Pages
 pages:
diff --git a/Dockerfile b/Dockerfile
index 91e3e3568f5ec1042a560a223d9f6bedbffeb98c..ae690b60b79e6b0d79cec16295f8480bf5075510 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 # Start with a base image that includes conda
-FROM continuumio/miniconda3
+FROM continuumio/miniconda3:latest
 
 # Set environment variables
 ENV CONDA_DEFAULT_ENV=base
@@ -8,14 +8,10 @@ ENV HOME /root
 
 # Create the environment and install packages
 # FEniCSx backend + documentation and testing dependencies
-RUN conda install -n ${CONDA_DEFAULT_ENV} -c conda-forge fenics-dolfinx=0.8.0 mpich=4.2.1 pyvista=0.43.10 gcc=12.4.0 sphinx=7.3.7 myst-parser=4.0.0 sphinx-copybutton=0.5.2 sphinx-rtd-theme=3.0.1 pytest==8.3.3 -y
-# fxdgm package from git
-
-# Activate environment
-# SHELL ["conda", "run", "-n", "fenicsx-env", "/bin/bash", "-c"]
+# sqlite for coverage, it necessary
+RUN conda install -n ${CONDA_DEFAULT_ENV} -c conda-forge fenics-dolfinx=0.8.0 mpich=4.2.1 pyvista=0.43.10 gcc=12.4.0 sphinx=7.3.7 myst-parser=4.0.0 sphinx-copybutton=0.5.2 sphinx-rtd-theme=3.0.1 pytest=8.3.3 pytest-cov=6.0.0 sqlite=3.41.2 -y
 
 WORKDIR /root
-# WORKDIR /solver
 
 ADD . /fxdgm
 RUN pip install --editable /fxdgm/.
diff --git a/fxdgm/ElectrolyticDiode.py b/fxdgm/ElectrolyticDiode.py
index 836b48c19f548142f22d74f01577dde207448d40..5016d424344596edacd7af66c3d2ac068a7876a2 100644
--- a/fxdgm/ElectrolyticDiode.py
+++ b/fxdgm/ElectrolyticDiode.py
@@ -337,7 +337,7 @@ def ElectrolyticDiode(Bias_type:str, phi_bias:float, g_phi:float, z_A:float, z_C
     else:
         raise ValueError('Invalid return_type')
 
-if __name__ == '__main__':
+if __name__ == '__main__': # pragma: no cover # dont cover main in coverage
     phi_bias = 10#10
     Bias_type = 'ForwardBias' # 'ForwardBias', 'NoBias', 'BackwardBias'
     g_phi = 350#5
diff --git a/fxdgm/Eq02.py b/fxdgm/Eq02.py
index bf40e4165e2fe706d5ec02d6081faacabb06e358..b006ed30b3dc3e429869cf2d16d59ba54dac39f7 100644
--- a/fxdgm/Eq02.py
+++ b/fxdgm/Eq02.py
@@ -242,7 +242,7 @@ def solve_System_2eq(phi_left:float, phi_right:float, p_right:float, z_A:float,
         
         return y_A_vals, y_C_vals, phi_vals, p_vals, x_vals
     
-if __name__ == '__main__':
+if __name__ == '__main__': # pragma: no cover # dont cover main in coverage
     # Define the parameters
     phi_left = 5.0
     phi_right = 0.0
diff --git a/fxdgm/Eq04.py b/fxdgm/Eq04.py
index a370fffc787d8e08fd2e20a613ce08fe14630b94..95cbdf92e67930a15631bc3030e077952a7d9eca 100644
--- a/fxdgm/Eq04.py
+++ b/fxdgm/Eq04.py
@@ -274,7 +274,7 @@ def solve_System_4eq(phi_left:float, phi_right:float, p_right:float, z_A:float,
         return y_A, y_C, phi, p, msh
     
     
-if __name__ == '__main__':
+if __name__ == '__main__': # pragma: no cover # dont cover main in coverage
     # Define the parameters
     phi_left = 10.0
     phi_right = 0.0
diff --git a/fxdgm/EqN.py b/fxdgm/EqN.py
index b24a07734fbd85973ca6ec48f979286c5aa725c0..5c847d92dd7439f830c14618eb573ff57f6efb8a 100644
--- a/fxdgm/EqN.py
+++ b/fxdgm/EqN.py
@@ -238,7 +238,7 @@ def solve_System_Neq(phi_left:float, phi_right:float, p_right:float, z_alpha:lis
         return y, phi, p, x
     
     
-if __name__ == '__main__':
+if __name__ == '__main__': # pragma: no cover # dont cover main in coverage
     # Define the parameters
     phi_left = 8.0
     phi_right = 0.0