Repository: input-output-hk/mithril
Pull request #670 (2022-12-22 14:27:40)

Add MithrilFixture builder
## Content

This PR includes refactor the way to construct test signers by adding the `MithrilFixtureBuilder` that allow to generate them alongside a stake distribution.

## Pre-submit checklist

- Branch
  - [x] Tests are provided (if possible)
  - [x] Commit sequence broadly makes sense
  - [x] Key commits have useful messages
- PR
  - [x] No clippy warnings in the CI
  - [x] Self-reviewed the diff
  - [x] Useful pull request description
  - [x] Reviewer requested

## Comments

This PR also reorganizes the test helpers in mithril common by moving the `apispec` & `fake_data` to the new `test_utils` module.
Also all mithril-common test helpers are now behind the `test-only` feature.

## Issue(s)

Relates to #663


Patch:
diff --git a/mithril-aggregator/src/certificate_creator.rs b/mithril-aggregator/src/certificate_creator.rs
index 387636577..acc3fbb6c 100644
--- a/mithril-aggregator/src/certificate_creator.rs
+++ b/mithril-aggregator/src/certificate_creator.rs
@@ -14,9 +14,9 @@ pub enum CertificateCreationError {
     Codec(String),
 }
 
-/// Define a way to create a [Certificate]
+/// Define a way to create a [Certificate][mithril_common::entities::Certificate]
 pub trait CertificateCreator {
-    /// Create a [Certificate]
+    /// Create a [Certificate][mithril_common::entities::Certificate]
     fn create_certificate(
         working: &WorkingCertificate,
         signatures_party_ids: &[PartyId],
diff --git a/mithril-aggregator/src/dependency.rs b/mithril-aggregator/src/dependency.rs
index 44e4ac6bd..fa81bd0bf 100644
--- a/mithril-aggregator/src/dependency.rs
+++ b/mithril-aggregator/src/dependency.rs
@@ -188,7 +188,7 @@ impl DependencyManager {
     /// * Fill the [VerificationKeyStore] with the given signers keys.
     /// * Fill the [StakeStore] with the given signers stakes.
     /// * Fill the [ProtocolParametersStore] with the given parameters.
-    pub async fn simulate_genesis(
+    pub async fn prepare_for_genesis(
         &self,
         genesis_signers: Vec<SignerWithStake>,
         second_epoch_signers: Vec<SignerWithStake>,
@@ -255,13 +255,13 @@ pub mod tests {
         MithrilSignerRegisterer, MultiSignerImpl, ProtocolParametersStore, SingleSignatureStore,
         SnapshotStoreType, SnapshotUploaderType, VerificationKeyStore,
     };
-    use mithril_common::certificate_chain::MithrilCertificateVerifier;
-    use mithril_common::crypto_helper::{key_encode_hex, ProtocolGenesisSigner};
-    use mithril_common::digesters::{DumbImmutableDigester, DumbImmutableFileObserver};
     use mithril_common::{
+        certificate_chain::MithrilCertificateVerifier,
         chain_observer::FakeObserver,
-        fake_data,
+        crypto_helper::{key_encode_hex, ProtocolGenesisSigner},
+        digesters::{DumbImmutableDigester, DumbImmutableFileObserver},
         store::{adapter::MemoryAdapter, StakeStore},
+        test_utils::fake_data,
         BeaconProviderImpl, CardanoNetwork,
     };
     use std::{path::PathBuf, sync::Arc};
diff --git a/mithril-aggregator/src/http_server/routes/certificate_routes.rs b/mithril-aggregator/src/http_server/routes/certificate_routes.rs
index e7ca841d6..dc3784e84 100644
--- a/mithril-aggregator/src/http_server/routes/certificate_routes.rs
+++ b/mithril-aggregator/src/http_server/routes/certificate_routes.rs
@@ -82,9 +82,9 @@ mod tests {
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
     use crate::http_server::SERVER_BASE_PATH;
-    use mithril_common::apispec::APISpec;
     use mithril_common::store::adapter::FailStoreAdapter;
-    use mithril_common::{entities, fake_data};
+    use mithril_common::test_utils::apispec::APISpec;
+    use mithril_common::{entities, test_utils::fake_data};
     use serde_json::Value::Null;
     use warp::http::Method;
     use warp::test::request;
diff --git a/mithril-aggregator/src/http_server/routes/epoch_routes.rs b/mithril-aggregator/src/http_server/routes/epoch_routes.rs
index 661762182..8fbb7bb65 100644
--- a/mithril-aggregator/src/http_server/routes/epoch_routes.rs
+++ b/mithril-aggregator/src/http_server/routes/epoch_routes.rs
@@ -84,7 +84,7 @@ mod tests {
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
     use crate::http_server::SERVER_BASE_PATH;
-    use mithril_common::apispec::APISpec;
+    use mithril_common::test_utils::apispec::APISpec;
     use serde_json::Value::Null;
     use warp::http::Method;
     use warp::test::request;
diff --git a/mithril-aggregator/src/http_server/routes/signatures_routes.rs b/mithril-aggregator/src/http_server/routes/signatures_routes.rs
index 090e1e196..e5b2381b6 100644
--- a/mithril-aggregator/src/http_server/routes/signatures_routes.rs
+++ b/mithril-aggregator/src/http_server/routes/signatures_routes.rs
@@ -56,8 +56,8 @@ mod tests {
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
     use crate::http_server::SERVER_BASE_PATH;
-    use mithril_common::apispec::APISpec;
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::apispec::APISpec;
+    use mithril_common::test_utils::fake_data;
     use tokio::sync::RwLock;
     use warp::http::Method;
     use warp::test::request;
diff --git a/mithril-aggregator/src/http_server/routes/signer_routes.rs b/mithril-aggregator/src/http_server/routes/signer_routes.rs
index 22dce6555..2f4a51a3a 100644
--- a/mithril-aggregator/src/http_server/routes/signer_routes.rs
+++ b/mithril-aggregator/src/http_server/routes/signer_routes.rs
@@ -67,9 +67,9 @@ mod handlers {
 mod tests {
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
-    use mithril_common::apispec::APISpec;
     use mithril_common::crypto_helper::ProtocolRegistrationError;
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::apispec::APISpec;
+    use mithril_common::test_utils::fake_data;
     use warp::http::Method;
     use warp::test::request;
 
diff --git a/mithril-aggregator/src/http_server/routes/snapshot_routes.rs b/mithril-aggregator/src/http_server/routes/snapshot_routes.rs
index f69342ca4..aac666a4a 100644
--- a/mithril-aggregator/src/http_server/routes/snapshot_routes.rs
+++ b/mithril-aggregator/src/http_server/routes/snapshot_routes.rs
@@ -169,8 +169,8 @@ mod tests {
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
     use crate::http_server::SERVER_BASE_PATH;
-    use mithril_common::apispec::APISpec;
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::apispec::APISpec;
+    use mithril_common::test_utils::fake_data;
     use serde_json::Value::Null;
 
     use crate::initialize_dependencies;
diff --git a/mithril-aggregator/src/multi_signer.rs b/mithril-aggregator/src/multi_signer.rs
index 39b406279..7309bd5e1 100644
--- a/mithril-aggregator/src/multi_signer.rs
+++ b/mithril-aggregator/src/multi_signer.rs
@@ -727,8 +727,8 @@ mod tests {
     };
     use mithril_common::{
         crypto_helper::tests_setup::*,
-        fake_data,
         store::{adapter::MemoryAdapter, StakeStore},
+        test_utils::{fake_data, MithrilFixtureBuilder},
     };
     use std::{collections::HashMap, sync::Arc};
 
@@ -861,17 +861,9 @@ mod tests {
     #[tokio::test]
     async fn test_multi_signer_stake_distribution_ok() {
         let mut multi_signer = setup_multi_signer().await;
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let mut stake_distribution_expected = fixture.protocol_stake_distribution();
 
-        let mut stake_distribution_expected: ProtocolStakeDistribution =
-            setup_signers(5, &setup_protocol_parameters())
-                .iter()
-                .map(|(signer_with_stake, _, _)| {
-                    (
-                        signer_with_stake.party_id.to_owned(),
-                        signer_with_stake.stake,
-                    )
-                })
-                .collect::<_>();
         stake_distribution_expected.sort_by_key(|k| k.0.clone());
         multi_signer
             .update_stake_distribution(&stake_distribution_expected)
@@ -918,22 +910,15 @@ mod tests {
             .await
             .expect("update protocol parameters failed");
 
-        let signers = setup_signers(5, &protocol_parameters);
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+
+        let stake_distribution = fixture.protocol_stake_distribution();
 
-        let stake_distribution = &signers
-            .iter()
-            .map(|(signer_with_stake, _, _)| {
-                (
-                    signer_with_stake.party_id.to_owned(),
-                    signer_with_stake.stake,
-                )
-            })
-            .collect::<_>();
         multi_signer
-            .update_stake_distribution(stake_distribution)
+            .update_stake_distribution(&stake_distribution)
             .await
             .expect("update stake distribution failed");
-        for (signer_with_stake, _, _) in &signers {
+        for signer_with_stake in &fixture.signers_with_stake() {
             verification_key_store
                 .save_verification_key(
                     start_epoch.offset_to_recording_epoch(),
@@ -959,17 +944,20 @@ mod tests {
         let mut signatures = Vec::new();
 
         let mut expected_certificate_signers: Vec<SignerWithStake> = Vec::new();
-        for (signer_with_stake, protocol_signer, _protocol_initializer) in &signers {
-            if let Some(signature) = protocol_signer.sign(message.compute_hash().as_bytes()) {
+        for signer_fixture in fixture.signers_fixture() {
+            if let Some(signature) = signer_fixture
+                .protocol_signer
+                .sign(message.compute_hash().as_bytes())
+            {
                 let won_indexes = signature.indexes.clone();
 
                 signatures.push(entities::SingleSignatures::new(
-                    signer_with_stake.party_id.to_owned(),
+                    signer_fixture.signer_with_stake.party_id.to_owned(),
                     key_encode_hex(signature).unwrap(),
                     won_indexes,
                 ));
 
-                expected_certificate_signers.push(signer_with_stake.to_owned())
+                expected_certificate_signers.push(signer_fixture.signer_with_stake.to_owned())
             }
         }
 
diff --git a/mithril-aggregator/src/runtime/runner.rs b/mithril-aggregator/src/runtime/runner.rs
index 34805e485..d877414fb 100644
--- a/mithril-aggregator/src/runtime/runner.rs
+++ b/mithril-aggregator/src/runtime/runner.rs
@@ -615,16 +615,16 @@ pub mod tests {
     use crate::{MithrilSignerRegisterer, ProtocolParametersStorer, SignerRegistrationRound};
     use mithril_common::chain_observer::FakeObserver;
     use mithril_common::crypto_helper::{
-        key_decode_hex,
-        tests_setup::{setup_certificate_chain, setup_signers},
-        ProtocolMultiSignature,
+        key_decode_hex, tests_setup::setup_certificate_chain, ProtocolMultiSignature,
     };
     use mithril_common::digesters::DumbImmutableFileObserver;
     use mithril_common::entities::{
-        Beacon, CertificatePending, Epoch, HexEncodedKey, ProtocolMessage, SignerWithStake,
-        StakeDistribution,
+        Beacon, CertificatePending, Epoch, HexEncodedKey, ProtocolMessage, StakeDistribution,
+    };
+    use mithril_common::test_utils::MithrilFixtureBuilder;
+    use mithril_common::{
+        entities::ProtocolMessagePartKey, store::StakeStorer, test_utils::fake_data,
     };
-    use mithril_common::{entities::ProtocolMessagePartKey, fake_data, store::StakeStorer};
     use mithril_common::{BeaconProviderImpl, CardanoNetwork};
     use std::collections::HashMap;
     use std::path::Path;
@@ -696,10 +696,18 @@ pub mod tests {
 
     #[tokio::test]
     async fn test_update_stake_distribution() {
-        let (deps, config) = initialize_dependencies().await;
+        let (mut deps, config) = initialize_dependencies().await;
+        let chain_observer = Arc::new(FakeObserver::default());
+        deps.chain_observer = chain_observer.clone();
         let deps = Arc::new(deps);
         let runner = AggregatorRunner::new(config, deps.clone());
         let beacon = runner.get_beacon_from_chain().await.unwrap();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let expected = fixture.stake_distribution();
+
+        chain_observer
+            .set_signers(fixture.signers_with_stake())
+            .await;
         runner
             .update_beacon(&beacon)
             .await
@@ -709,13 +717,6 @@ pub mod tests {
             .await
             .expect("updating stake distribution should not return an error");
 
-        let current_stake_distribution = deps
-            .chain_observer
-            .get_current_stake_distribution()
-            .await
-            .unwrap()
-            .expect("The stake distribution should not be None.");
-
         let saved_stake_distribution = deps
             .stake_store
             .get_stakes(beacon.epoch.offset_to_recording_epoch())
@@ -728,13 +729,7 @@ pub mod tests {
                 )
             });
 
-        assert_eq!(
-            current_stake_distribution.len(),
-            saved_stake_distribution.len()
-        );
-        for (party_id, stake) in current_stake_distribution.iter() {
-            assert_eq!(stake, saved_stake_distribution.get(party_id).unwrap());
-        }
+        assert_eq!(expected, saved_stake_distribution);
     }
 
     #[tokio::test]
@@ -815,11 +810,11 @@ pub mod tests {
         let beacon = runner.get_beacon_from_chain().await.unwrap();
         runner.update_beacon(&beacon).await.unwrap();
 
-        let signers = fake_data::signers_with_stakes(5);
-        let current_signers = signers[1..3].to_vec();
-        let next_signers = signers[2..5].to_vec();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let current_signers = fixture.signers_with_stake()[1..3].to_vec();
+        let next_signers = fixture.signers_with_stake()[2..5].to_vec();
         let protocol_parameters = fake_data::protocol_parameters();
-        deps.simulate_genesis(
+        deps.prepare_for_genesis(
             current_signers.clone(),
             next_signers.clone(),
             &protocol_parameters.clone(),
@@ -853,17 +848,12 @@ pub mod tests {
         let beacon = runner.get_beacon_from_chain().await.unwrap();
         runner.update_beacon(&beacon).await.unwrap();
 
-        let protocol_parameters = fake_data::protocol_parameters();
-        let signers = setup_signers(5, &protocol_parameters.clone().into())
-            .into_iter()
-            .map(|s| s.0)
-            .collect::<Vec<SignerWithStake>>();
-        let current_signers = signers[1..3].to_vec();
-        let next_signers = signers[2..5].to_vec();
-        deps.simulate_genesis(
-            current_signers.clone(),
-            next_signers.clone(),
-            &protocol_parameters.clone(),
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+
+        deps.prepare_for_genesis(
+            fixture.signers_with_stake(),
+            fixture.signers_with_stake(),
+            &fixture.protocol_parameters(),
         )
         .await;
 
@@ -902,7 +892,7 @@ pub mod tests {
 
         let mut expected = WorkingCertificate::from_pending_certificate(
             &certificate_pending,
-            &current_signers,
+            &fixture.signers_with_stake(),
             &message,
             &aggregate_verification_key,
             &sut.initiated_at,
@@ -956,18 +946,15 @@ pub mod tests {
         let (deps, config) = initialize_dependencies().await;
         let deps = Arc::new(deps);
         let runner = AggregatorRunner::new(config, deps.clone());
-        let beacon = runner.get_beacon_from_chain().await.unwrap();
         let digest = "1+2+3+4=10".to_string();
-        runner.update_beacon(&beacon).await.unwrap();
-        for epoch in [
-            beacon.epoch.offset_to_signer_retrieval_epoch().unwrap(),
-            beacon.epoch.offset_to_next_signer_retrieval_epoch(),
-        ] {
-            deps.protocol_parameters_store
-                .save_protocol_parameters(epoch, fake_data::protocol_parameters())
-                .await
-                .unwrap();
-        }
+        runner.update_beacon(&fake_data::beacon()).await.unwrap();
+        let fixture = MithrilFixtureBuilder::default().build();
+        deps.prepare_for_genesis(
+            fixture.signers_with_stake(),
+            fixture.signers_with_stake(),
+            &fixture.protocol_parameters(),
+        )
+        .await;
 
         runner
             .update_message_in_multisigner(digest)
@@ -1061,15 +1048,8 @@ pub mod tests {
             .expect_get_multi_signature()
             .return_once(move || Ok(Some(multi_signature)));
         deps.multi_signer = Arc::new(RwLock::new(mock_multi_signer));
-        let certificate_store = deps.certificate_store.clone();
+        deps.init_state_from_chain(&certificate_chain, vec![]).await;
         let runner = AggregatorRunner::new(config, Arc::new(deps));
-        for certificate in certificate_chain[1..].iter().rev() {
-            certificate_store
-                .as_ref()
-                .save(certificate.to_owned())
-                .await
-                .expect("save certificate to store should not fail");
-        }
 
         let certificate = runner
             .create_and_save_certificate(&working_certificate)
diff --git a/mithril-aggregator/src/runtime/state_machine.rs b/mithril-aggregator/src/runtime/state_machine.rs
index 7987762a8..92e12125e 100644
--- a/mithril-aggregator/src/runtime/state_machine.rs
+++ b/mithril-aggregator/src/runtime/state_machine.rs
@@ -322,7 +322,7 @@ mod tests {
 
     use super::super::runner::MockAggregatorRunner;
     use super::*;
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::fake_data;
     use mockall::predicate;
 
     async fn init_runtime(
diff --git a/mithril-aggregator/src/runtime/working_certificate.rs b/mithril-aggregator/src/runtime/working_certificate.rs
index d5eefa569..edf35f048 100644
--- a/mithril-aggregator/src/runtime/working_certificate.rs
+++ b/mithril-aggregator/src/runtime/working_certificate.rs
@@ -52,7 +52,7 @@ impl WorkingCertificate {
 
     #[cfg(test)]
     pub fn fake() -> Self {
-        use mithril_common::fake_data;
+        use mithril_common::test_utils::fake_data;
 
         Self {
             beacon: fake_data::beacon(),
diff --git a/mithril-aggregator/src/signer_registerer.rs b/mithril-aggregator/src/signer_registerer.rs
index b8240a1dd..ff03bd98c 100644
--- a/mithril-aggregator/src/signer_registerer.rs
+++ b/mithril-aggregator/src/signer_registerer.rs
@@ -201,10 +201,9 @@ mod tests {
 
     use mithril_common::{
         chain_observer::FakeObserver,
-        crypto_helper::tests_setup::setup_signers,
         entities::{Epoch, PartyId, Signer},
-        fake_data,
         store::adapter::MemoryAdapter,
+        test_utils::MithrilFixtureBuilder,
     };
 
     use crate::{
@@ -222,13 +221,9 @@ mod tests {
         let signer_registerer =
             MithrilSignerRegisterer::new(Arc::new(chain_observer), verification_key_store.clone());
         let registration_epoch = Epoch(1);
-        let signers = setup_signers(5, &fake_data::protocol_parameters().into());
-        let signer_to_register: Signer = signers[0].0.clone().into();
-        assert!(signer_to_register.operational_certificate.is_some());
-        let stake_distribution = signers
-            .into_iter()
-            .map(|s| (s.0.party_id, s.0.stake))
-            .collect::<HashMap<_, _>>();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signer_to_register: Signer = fixture.signers()[0].to_owned();
+        let stake_distribution = fixture.stake_distribution();
 
         signer_registerer
             .open_registration_round(registration_epoch, stake_distribution)
@@ -264,13 +259,12 @@ mod tests {
         let signer_registerer =
             MithrilSignerRegisterer::new(Arc::new(chain_observer), verification_key_store.clone());
         let registration_epoch = Epoch(1);
-        let signers = setup_signers(5, &fake_data::protocol_parameters().into());
-        let signer_to_register: Signer = signers[1].0.clone().into();
-        assert!(signer_to_register.operational_certificate.is_none());
-        let stake_distribution = signers
-            .into_iter()
-            .map(|s| (s.0.party_id, s.0.stake))
-            .collect::<HashMap<_, _>>();
+        let fixture = MithrilFixtureBuilder::default()
+            .with_signers(5)
+            .disable_signers_certification()
+            .build();
+        let signer_to_register: Signer = fixture.signers()[0].to_owned();
+        let stake_distribution = fixture.stake_distribution();
 
         signer_registerer
             .open_registration_round(registration_epoch, stake_distribution)
@@ -305,8 +299,8 @@ mod tests {
         ));
         let signer_registerer =
             MithrilSignerRegisterer::new(Arc::new(chain_observer), verification_key_store.clone());
-        let signers = setup_signers(5, &fake_data::protocol_parameters().into());
-        let signer_to_register: Signer = signers[1].0.clone().into();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signer_to_register: Signer = fixture.signers()[0].to_owned();
 
         signer_registerer
             .register_signer(&signer_to_register)
diff --git a/mithril-aggregator/src/snapshot_stores/local_snapshot_store.rs b/mithril-aggregator/src/snapshot_stores/local_snapshot_store.rs
index 333f60308..a0a3be989 100644
--- a/mithril-aggregator/src/snapshot_stores/local_snapshot_store.rs
+++ b/mithril-aggregator/src/snapshot_stores/local_snapshot_store.rs
@@ -76,8 +76,8 @@ mod tests {
     use crate::SnapshotStore;
 
     use mithril_common::entities::Snapshot;
-    use mithril_common::fake_data;
     use mithril_common::store::adapter::DumbStoreAdapter;
+    use mithril_common::test_utils::fake_data;
 
     #[tokio::test]
     async fn can_list_added_snapshot() {
diff --git a/mithril-aggregator/src/snapshot_stores/remote_snapshot_store.rs b/mithril-aggregator/src/snapshot_stores/remote_snapshot_store.rs
index 4e2b73f72..e2b76d59c 100644
--- a/mithril-aggregator/src/snapshot_stores/remote_snapshot_store.rs
+++ b/mithril-aggregator/src/snapshot_stores/remote_snapshot_store.rs
@@ -86,7 +86,7 @@ impl SnapshotStore for RemoteSnapshotStore {
 mod tests {
     use super::*;
     use httpmock::prelude::*;
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::fake_data;
     use serde_json::json;
 
     use crate::tools::MockRemoteFileUploader;
diff --git a/mithril-aggregator/src/store/certificate_store.rs b/mithril-aggregator/src/store/certificate_store.rs
index 055482b43..adec31112 100644
--- a/mithril-aggregator/src/store/certificate_store.rs
+++ b/mithril-aggregator/src/store/certificate_store.rs
@@ -82,8 +82,8 @@ impl CertificateRetriever for CertificateStore {
 mod test {
     use super::*;
 
-    use mithril_common::fake_data::{self};
     use mithril_common::store::adapter::MemoryAdapter;
+    use mithril_common::test_utils::fake_data::{self};
 
     async fn get_certificate_store(size: u64) -> CertificateStore {
         let mut beacon = Beacon::new("devnet".to_string(), 1, 1);
diff --git a/mithril-aggregator/src/store/pending_certificate_store.rs b/mithril-aggregator/src/store/pending_certificate_store.rs
index 3f5bf5d77..112cf44d9 100644
--- a/mithril-aggregator/src/store/pending_certificate_store.rs
+++ b/mithril-aggregator/src/store/pending_certificate_store.rs
@@ -57,8 +57,8 @@ mod test {
     use super::*;
 
     use mithril_common::entities::Beacon;
-    use mithril_common::fake_data;
     use mithril_common::store::adapter::DumbStoreAdapter;
+    use mithril_common::test_utils::fake_data;
 
     async fn get_certificate_pending_store(is_populated: bool) -> CertificatePendingStore {
         let mut adapter: DumbStoreAdapter<String, CertificatePending> = DumbStoreAdapter::new();
diff --git a/mithril-aggregator/src/store/protocol_parameters_store.rs b/mithril-aggregator/src/store/protocol_parameters_store.rs
index f41139e7f..32d764b2a 100644
--- a/mithril-aggregator/src/store/protocol_parameters_store.rs
+++ b/mithril-aggregator/src/store/protocol_parameters_store.rs
@@ -86,7 +86,7 @@ impl ProtocolParametersStorer for ProtocolParametersStore {
 mod tests {
     use super::*;
 
-    use mithril_common::{fake_data, store::adapter::MemoryAdapter};
+    use mithril_common::{store::adapter::MemoryAdapter, test_utils::fake_data};
 
     fn setup_protocol_parameters(nb_epoch: u64) -> Vec<(Epoch, ProtocolParameters)> {
         let mut values: Vec<(Epoch, ProtocolParameters)> = Vec::new();
diff --git a/mithril-aggregator/src/tools/genesis.rs b/mithril-aggregator/src/tools/genesis.rs
index f516ffd7c..9a267c18e 100644
--- a/mithril-aggregator/src/tools/genesis.rs
+++ b/mithril-aggregator/src/tools/genesis.rs
@@ -159,9 +159,9 @@ mod tests {
 
     use mithril_common::{
         certificate_chain::MithrilCertificateVerifier,
-        crypto_helper::{tests_setup, ProtocolClerk, ProtocolGenesisSigner},
-        fake_data,
+        crypto_helper::{ProtocolClerk, ProtocolGenesisSigner},
         store::adapter::MemoryAdapter,
+        test_utils::{fake_data, MithrilFixtureBuilder},
     };
 
     use super::*;
@@ -179,10 +179,9 @@ mod tests {
     }
 
     fn create_fake_genesis_avk() -> ProtocolAggregateVerificationKey {
-        let protocol_parameters = tests_setup::setup_protocol_parameters();
-        let signers = tests_setup::setup_signers(5, &protocol_parameters);
-        let first_signer = &signers.first().unwrap().1;
-        let clerk = ProtocolClerk::from_signer(first_signer);
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let first_signer = fixture.signers_fixture()[0].clone().protocol_signer;
+        let clerk = ProtocolClerk::from_signer(&first_signer);
         clerk.compute_avk()
     }
 
diff --git a/mithril-client/src/aggregator.rs b/mithril-client/src/aggregator.rs
index d7d3dbc7d..2fdc5d5e4 100644
--- a/mithril-client/src/aggregator.rs
+++ b/mithril-client/src/aggregator.rs
@@ -324,7 +324,7 @@ mod tests {
     use httpmock::prelude::*;
     use serde_json::json;
 
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::fake_data;
 
     fn setup_test() -> (MockServer, Config) {
         let server = MockServer::start();
diff --git a/mithril-client/src/runtime.rs b/mithril-client/src/runtime.rs
index 453f47603..0b807585b 100644
--- a/mithril-client/src/runtime.rs
+++ b/mithril-client/src/runtime.rs
@@ -194,7 +194,7 @@ mod tests {
     };
     use mithril_common::digesters::{ImmutableDigester, ImmutableDigesterError};
     use mithril_common::entities::{Beacon, Certificate, ProtocolParameters};
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::fake_data;
 
     mock! {
         pub DigesterImpl { }
diff --git a/mithril-common/src/certificate_chain/certificate_verifier.rs b/mithril-common/src/certificate_chain/certificate_verifier.rs
index c3d8bd299..fded7b5df 100644
--- a/mithril-common/src/certificate_chain/certificate_verifier.rs
+++ b/mithril-common/src/certificate_chain/certificate_verifier.rs
@@ -288,6 +288,7 @@ mod tests {
 
     use crate::crypto_helper::tests_setup::*;
     use crate::crypto_helper::{key_encode_hex, ProtocolClerk};
+    use crate::test_utils::MithrilFixtureBuilder;
 
     mock! {
         pub CertificateRetrieverImpl { }
@@ -305,43 +306,42 @@ mod tests {
     #[test]
     fn test_verify_multi_signature_ok() {
         let protocol_parameters = setup_protocol_parameters();
-        let signers = setup_signers(5, &protocol_parameters);
-        let message = setup_message();
-
-        let mut single_signatures = Vec::new();
-        signers.iter().for_each(|(_, protocol_signer, _)| {
-            if let Some(signature) = protocol_signer.sign(message.compute_hash().as_bytes()) {
-                single_signatures.push(signature);
-            }
-        });
-
-        let first_signer = &signers.first().unwrap().1;
+        let fixture = MithrilFixtureBuilder::default()
+            .with_signers(5)
+            .with_protocol_parameters(protocol_parameters.into())
+            .build();
+        let signers = fixture.signers_fixture();
+        let message_hash = setup_message().compute_hash().as_bytes().to_vec();
+
+        let single_signatures = signers
+            .iter()
+            .filter_map(|s| s.protocol_signer.sign(&message_hash))
+            .collect::<Vec<_>>();
+
+        let first_signer = &signers[0].protocol_signer;
         let clerk = ProtocolClerk::from_signer(first_signer);
         let aggregate_verification_key = clerk.compute_avk();
-        let multi_signature = clerk
-            .aggregate(&single_signatures, message.compute_hash().as_bytes())
-            .unwrap();
+        let multi_signature = clerk.aggregate(&single_signatures, &message_hash).unwrap();
 
         let verifier = MithrilCertificateVerifier::new(slog_scope::logger());
-        let protocol_parameters = protocol_parameters.into();
-        let message_tampered = message.compute_hash().as_bytes()[1..].to_vec();
+        let message_tampered = message_hash[1..].to_vec();
         assert!(
             verifier
                 .verify_multi_signature(
                     &message_tampered,
                     &key_encode_hex(&multi_signature).unwrap(),
                     &key_encode_hex(&aggregate_verification_key).unwrap(),
-                    &protocol_parameters,
+                    &fixture.protocol_parameters(),
                 )
                 .is_err(),
             "multi signature verification should have failed"
         );
         verifier
             .verify_multi_signature(
-                message.compute_hash().as_bytes(),
+                &message_hash,
                 &key_encode_hex(&multi_signature).unwrap(),
                 &key_encode_hex(&aggregate_verification_key).unwrap(),
-                &protocol_parameters,
+                &fixture.protocol_parameters(),
             )
             .expect("multi signature verification should have succeeded");
     }
diff --git a/mithril-common/src/chain_observer/fake_observer.rs b/mithril-common/src/chain_observer/fake_observer.rs
index 14a809f45..5501f78f6 100644
--- a/mithril-common/src/chain_observer/fake_observer.rs
+++ b/mithril-common/src/chain_observer/fake_observer.rs
@@ -3,7 +3,7 @@ use tokio::sync::RwLock;
 
 use crate::chain_observer::interface::*;
 use crate::crypto_helper::{KESPeriod, OpCert};
-use crate::{entities::*, fake_data};
+use crate::{entities::*, test_utils::fake_data};
 
 /// A Fake [ChainObserver] for testing purpose using fixed data.
 pub struct FakeObserver {
@@ -89,7 +89,7 @@ impl ChainObserver for FakeObserver {
 
 #[cfg(test)]
 mod tests {
-    use crate::fake_data;
+    use crate::test_utils::fake_data;
 
     use super::*;
 
diff --git a/mithril-common/src/chain_observer/mod.rs b/mithril-common/src/chain_observer/mod.rs
index a9a05e8d7..27e9a1203 100644
--- a/mithril-common/src/chain_observer/mod.rs
+++ b/mithril-common/src/chain_observer/mod.rs
@@ -1,9 +1,11 @@
 //! Tools to request metadata, like the current epoch or the stake distribution, from the Cardano
 
 mod cli_observer;
+#[cfg(any(test, feature = "test_only"))]
 mod fake_observer;
 mod interface;
 
 pub use cli_observer::{CardanoCliChainObserver, CardanoCliRunner};
+#[cfg(any(test, feature = "test_only"))]
 pub use fake_observer::FakeObserver;
 pub use interface::{ChainObserver, ChainObserverError};
diff --git a/mithril-common/src/digesters/dumb_immutable_observer.rs b/mithril-common/src/digesters/dumb_immutable_observer.rs
new file mode 100644
index 000000000..9a6eec3e9
--- /dev/null
+++ b/mithril-common/src/digesters/dumb_immutable_observer.rs
@@ -0,0 +1,47 @@
+use crate::{
+    digesters::{ImmutableDigester, ImmutableDigesterError},
+    entities::Beacon,
+};
+use async_trait::async_trait;
+use tokio::sync::RwLock;
+
+/// A [ImmutableDigester] returning configurable result for testing purpose.
+pub struct DumbImmutableDigester {
+    digest: RwLock<String>,
+    is_success: bool,
+}
+
+impl DumbImmutableDigester {
+    /// DumbDigester factory
+    pub fn new(digest: &str, is_success: bool) -> Self {
+        let digest = RwLock::new(String::from(digest));
+
+        Self { digest, is_success }
+    }
+
+    /// Update digest returned by [compute_digest][DumbImmutableDigester::compute_digest]
+    pub async fn update_digest(&self, new_digest: String) {
+        let mut digest = self.digest.write().await;
+        *digest = new_digest;
+    }
+}
+
+impl Default for DumbImmutableDigester {
+    fn default() -> Self {
+        Self::new("1234", true)
+    }
+}
+
+#[async_trait]
+impl ImmutableDigester for DumbImmutableDigester {
+    async fn compute_digest(&self, beacon: &Beacon) -> Result<String, ImmutableDigesterError> {
+        if self.is_success {
+            Ok(self.digest.read().await.clone())
+        } else {
+            Err(ImmutableDigesterError::NotEnoughImmutable {
+                expected_number: beacon.immutable_file_number,
+                found_number: None,
+            })
+        }
+    }
+}
diff --git a/mithril-common/src/digesters/dummy_immutable_db_builder.rs b/mithril-common/src/digesters/dummy_immutable_db_builder.rs
index 97cca9719..91353280e 100644
--- a/mithril-common/src/digesters/dummy_immutable_db_builder.rs
+++ b/mithril-common/src/digesters/dummy_immutable_db_builder.rs
@@ -1,4 +1,3 @@
-#![cfg(test)]
 use crate::{digesters::ImmutableFile, entities::ImmutableFileNumber};
 use std::{
     fs::File,
@@ -6,6 +5,7 @@ use std::{
     path::{Path, PathBuf},
 };
 
+/// A [DummyImmutableDb] builder.
 pub struct DummyImmutablesDbBuilder {
     dir: PathBuf,
     immutables_to_write: Vec<ImmutableFileNumber>,
@@ -14,9 +14,13 @@ pub struct DummyImmutablesDbBuilder {
     file_size: Option<u64>,
 }
 
+/// A dummy cardano immutable db.
 pub struct DummyImmutableDb {
+    /// The dummy cardano db directory path.
     pub dir: PathBuf,
+    /// The [immutables files][ImmutableFile] in the dummy cardano db.
     pub immutables_files: Vec<ImmutableFile>,
+    /// Files that doesn't follow the immutable file name scheme in the dummy cardano db.
     pub non_immutables_files: Vec<PathBuf>,
 }
 
@@ -33,11 +37,14 @@ impl DummyImmutablesDbBuilder {
         }
     }
 
+    /// Set the immutables file number that will be used to generate the immutable files, for each
+    /// number three files will be generated (a 'chunk', a 'primary' and a 'secondary' file).
     pub fn with_immutables(&mut self, immutables: &[ImmutableFileNumber]) -> &mut Self {
         self.immutables_to_write = immutables.to_vec();
         self
     }
 
+    /// Set filenames to write to the db that doesn't follow the immutable file name scheme.
     pub fn with_non_immutables(&mut self, non_immutables: &[&str]) -> &mut Self {
         self.non_immutables_to_write = non_immutables.iter().map(|f| f.to_string()).collect();
         self
@@ -59,6 +66,7 @@ impl DummyImmutablesDbBuilder {
         self
     }
 
+    /// Build a [DummyImmutableDb].
     pub fn build(&self) -> DummyImmutableDb {
         let mut non_immutables_files = vec![];
         let mut immutable_numbers = self.immutables_to_write.clone();
diff --git a/mithril-common/src/digesters/immutable_digester.rs b/mithril-common/src/digesters/immutable_digester.rs
index 135d9facc..55429167d 100644
--- a/mithril-common/src/digesters/immutable_digester.rs
+++ b/mithril-common/src/digesters/immutable_digester.rs
@@ -5,7 +5,6 @@ use crate::{
 use async_trait::async_trait;
 use std::io;
 use thiserror::Error;
-use tokio::sync::RwLock;
 
 /// A digester than can compute the digest used for mithril signatures
 ///
@@ -68,44 +67,3 @@ pub enum ImmutableDigesterError {
     #[error("Digest computation failed: {0}")]
     DigestComputationError(#[from] io::Error),
 }
-
-/// A [ImmutableDigester] returning configurable result for testing purpose.
-pub struct DumbImmutableDigester {
-    digest: RwLock<String>,
-    is_success: bool,
-}
-
-impl DumbImmutableDigester {
-    /// DumbDigester factory
-    pub fn new(digest: &str, is_success: bool) -> Self {
-        let digest = RwLock::new(String::from(digest));
-
-        Self { digest, is_success }
-    }
-
-    /// Update digest returned by [compute_digest][DumbImmutableDigester::compute_digest]
-    pub async fn update_digest(&self, new_digest: String) {
-        let mut digest = self.digest.write().await;
-        *digest = new_digest;
-    }
-}
-
-impl Default for DumbImmutableDigester {
-    fn default() -> Self {
-        Self::new("1234", true)
-    }
-}
-
-#[async_trait]
-impl ImmutableDigester for DumbImmutableDigester {
-    async fn compute_digest(&self, beacon: &Beacon) -> Result<String, ImmutableDigesterError> {
-        if self.is_success {
-            Ok(self.digest.read().await.clone())
-        } else {
-            Err(ImmutableDigesterError::NotEnoughImmutable {
-                expected_number: beacon.immutable_file_number,
-                found_number: None,
-            })
-        }
-    }
-}
diff --git a/mithril-common/src/digesters/mod.rs b/mithril-common/src/digesters/mod.rs
index 37ea4e0ea..743d54f18 100644
--- a/mithril-common/src/digesters/mod.rs
+++ b/mithril-common/src/digesters/mod.rs
@@ -2,18 +2,23 @@
 
 pub mod cache;
 mod cardano_immutable_digester;
+#[cfg(any(test, feature = "test_only"))]
+mod dumb_immutable_observer;
+#[cfg(any(test, feature = "test_only"))]
 mod dummy_immutable_db_builder;
 mod immutable_digester;
 mod immutable_file;
 mod immutable_file_observer;
 
 pub use cardano_immutable_digester::CardanoImmutableDigester;
-pub use immutable_digester::{DumbImmutableDigester, ImmutableDigester, ImmutableDigesterError};
+pub use immutable_digester::{ImmutableDigester, ImmutableDigesterError};
 pub use immutable_file::{ImmutableFile, ImmutableFileCreationError, ImmutableFileListingError};
 pub use immutable_file_observer::{
     DumbImmutableFileObserver, ImmutableFileObserver, ImmutableFileObserverError,
     ImmutableFileSystemObserver,
 };
 
-#[cfg(test)]
-pub use dummy_immutable_db_builder::DummyImmutablesDbBuilder;
+#[cfg(any(test, feature = "test_only"))]
+pub use dumb_immutable_observer::DumbImmutableDigester;
+#[cfg(any(test, feature = "test_only"))]
+pub use dummy_immutable_db_builder::{DummyImmutableDb, DummyImmutablesDbBuilder};
diff --git a/mithril-common/src/entities/certificate_pending.rs b/mithril-common/src/entities/certificate_pending.rs
index faf4837ec..60e12db9d 100644
--- a/mithril-common/src/entities/certificate_pending.rs
+++ b/mithril-common/src/entities/certificate_pending.rs
@@ -48,7 +48,7 @@ impl CertificatePending {
 
 #[cfg(test)]
 mod tests {
-    use crate::fake_data;
+    use crate::test_utils::fake_data;
 
     #[test]
     fn certificate_pending_get_signers() {
diff --git a/mithril-common/src/entities/epoch.rs b/mithril-common/src/entities/epoch.rs
index acb73839a..6c017cec2 100644
--- a/mithril-common/src/entities/epoch.rs
+++ b/mithril-common/src/entities/epoch.rs
@@ -33,17 +33,17 @@ impl Epoch {
         Ok(Epoch(epoch_new as u64))
     }
 
-    /// Apply the [Self::SIGNER_EPOCH_RETRIEVAL_OFFSET] to this epoch
+    /// Apply the [retrieval offset][Self::SIGNER_RETRIEVAL_OFFSET] to this epoch
     pub fn offset_to_signer_retrieval_epoch(&self) -> Result<Self, EpochError> {
         self.offset_by(Self::SIGNER_RETRIEVAL_OFFSET)
     }
 
-    /// Apply the [Self::NEXT_SIGNER_EPOCH_RETRIEVAL_OFFSET] to this epoch
+    /// Apply the [next signer retrieval offset][Self::NEXT_SIGNER_RETRIEVAL_OFFSET] to this epoch
     pub fn offset_to_next_signer_retrieval_epoch(&self) -> Self {
         *self + Self::NEXT_SIGNER_RETRIEVAL_OFFSET
     }
 
-    /// Apply the [Self::SIGNER_EPOCH_RECORDING_OFFSET] to this epoch
+    /// Apply the [recording offset][Self::SIGNER_RECORDING_OFFSET] to this epoch
     pub fn offset_to_recording_epoch(&self) -> Self {
         *self + Self::SIGNER_RECORDING_OFFSET
     }
diff --git a/mithril-common/src/entities/single_signatures.rs b/mithril-common/src/entities/single_signatures.rs
index 570641be6..a6569e949 100644
--- a/mithril-common/src/entities/single_signatures.rs
+++ b/mithril-common/src/entities/single_signatures.rs
@@ -46,22 +46,23 @@ impl SingleSignatures {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::crypto_helper::key_encode_hex;
-    use crate::crypto_helper::tests_setup::{
-        setup_message, setup_protocol_parameters, setup_signers,
+    use crate::{
+        crypto_helper::{key_encode_hex, tests_setup::setup_message},
+        test_utils::MithrilFixtureBuilder,
     };
 
     #[test]
     fn single_signatures_should_convert_to_protocol_signatures() {
         let message = setup_message();
-        let signers = setup_signers(1, &setup_protocol_parameters());
-        let (signer_with_stake, protocol_signer, _) = signers.first().unwrap();
-        let protocol_sigs = protocol_signer
+        let fixture = MithrilFixtureBuilder::default().with_signers(1).build();
+        let signer = &fixture.signers_fixture()[0];
+        let protocol_sigs = signer
+            .protocol_signer
             .sign(message.compute_hash().as_bytes())
             .unwrap();
 
         let signature = SingleSignatures::new(
-            signer_with_stake.party_id.to_owned(),
+            signer.signer_with_stake.party_id.to_owned(),
             key_encode_hex(&protocol_sigs).unwrap(),
             protocol_sigs.indexes.clone(),
         );
diff --git a/mithril-common/src/lib.rs b/mithril-common/src/lib.rs
index b31c59615..e3c95bc0b 100644
--- a/mithril-common/src/lib.rs
+++ b/mithril-common/src/lib.rs
@@ -9,10 +9,7 @@
 //! lib with the [crypto_helper].
 //! - A [certificate chain] used to validate the Certificate Chain created by an aggregator
 //! - The [entities] used by, and exchanged between, the aggregator, signers and client.
-//! - useful test utilities including stubs, [fake data][fake_data] builders, a tool validate
-//! conformity to an open api specification ([apispec]).
 
-pub mod apispec;
 mod beacon_provider;
 pub mod certificate_chain;
 pub mod chain_observer;
@@ -20,9 +17,9 @@ pub mod crypto_helper;
 pub mod database;
 pub mod digesters;
 pub mod entities;
-pub mod fake_data;
 pub mod sqlite;
 pub mod store;
+pub mod test_utils;
 
 pub use beacon_provider::{BeaconProvider, BeaconProviderError, BeaconProviderImpl};
 pub use entities::{CardanoNetwork, MagicId};
diff --git a/mithril-common/src/store/adapter/mod.rs b/mithril-common/src/store/adapter/mod.rs
index 79d5b17d1..69c004ce9 100644
--- a/mithril-common/src/store/adapter/mod.rs
+++ b/mithril-common/src/store/adapter/mod.rs
@@ -1,6 +1,5 @@
 //! Define a generic way to store data with the [Store Adapter][store_adapter::StoreAdapter], with
-//! an adapter ([in memory][MemoryAdapter] and two more for testing ([a stub with one
-//! record][DumbStoreAdapter] and one which [always fails][FailStoreAdapter]).
+//! an adapter [in memory][MemoryAdapter] and another [sqlite][SQLiteAdapter].
 
 mod memory_adapter;
 mod sqlite_adapter;
@@ -10,7 +9,11 @@ pub use memory_adapter::MemoryAdapter;
 pub use sqlite_adapter::{SQLiteAdapter, SQLiteResultIterator};
 pub use store_adapter::*;
 
+#[cfg(any(test, feature = "test_only"))]
 mod dumb_adapter;
+#[cfg(any(test, feature = "test_only"))]
 pub use dumb_adapter::DumbStoreAdapter;
+#[cfg(any(test, feature = "test_only"))]
 mod fail_adapter;
+#[cfg(any(test, feature = "test_only"))]
 pub use fail_adapter::FailStoreAdapter;
diff --git a/mithril-common/src/apispec.rs b/mithril-common/src/test_utils/apispec.rs
similarity index 99%
rename from mithril-common/src/apispec.rs
rename to mithril-common/src/test_utils/apispec.rs
index 7251c07ee..24644a4de 100644
--- a/mithril-common/src/apispec.rs
+++ b/mithril-common/src/test_utils/apispec.rs
@@ -147,7 +147,7 @@ mod tests {
 
     use super::*;
     use crate::entities;
-    use crate::fake_data;
+    use crate::test_utils::fake_data;
 
     const API_SPEC_FILE: &str = "../openapi.yaml";
 
diff --git a/mithril-signer/src/certificate_handler.rs b/mithril-signer/src/certificate_handler.rs
index 192a40a5f..cd6010358 100644
--- a/mithril-signer/src/certificate_handler.rs
+++ b/mithril-signer/src/certificate_handler.rs
@@ -3,11 +3,10 @@ use reqwest::{self, Client, RequestBuilder, Response, StatusCode};
 use slog_scope::debug;
 use std::io;
 use thiserror::Error;
-use tokio::sync::RwLock;
 
 use mithril_common::{
     entities::{CertificatePending, EpochSettings, Signer, SingleSignatures},
-    fake_data, MITHRIL_API_VERSION,
+    MITHRIL_API_VERSION,
 };
 
 #[cfg(test)]
@@ -225,89 +224,99 @@ impl CertificateHandler for CertificateHandlerHTTPClient {
     }
 }
 
-/// This certificate handler is intended to be used by test services.
-/// It actually does not communicate with an aggregator host but mimics this behavior.
-/// It is driven by a Tester that controls the CertificatePending it can return and it can return its internal state for testing.
-pub struct DumbCertificateHandler {
-    epoch_settings: RwLock<Option<EpochSettings>>,
-    certificate_pending: RwLock<Option<CertificatePending>>,
-    last_registered_signer: RwLock<Option<Signer>>,
-}
-
-impl DumbCertificateHandler {
-    /// Instanciate a new DumbCertificateHandler.
-    pub fn new() -> Self {
-        Self {
-            epoch_settings: RwLock::new(None),
-            certificate_pending: RwLock::new(None),
-            last_registered_signer: RwLock::new(None),
+#[cfg(test)]
+pub(crate) mod dumb {
+    use super::*;
+    use mithril_common::test_utils::fake_data;
+    use tokio::sync::RwLock;
+
+    /// This certificate handler is intended to be used by test services.
+    /// It actually does not communicate with an aggregator host but mimics this behavior.
+    /// It is driven by a Tester that controls the CertificatePending it can return and it can return its internal state for testing.
+    pub struct DumbCertificateHandler {
+        epoch_settings: RwLock<Option<EpochSettings>>,
+        certificate_pending: RwLock<Option<CertificatePending>>,
+        last_registered_signer: RwLock<Option<Signer>>,
+    }
+
+    impl DumbCertificateHandler {
+        /// Instanciate a new DumbCertificateHandler.
+        pub fn new() -> Self {
+            Self {
+                epoch_settings: RwLock::new(None),
+                certificate_pending: RwLock::new(None),
+                last_registered_signer: RwLock::new(None),
+            }
         }
-    }
 
-    /// this method pilots the epoch settings handler
-    pub async fn set_epoch_settings(&self, epoch_settings: Option<EpochSettings>) {
-        let mut epoch_settings_writer = self.epoch_settings.write().await;
-        *epoch_settings_writer = epoch_settings;
-    }
+        /// this method pilots the epoch settings handler
+        pub async fn set_epoch_settings(&self, epoch_settings: Option<EpochSettings>) {
+            let mut epoch_settings_writer = self.epoch_settings.write().await;
+            *epoch_settings_writer = epoch_settings;
+        }
 
-    /// this method pilots the certificate pending handler
-    /// calling this method unsets the last registered signer
-    pub async fn set_certificate_pending(&self, certificate_pending: Option<CertificatePending>) {
-        let mut cert = self.certificate_pending.write().await;
-        *cert = certificate_pending;
-        let mut signer = self.last_registered_signer.write().await;
-        *signer = None;
-    }
+        /// this method pilots the certificate pending handler
+        /// calling this method unsets the last registered signer
+        pub async fn set_certificate_pending(
+            &self,
+            certificate_pending: Option<CertificatePending>,
+        ) {
+            let mut cert = self.certificate_pending.write().await;
+            *cert = certificate_pending;
+            let mut signer = self.last_registered_signer.write().await;
+            *signer = None;
+        }
 
-    /// Return the last signer that called with the `register` method.
-    pub async fn get_last_registered_signer(&self) -> Option<Signer> {
-        self.last_registered_signer.read().await.clone()
+        /// Return the last signer that called with the `register` method.
+        pub async fn get_last_registered_signer(&self) -> Option<Signer> {
+            self.last_registered_signer.read().await.clone()
+        }
     }
-}
 
-impl Default for DumbCertificateHandler {
-    fn default() -> Self {
-        Self {
-            epoch_settings: RwLock::new(Some(fake_data::epoch_settings())),
-            certificate_pending: RwLock::new(Some(fake_data::certificate_pending())),
-            last_registered_signer: RwLock::new(None),
+    impl Default for DumbCertificateHandler {
+        fn default() -> Self {
+            Self {
+                epoch_settings: RwLock::new(Some(fake_data::epoch_settings())),
+                certificate_pending: RwLock::new(Some(fake_data::certificate_pending())),
+                last_registered_signer: RwLock::new(None),
+            }
         }
     }
-}
 
-#[async_trait]
-impl CertificateHandler for DumbCertificateHandler {
-    async fn retrieve_epoch_settings(
-        &self,
-    ) -> Result<Option<EpochSettings>, CertificateHandlerError> {
-        let epoch_settings = self.epoch_settings.read().await.clone();
+    #[async_trait]
+    impl CertificateHandler for DumbCertificateHandler {
+        async fn retrieve_epoch_settings(
+            &self,
+        ) -> Result<Option<EpochSettings>, CertificateHandlerError> {
+            let epoch_settings = self.epoch_settings.read().await.clone();
 
-        Ok(epoch_settings)
-    }
+            Ok(epoch_settings)
+        }
 
-    async fn retrieve_pending_certificate(
-        &self,
-    ) -> Result<Option<CertificatePending>, CertificateHandlerError> {
-        let cert = self.certificate_pending.read().await.clone();
+        async fn retrieve_pending_certificate(
+            &self,
+        ) -> Result<Option<CertificatePending>, CertificateHandlerError> {
+            let cert = self.certificate_pending.read().await.clone();
 
-        Ok(cert)
-    }
+            Ok(cert)
+        }
 
-    /// Registers signer with the aggregator
-    async fn register_signer(&self, signer: &Signer) -> Result<(), CertificateHandlerError> {
-        let mut last_registered_signer = self.last_registered_signer.write().await;
-        let signer = signer.clone();
-        *last_registered_signer = Some(signer);
+        /// Registers signer with the aggregator
+        async fn register_signer(&self, signer: &Signer) -> Result<(), CertificateHandlerError> {
+            let mut last_registered_signer = self.last_registered_signer.write().await;
+            let signer = signer.clone();
+            *last_registered_signer = Some(signer);
 
-        Ok(())
-    }
+            Ok(())
+        }
 
-    /// Registers single signatures with the aggregator
-    async fn register_signatures(
-        &self,
-        _signatures: &SingleSignatures,
-    ) -> Result<(), CertificateHandlerError> {
-        Ok(())
+        /// Registers single signatures with the aggregator
+        async fn register_signatures(
+            &self,
+            _signatures: &SingleSignatures,
+        ) -> Result<(), CertificateHandlerError> {
+            Ok(())
+        }
     }
 }
 
@@ -319,7 +328,7 @@ mod tests {
     use serde_json::json;
     use std::path::{Path, PathBuf};
 
-    use mithril_common::fake_data;
+    use mithril_common::test_utils::fake_data;
 
     use crate::configuration::Config;
 
diff --git a/mithril-signer/src/lib.rs b/mithril-signer/src/lib.rs
index e89879583..159daf248 100644
--- a/mithril-signer/src/lib.rs
+++ b/mithril-signer/src/lib.rs
@@ -12,6 +12,8 @@ mod protocol_initializer_store;
 mod runtime;
 mod single_signer;
 
+#[cfg(test)]
+pub use certificate_handler::dumb::DumbCertificateHandler;
 pub use certificate_handler::*;
 pub use configuration::Config;
 pub use protocol_initializer_store::{ProtocolInitializerStore, ProtocolInitializerStorer};
diff --git a/mithril-signer/src/protocol_initializer_store.rs b/mithril-signer/src/protocol_initializer_store.rs
index a27d50691..7a99ded0a 100644
--- a/mithril-signer/src/protocol_initializer_store.rs
+++ b/mithril-signer/src/protocol_initializer_store.rs
@@ -105,7 +105,7 @@ mod tests {
 
     use super::*;
 
-    use mithril_common::{fake_data, store::adapter::MemoryAdapter};
+    use mithril_common::{store::adapter::MemoryAdapter, test_utils::fake_data};
 
     use rand_chacha::ChaCha20Rng;
     use rand_core::SeedableRng;
diff --git a/mithril-signer/src/runtime/runner.rs b/mithril-signer/src/runtime/runner.rs
index d16c8ab3a..0ec1b91c0 100644
--- a/mithril-signer/src/runtime/runner.rs
+++ b/mithril-signer/src/runtime/runner.rs
@@ -436,20 +436,20 @@ impl Runner for SignerRunner {
 
 #[cfg(test)]
 mod tests {
-    use mithril_common::chain_observer::ChainObserver;
-    use mockall::mock;
-    use std::{path::PathBuf, sync::Arc};
-
-    use mithril_common::crypto_helper::tests_setup::{setup_protocol_parameters, setup_signers};
-    use mithril_common::crypto_helper::ProtocolInitializer;
-    use mithril_common::digesters::{DumbImmutableDigester, DumbImmutableFileObserver};
-    use mithril_common::entities::{Epoch, StakeDistribution};
-    use mithril_common::store::adapter::{DumbStoreAdapter, MemoryAdapter};
-    use mithril_common::store::{StakeStore, StakeStorer};
     use mithril_common::{
-        chain_observer::FakeObserver, BeaconProvider, BeaconProviderError, BeaconProviderImpl,
+        chain_observer::{ChainObserver, FakeObserver},
+        crypto_helper::ProtocolInitializer,
+        digesters::{DumbImmutableDigester, DumbImmutableFileObserver},
+        entities::{Epoch, StakeDistribution},
+        store::{
+            adapter::{DumbStoreAdapter, MemoryAdapter},
+            StakeStore, StakeStorer,
+        },
+        test_utils::{fake_data, MithrilFixtureBuilder},
+        BeaconProvider, BeaconProviderError, BeaconProviderImpl, CardanoNetwork,
     };
-    use mithril_common::{fake_data, CardanoNetwork};
+    use mockall::mock;
+    use std::{path::PathBuf, sync::Arc};
 
     use crate::{
         CertificateHandler, DumbCertificateHandler, MithrilSingleSigner, MockCertificateHandler,
@@ -693,8 +693,9 @@ mod tests {
             .get_current_beacon()
             .await
             .expect("get_current_beacon should not fail");
-        let signers = setup_signers(5, &setup_protocol_parameters());
-        let (signer_with_stake, _, protocol_initializer) = signers.first().unwrap();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signer_with_stake = fixture.signers_fixture()[0].signer_with_stake.clone();
+        let protocol_initializer = fixture.signers_fixture()[0].protocol_initializer.clone();
         let single_signer = Arc::new(MithrilSingleSigner::new(
             signer_with_stake.party_id.to_owned(),
         ));
@@ -708,10 +709,7 @@ mod tests {
             .await
             .expect("save_protocol_initializer should not fail");
 
-        let next_signers = signers
-            .iter()
-            .map(|(signer_with_stake, _, _)| signer_with_stake.to_owned())
-            .collect::<Vec<_>>();
+        let next_signers = fixture.signers_with_stake();
         let mut expected = ProtocolMessage::new();
         expected.set_message_part(
             ProtocolMessagePartKey::SnapshotDigest,
@@ -719,7 +717,7 @@ mod tests {
         );
         let avk = services
             .single_signer
-            .compute_aggregate_verification_key(&next_signers, protocol_initializer)
+            .compute_aggregate_verification_key(&next_signers, &protocol_initializer)
             .expect("compute_aggregate_verification_key should not fail")
             .expect("an avk should have been computed");
         expected.set_message_part(ProtocolMessagePartKey::NextAggregateVerificationKey, avk);
@@ -741,8 +739,9 @@ mod tests {
             .get_current_beacon()
             .await
             .expect("get_current_beacon should not fail");
-        let signers = setup_signers(5, &setup_protocol_parameters());
-        let (signer_with_stake, _, protocol_initializer) = signers.first().unwrap();
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signer_with_stake = fixture.signers_fixture()[0].signer_with_stake.clone();
+        let protocol_initializer = fixture.signers_fixture()[0].protocol_initializer.clone();
         let single_signer = Arc::new(MithrilSingleSigner::new(
             signer_with_stake.party_id.to_string(),
         ));
@@ -758,10 +757,7 @@ mod tests {
             )
             .await
             .expect("save_protocol_initializer should not fail");
-        let signers = signers
-            .iter()
-            .map(|(signer_with_stake, _, _)| signer_with_stake.to_owned())
-            .collect::<Vec<_>>();
+        let signers = fixture.signers_with_stake();
 
         let mut message = ProtocolMessage::new();
         message.set_message_part(
@@ -774,7 +770,7 @@ mod tests {
         );
 
         let expected = single_signer
-            .compute_single_signatures(&message, &signers, protocol_initializer)
+            .compute_single_signatures(&message, &signers, &protocol_initializer)
             .expect("compute_single_signatures should not fail");
 
         let runner = init_runner(Some(services), None);
diff --git a/mithril-signer/src/runtime/state_machine.rs b/mithril-signer/src/runtime/state_machine.rs
index 50764ff49..f04861cf7 100644
--- a/mithril-signer/src/runtime/state_machine.rs
+++ b/mithril-signer/src/runtime/state_machine.rs
@@ -267,7 +267,7 @@ impl StateMachine {
 #[cfg(test)]
 mod tests {
     use mithril_common::entities::Epoch;
-    use mithril_common::{entities::ProtocolMessage, fake_data};
+    use mithril_common::{entities::ProtocolMessage, test_utils::fake_data};
 
     use super::*;
     use crate::runtime::runner::MockSignerRunner;
diff --git a/mithril-signer/src/single_signer.rs b/mithril-signer/src/single_signer.rs
index ceef56f25..df9e57a4c 100644
--- a/mithril-signer/src/single_signer.rs
+++ b/mithril-signer/src/single_signer.rs
@@ -237,34 +237,33 @@ impl SingleSigner for MithrilSingleSigner {
 mod tests {
     use super::*;
 
-    use mithril_common::crypto_helper::tests_setup::*;
-    use mithril_common::crypto_helper::{key_decode_hex, ProtocolClerk, ProtocolSingleSignature};
-    use mithril_common::entities::ProtocolMessagePartKey;
+    use mithril_common::{
+        crypto_helper::{key_decode_hex, tests_setup::*, ProtocolClerk, ProtocolSingleSignature},
+        entities::ProtocolMessagePartKey,
+        test_utils::MithrilFixtureBuilder,
+    };
 
     #[test]
     fn compute_single_signature_success() {
         let snapshot_digest = "digest".to_string();
         let protocol_parameters = setup_protocol_parameters();
-        let signers = setup_signers(5, &protocol_parameters);
-        let signers_with_stake = signers
-            .iter()
-            .map(
-                |(signer_with_stake, _protocol_signer, _protocol_initializer)| {
-                    signer_with_stake.to_owned()
-                },
-            )
-            .collect::<Vec<SignerWithStake>>();
-        let current_signer = &signers[0];
-        let single_signer = MithrilSingleSigner::new(current_signer.0.party_id.to_owned());
-        let protocol_signer = &current_signer.1;
-        let clerk = ProtocolClerk::from_signer(protocol_signer);
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signers_with_stake = fixture.signers_with_stake();
+        let current_signer = &fixture.signers_fixture()[0];
+        let single_signer =
+            MithrilSingleSigner::new(current_signer.signer_with_stake.party_id.to_owned());
+        let clerk = ProtocolClerk::from_signer(&current_signer.protocol_signer);
         let avk = clerk.compute_avk();
         let mut protocol_message = ProtocolMessage::new();
         protocol_message.set_message_part(ProtocolMessagePartKey::SnapshotDigest, snapshot_digest);
         let expected_message = protocol_message.compute_hash().as_bytes().to_vec();
 
         let sign_result = single_signer
-            .compute_single_signatures(&protocol_message, &signers_with_stake, &current_signer.2)
+            .compute_single_signatures(
+                &protocol_message,
+                &signers_with_stake,
+                &current_signer.protocol_initializer,
+            )
             .expect("single signer should not fail")
             .expect("single signer should produce a signature here");
 
@@ -273,34 +272,29 @@ mod tests {
             decoded_sig
                 .verify(
                     &protocol_parameters,
-                    &protocol_signer.verification_key(),
-                    &protocol_signer.get_stake(),
+                    &current_signer.protocol_signer.verification_key(),
+                    &current_signer.protocol_signer.get_stake(),
                     &avk,
                     &expected_message
                 )
                 .is_ok(),
             "produced single signature should be valid"
         );
-        //TODO: decoded_sig.pk should probably be a StmVerificationKeyPoP, uncomment once fixed
-        //assert_eq!(current_signer.2, decoded_sig.pk);
     }
 
     #[test]
     fn compute_aggregate_verification_key_success() {
-        let signers = setup_signers(5, &setup_protocol_parameters());
-        let signers_with_stake = signers
-            .iter()
-            .map(
-                |(signer_with_stake, _protocol_signer, _protocol_initializer)| {
-                    signer_with_stake.to_owned()
-                },
-            )
-            .collect::<Vec<SignerWithStake>>();
-        let current_signer = &signers[0];
-        let single_signer = MithrilSingleSigner::new(current_signer.0.party_id.to_owned());
-        let protocol_initializer = &current_signer.2;
+        let fixture = MithrilFixtureBuilder::default().with_signers(5).build();
+        let signers_with_stake = fixture.signers_with_stake();
+        let current_signer = &fixture.signers_fixture()[0];
+        let single_signer =
+            MithrilSingleSigner::new(current_signer.signer_with_stake.party_id.to_owned());
+
         single_signer
-            .compute_aggregate_verification_key(&signers_with_stake, protocol_initializer)
+            .compute_aggregate_verification_key(
+                &signers_with_stake,
+                &current_signer.protocol_initializer,
+            )
             .expect("compute aggregate verification signature should not fail")
             .expect("aggregate verification signature should not be empty");
     }


Test patch:
diff --git a/mithril-aggregator/tests/certificate_chain.rs b/mithril-aggregator/tests/certificate_chain.rs
index 91e94aa14..5bf648627 100644
--- a/mithril-aggregator/tests/certificate_chain.rs
+++ b/mithril-aggregator/tests/certificate_chain.rs
@@ -3,9 +3,12 @@ mod test_extensions;
 use std::collections::BTreeMap;
 
 use mithril_aggregator::VerificationKeyStorer;
-use mithril_common::chain_observer::ChainObserver;
-use mithril_common::crypto_helper::{tests_setup, ProtocolPartyId, ProtocolStake};
-use mithril_common::entities::{ProtocolParameters, SignerWithStake};
+use mithril_common::{
+    chain_observer::ChainObserver,
+    crypto_helper::{ProtocolPartyId, ProtocolStake},
+    entities::ProtocolParameters,
+    test_utils::MithrilFixtureBuilder,
+};
 use test_extensions::RuntimeTester;
 
 #[tokio::test]
@@ -18,18 +21,19 @@ async fn certificate_chain() {
     let mut tester = RuntimeTester::build(protocol_parameters.clone()).await;
 
     comment!("Create signers & declare stake distribution");
-    let signers = tests_setup::setup_signers(5, &protocol_parameters.clone().into());
-    let mut signers_with_stake: Vec<SignerWithStake> = signers
-        .iter()
-        .map(|(signer_with_stake, _, _)| signer_with_stake.to_owned())
-        .collect();
+    let fixture = MithrilFixtureBuilder::default()
+        .with_signers(5)
+        .with_protocol_parameters(protocol_parameters.clone())
+        .build();
+    let signers = fixture.signers_fixture();
+    let mut signers_with_stake = fixture.signers_with_stake();
     tester
         .chain_observer
         .set_signers(signers_with_stake.clone())
         .await;
     tester
         .deps
-        .simulate_genesis(
+        .prepare_for_genesis(
             signers_with_stake.clone(),
             signers_with_stake.clone(),
             &protocol_parameters,
diff --git a/mithril-aggregator/tests/create_certificate.rs b/mithril-aggregator/tests/create_certificate.rs
index 50a3370c3..240df2b96 100644
--- a/mithril-aggregator/tests/create_certificate.rs
+++ b/mithril-aggregator/tests/create_certificate.rs
@@ -2,9 +2,10 @@ mod test_extensions;
 
 use std::collections::BTreeSet;
 
-use mithril_common::crypto_helper::tests_setup;
-use mithril_common::entities::SignerWithStake;
-use mithril_common::entities::{ProtocolMessagePartKey, ProtocolParameters};
+use mithril_common::{
+    entities::{ProtocolMessagePartKey, ProtocolParameters},
+    test_utils::MithrilFixtureBuilder,
+};
 use test_extensions::RuntimeTester;
 
 #[tokio::test]
@@ -17,19 +18,19 @@ async fn create_certificate() {
     let mut tester = RuntimeTester::build(protocol_parameters.clone()).await;
 
     comment!("create signers & declare stake distribution");
-    let signers = tests_setup::setup_signers(10, &protocol_parameters.clone().into());
-    let signers_with_stake: Vec<SignerWithStake> = signers
-        .clone()
-        .into_iter()
-        .map(|(signer_with_stake, _, _)| signer_with_stake)
-        .collect();
+    let fixture = MithrilFixtureBuilder::default()
+        .with_signers(10)
+        .with_protocol_parameters(protocol_parameters.clone())
+        .build();
+    let signers = fixture.signers_fixture();
+    let signers_with_stake = fixture.signers_with_stake();
     tester
         .chain_observer
         .set_signers(signers_with_stake.clone())
         .await;
     tester
         .deps
-        .simulate_genesis(
+        .prepare_for_genesis(
             signers_with_stake.clone(),
             signers_with_stake,
             &protocol_parameters,
@@ -90,7 +91,7 @@ async fn create_certificate() {
         BTreeSet::from_iter(
             signers_who_sign
                 .iter()
-                .map(|(s, _, _)| s.party_id.to_owned())
+                .map(|s| s.signer_with_stake.party_id.to_owned())
         )
     );
 
diff --git a/mithril-aggregator/tests/simple.rs b/mithril-aggregator/tests/simple.rs
index a7aea2665..f302f1d7e 100644
--- a/mithril-aggregator/tests/simple.rs
+++ b/mithril-aggregator/tests/simple.rs
@@ -1,8 +1,8 @@
 mod test_extensions;
 
 use mithril_common::{
-    crypto_helper::tests_setup,
     entities::{ProtocolParameters, SignerWithStake},
+    test_utils::MithrilFixtureBuilder,
 };
 use test_extensions::RuntimeTester;
 
@@ -16,19 +16,19 @@ async fn simple_scenario() {
     let mut tester = RuntimeTester::build(protocol_parameters.clone()).await;
 
     comment!("Create signers & declare stake distribution");
-    let signers = tests_setup::setup_signers(5, &protocol_parameters.clone().into());
-    let signers_with_stake: Vec<SignerWithStake> = signers
-        .clone()
-        .into_iter()
-        .map(|(signer_with_stake, _, _)| signer_with_stake)
-        .collect();
+    let fixture = MithrilFixtureBuilder::default()
+        .with_signers(5)
+        .with_protocol_parameters(protocol_parameters.clone())
+        .build();
+    let signers = fixture.signers_fixture();
+    let signers_with_stake: Vec<SignerWithStake> = fixture.signers_with_stake();
     tester
         .chain_observer
         .set_signers(signers_with_stake.clone())
         .await;
     tester
         .deps
-        .simulate_genesis(
+        .prepare_for_genesis(
             signers_with_stake.clone(),
             signers_with_stake.clone(),
             &protocol_parameters,
diff --git a/mithril-aggregator/tests/test_extensions/mod.rs b/mithril-aggregator/tests/test_extensions/mod.rs
index 9bccf34b1..dbab7c6f6 100644
--- a/mithril-aggregator/tests/test_extensions/mod.rs
+++ b/mithril-aggregator/tests/test_extensions/mod.rs
@@ -10,4 +10,3 @@ pub mod utilities;
 
 pub use dependency::initialize_dependencies;
 pub use runtime_tester::RuntimeTester;
-pub use utilities::TestSigner;
diff --git a/mithril-aggregator/tests/test_extensions/runtime_tester.rs b/mithril-aggregator/tests/test_extensions/runtime_tester.rs
index 1813a7dac..8ba092a56 100644
--- a/mithril-aggregator/tests/test_extensions/runtime_tester.rs
+++ b/mithril-aggregator/tests/test_extensions/runtime_tester.rs
@@ -1,6 +1,10 @@
-use crate::test_extensions::{initialize_dependencies, TestSigner};
+use crate::test_extensions::initialize_dependencies;
 use mithril_common::certificate_chain::CertificateGenesisProducer;
+use mithril_common::test_utils::{
+    MithrilFixtureBuilder, SignerFixture, StakeDistributionGenerationMethod,
+};
 use slog::Drain;
+use std::collections::HashMap;
 use std::sync::Arc;
 use std::time::Duration;
 
@@ -8,7 +12,6 @@ use mithril_aggregator::{
     AggregatorRunner, AggregatorRuntime, DependencyManager, DumbSnapshotUploader, DumbSnapshotter,
     ProtocolParametersStorer,
 };
-use mithril_common::crypto_helper::tests_setup::setup_signers_from_stake_distribution;
 use mithril_common::crypto_helper::{key_encode_hex, ProtocolClerk, ProtocolGenesisSigner};
 use mithril_common::digesters::DumbImmutableFileObserver;
 use mithril_common::entities::{
@@ -89,7 +92,10 @@ impl RuntimeTester {
     }
 
     /// Registers the genesis certificate
-    pub async fn register_genesis_certificate(&self, signers: &[TestSigner]) -> Result<(), String> {
+    pub async fn register_genesis_certificate(
+        &self,
+        signers: &[SignerFixture],
+    ) -> Result<(), String> {
         let beacon = self
             .deps
             .beacon_provider
@@ -108,10 +114,10 @@ impl RuntimeTester {
                 )
             })?
             .ok_or("A protocol parameters for the epoch should be available")?;
-        let first_signer = &signers
+        let first_signer = &&signers
             .first()
             .ok_or_else(|| "Signers list should not be empty".to_string())?
-            .1;
+            .protocol_signer;
         let clerk = ProtocolClerk::from_signer(first_signer);
         let genesis_avk = clerk.compute_avk();
         let genesis_producer = CertificateGenesisProducer::new(Some(self.genesis_signer.clone()));
@@ -183,8 +189,8 @@ impl RuntimeTester {
     }
 
     /// Register the given signers in the registerer
-    pub async fn register_signers(&self, signers: &[TestSigner]) -> Result<(), String> {
-        for (signer_with_stake, _protocol_signer, _protocol_initializer) in signers {
+    pub async fn register_signers(&self, signers: &[SignerFixture]) -> Result<(), String> {
+        for signer_with_stake in signers.iter().map(|f| &f.signer_with_stake) {
             self.deps
                 .signer_registerer
                 .register_signer(&signer_with_stake.to_owned().into())
@@ -196,17 +202,20 @@ impl RuntimeTester {
     }
 
     /// "Send", actually register, the given single signatures in the multi-signers
-    pub async fn send_single_signatures(&self, signers: &[TestSigner]) -> Result<(), String> {
+    pub async fn send_single_signatures(&self, signers: &[SignerFixture]) -> Result<(), String> {
         let mut multisigner = self.deps.multi_signer.write().await;
         let message = multisigner
             .get_current_message()
             .await
             .ok_or("There should be a message to be signed.")?;
 
-        for (signer_with_stake, protocol_signer, _protocol_initializer) in signers {
-            if let Some(signature) = protocol_signer.sign(message.compute_hash().as_bytes()) {
+        for signer_fixture in signers {
+            if let Some(signature) = signer_fixture
+                .protocol_signer
+                .sign(message.compute_hash().as_bytes())
+            {
                 let single_signatures = SingleSignatures::new(
-                    signer_with_stake.party_id.to_owned(),
+                    signer_fixture.signer_with_stake.party_id.to_owned(),
                     key_encode_hex(&signature).expect("hex encoding should not fail"),
                     signature.indexes,
                 );
@@ -225,7 +234,7 @@ impl RuntimeTester {
                     "Signer '{}' could not sign. \
                     This test is based on the assumption that every signer signs everytime. \
                     Possible fix: relax the protocol parameters or give more stakes to this signer.",
-                    signer_with_stake.party_id
+                    signer_fixture.signer_with_stake.party_id,
                 );
             }
         }
@@ -257,7 +266,7 @@ impl RuntimeTester {
     pub async fn update_stake_distribution(
         &self,
         signers_with_stake: Vec<SignerWithStake>,
-    ) -> Result<Vec<TestSigner>, String> {
+    ) -> Result<Vec<SignerFixture>, String> {
         self.chain_observer
             .set_signers(signers_with_stake.clone())
             .await;
@@ -280,14 +289,19 @@ impl RuntimeTester {
             })?
             .ok_or("A protocol parameters for the recording epoch should be available")?;
 
-        Ok(setup_signers_from_stake_distribution(
-            &signers_with_stake
-                .clone()
-                .into_iter()
-                .map(|s| (s.party_id, s.stake))
-                .collect::<Vec<_>>(),
-            &protocol_parameters.into(),
-        ))
+        let fixture = MithrilFixtureBuilder::default()
+            .with_signers(signers_with_stake.len())
+            .with_protocol_parameters(protocol_parameters)
+            .with_stake_distribution(StakeDistributionGenerationMethod::Custom(
+                HashMap::from_iter(
+                    signers_with_stake
+                        .into_iter()
+                        .map(|s| (s.party_id, s.stake)),
+                ),
+            ))
+            .build();
+
+        Ok(fixture.signers_fixture())
     }
 
     // Update the digester result using the current beacon
diff --git a/mithril-aggregator/tests/test_extensions/utilities.rs b/mithril-aggregator/tests/test_extensions/utilities.rs
index 14b7dd72a..79a14c2b6 100644
--- a/mithril-aggregator/tests/test_extensions/utilities.rs
+++ b/mithril-aggregator/tests/test_extensions/utilities.rs
@@ -1,12 +1,6 @@
-use mithril_common::{
-    crypto_helper::{ProtocolInitializer, ProtocolSigner},
-    entities::SignerWithStake,
-};
 use slog_scope::debug;
 use std::sync::atomic::{AtomicUsize, Ordering};
 
-pub type TestSigner = (SignerWithStake, ProtocolSigner, ProtocolInitializer);
-
 pub static COMMENT_COUNT: AtomicUsize = AtomicUsize::new(0);
 
 pub fn comment(comment: String) {
diff --git a/mithril-common/src/crypto_helper/tests_setup.rs b/mithril-common/src/crypto_helper/tests_setup.rs
index 47815f3ec..847ba791a 100644
--- a/mithril-common/src/crypto_helper/tests_setup.rs
+++ b/mithril-common/src/crypto_helper/tests_setup.rs
@@ -1,16 +1,13 @@
 //! Test data builders for Mithril STM types, for testing purpose.
-use super::cardano::ColdKeyGenerator;
 use super::{genesis::*, key_encode_hex, types::*, OpCert, SerDeShelleyFileFormat};
-use crate::certificate_chain::CertificateGenesisProducer;
 use crate::{
+    certificate_chain::CertificateGenesisProducer,
     entities::{Certificate, Epoch, ProtocolMessage, ProtocolMessagePartKey, SignerWithStake},
-    fake_data,
+    test_utils::{fake_data, MithrilFixtureBuilder, SignerFixture},
 };
 
-use kes_summed_ed25519::kes::Sum6Kes;
-use kes_summed_ed25519::traits::KesSk;
 use rand_chacha::ChaCha20Rng;
-use rand_core::{RngCore, SeedableRng};
+use rand_core::SeedableRng;
 use std::{cmp::min, fs, sync::Arc};
 
 use std::{collections::HashMap, path::PathBuf};
@@ -52,60 +49,11 @@ pub fn setup_protocol_parameters() -> ProtocolParameters {
     }
 }
 
-/// Instantiate a list of protocol signers, use this for tests only.
-pub fn setup_signers(
-    total: u64,
-    protocol_parameters: &ProtocolParameters,
-) -> Vec<(SignerWithStake, ProtocolSigner, ProtocolInitializer)> {
-    let mut stake_rng = ChaCha20Rng::from_seed([0u8; 32]);
-    let mut kes_keys_seed = [0u8; 32];
-
-    let stake_distribution = (0..total)
-        .into_iter()
-        .map(|party_idx| {
-            let party_id = if party_idx % 2 == 0
-                || cfg!(not(feature = "allow_skip_signer_certification"))
-            {
-                // 50% of signers with key certification if allow unverified signer registration
-                // Or 100% of signers otherwise
-                let keypair = ColdKeyGenerator::create_deterministic_keypair([party_idx as u8; 32]);
-                let (kes_secret_key, kes_verification_key) = Sum6Kes::keygen(&mut kes_keys_seed);
-                let operational_certificate = OpCert::new(kes_verification_key, 0, 0, keypair);
-                let party_id = operational_certificate
-                    .compute_protocol_party_id()
-                    .expect("compute protocol party id should not fail");
-                let temp_dir = setup_temp_directory_for_signer(&party_id, true)
-                    .expect("setup temp directory should return a value");
-                if !temp_dir.join("kes.sk").exists() {
-                    kes_secret_key
-                        .to_file(temp_dir.join("kes.sk"))
-                        .expect("KES secret key file export should not fail");
-                }
-                if !temp_dir.join("opcert.cert").exists() {
-                    operational_certificate
-                        .to_file(temp_dir.join("opcert.cert"))
-                        .expect("operational certificate file export should not fail");
-                }
-                party_id
-            } else {
-                // 50% of signers without key certification (legacy) if allow unverified signer registration
-                // Or 0% of signers otherwise
-                // TODO: Should be removed once the signer certification is fully deployed
-                format!("{:<032}", party_idx)
-            };
-
-            let stake = 1 + stake_rng.next_u64() % 999;
-            (party_id, stake)
-        })
-        .collect::<Vec<_>>();
-    setup_signers_from_stake_distribution(&stake_distribution, protocol_parameters)
-}
-
 /// Instantiate a list of protocol signers based on the given [ProtocolStakeDistribution] and [ProtocolParameters], use this for tests only.
 pub fn setup_signers_from_stake_distribution(
     stake_distribution: &ProtocolStakeDistribution,
     protocol_parameters: &ProtocolParameters,
-) -> Vec<(SignerWithStake, ProtocolSigner, ProtocolInitializer)> {
+) -> Vec<SignerFixture> {
     let signers = stake_distribution
         .iter()
         .map(|(party_id, stake)| {
@@ -163,34 +111,37 @@ pub fn setup_signers_from_stake_distribution(
                     .expect("operational certificate decoding should not fail")
             });
             let kes_period = 0;
-            (
-                SignerWithStake::new(
-                    party_id,
-                    key_encode_hex(protocol_initializer.verification_key())
-                        .expect("key_encode_hex of verification_key should not fail"),
-                    protocol_initializer
-                        .verification_key_signature()
-                        .as_ref()
-                        .map(|verification_key_signature| {
-                            key_encode_hex(verification_key_signature).expect(
-                                "key_encode_hex of verification_key_signature should not fail",
-                            )
-                        }),
-                    operational_certificate
-                        .as_ref()
-                        .map(|operational_certificate| {
-                            key_encode_hex(operational_certificate)
-                                .expect("key_encode_hex of operational_certificate should not fail")
-                        }),
-                    operational_certificate.as_ref().map(|_| kes_period),
-                    stake,
-                ),
+
+            let signer_with_stake = SignerWithStake::new(
+                party_id,
+                key_encode_hex(protocol_initializer.verification_key())
+                    .expect("key_encode_hex of verification_key should not fail"),
                 protocol_initializer
-                    .clone()
-                    .new_signer(closed_key_registration.clone())
-                    .expect("creating a new protocol signer should not fail"),
+                    .verification_key_signature()
+                    .as_ref()
+                    .map(|verification_key_signature| {
+                        key_encode_hex(verification_key_signature)
+                            .expect("key_encode_hex of verification_key_signature should not fail")
+                    }),
+                operational_certificate
+                    .as_ref()
+                    .map(|operational_certificate| {
+                        key_encode_hex(operational_certificate)
+                            .expect("key_encode_hex of operational_certificate should not fail")
+                    }),
+                operational_certificate.as_ref().map(|_| kes_period),
+                stake,
+            );
+            let protocol_signer = protocol_initializer
+                .clone()
+                .new_signer(closed_key_registration.clone())
+                .expect("creating a new protocol signer should not fail");
+
+            SignerFixture {
+                signer_with_stake,
+                protocol_signer,
                 protocol_initializer,
-            )
+            }
         })
         .collect::<_>()
 }
@@ -219,21 +170,24 @@ pub fn setup_certificate_chain(
             _ => Epoch(i / certificates_per_epoch + 1),
         })
         .collect::<Vec<_>>();
-    let signers_by_epoch = epochs
+    let fixture_per_epoch = epochs
         .clone()
         .into_iter()
         .map(|epoch| {
             (
                 epoch,
-                setup_signers(min(2 + epoch.0, 5), &protocol_parameters),
+                MithrilFixtureBuilder::default()
+                    .with_protocol_parameters(protocol_parameters.into())
+                    .with_signers(min(2 + epoch.0 as usize, 5))
+                    .build(),
             )
         })
         .collect::<HashMap<_, _>>();
-    let clerk_for_signers = |signers: &[(_, ProtocolSigner, _)]| -> ProtocolClerk {
-        let first_signer = &signers.first().unwrap().1;
+    let clerk_for_signers = |signers: &[SignerFixture]| -> ProtocolClerk {
+        let first_signer = &signers[0].protocol_signer;
         ProtocolClerk::from_signer(first_signer)
     };
-    let avk_for_signers = |signers: &[(_, ProtocolSigner, _)]| -> ProtocolAggregateVerificationKey {
+    let avk_for_signers = |signers: &[SignerFixture]| -> ProtocolAggregateVerificationKey {
         let clerk = clerk_for_signers(signers);
         clerk.compute_avk()
     };
@@ -247,10 +201,10 @@ pub fn setup_certificate_chain(
             let immutable_file_number = i as u64 * 10;
             let digest = format!("digest{}", i);
             let certificate_hash = format!("certificate_hash-{}", i);
-            let signers = signers_by_epoch.get(&epoch).unwrap();
-            let next_signers = signers_by_epoch.get(&(epoch + 1)).unwrap();
-            let avk = avk_for_signers(signers);
-            let next_avk = avk_for_signers(next_signers);
+            let fixture = fixture_per_epoch.get(&epoch).unwrap();
+            let next_fixture = fixture_per_epoch.get(&(epoch + 1)).unwrap();
+            let avk = avk_for_signers(&fixture.signers_fixture());
+            let next_avk = avk_for_signers(&next_fixture.signers_fixture());
             let mut fake_certificate = fake_data::certificate(certificate_hash);
             fake_certificate.beacon.epoch = epoch;
             fake_certificate.beacon.immutable_file_number = immutable_file_number;
@@ -281,17 +235,17 @@ pub fn setup_certificate_chain(
                     .unwrap()
                 }
                 _ => {
-                    fake_certificate.metadata.signers =
-                        signers.iter().map(|s| s.0.to_owned()).collect();
-                    let mut single_signatures = Vec::new();
-                    signers.iter().for_each(|(_, protocol_signer, _)| {
-                        if let Some(signature) =
-                            protocol_signer.sign(fake_certificate.signed_message.as_bytes())
-                        {
-                            single_signatures.push(signature);
-                        }
-                    });
-                    let clerk = clerk_for_signers(signers);
+                    fake_certificate.metadata.signers = fixture.signers_with_stake();
+
+                    let single_signatures = fixture
+                        .signers_fixture()
+                        .iter()
+                        .filter_map(|s| {
+                            s.protocol_signer
+                                .sign(fake_certificate.signed_message.as_bytes())
+                        })
+                        .collect::<Vec<_>>();
+                    let clerk = clerk_for_signers(&fixture.signers_fixture());
                     let multi_signature = clerk
                         .aggregate(
                             &single_signatures,
diff --git a/mithril-common/src/fake_data.rs b/mithril-common/src/test_utils/fake_data.rs
similarity index 100%
rename from mithril-common/src/fake_data.rs
rename to mithril-common/src/test_utils/fake_data.rs
diff --git a/mithril-common/src/test_utils/fixture_builder.rs b/mithril-common/src/test_utils/fixture_builder.rs
new file mode 100644
index 000000000..2575c5317
--- /dev/null
+++ b/mithril-common/src/test_utils/fixture_builder.rs
@@ -0,0 +1,191 @@
+use kes_summed_ed25519::{kes::Sum6Kes, traits::KesSk};
+use rand_chacha::ChaCha20Rng;
+use rand_core::{RngCore, SeedableRng};
+
+use crate::{
+    crypto_helper::{
+        tests_setup, tests_setup::setup_temp_directory_for_signer, ColdKeyGenerator, OpCert,
+        ProtocolStakeDistribution, SerDeShelleyFileFormat,
+    },
+    entities::{PartyId, ProtocolParameters, StakeDistribution},
+    test_utils::{fake_data, mithril_fixture::MithrilFixture},
+};
+
+/// A builder of mithril types.
+pub struct MithrilFixtureBuilder {
+    protocol_parameters: ProtocolParameters,
+    enable_signers_certification: bool,
+    number_of_signers: usize,
+    stake_distribution_generation_method: StakeDistributionGenerationMethod,
+}
+
+impl Default for MithrilFixtureBuilder {
+    fn default() -> Self {
+        Self {
+            protocol_parameters: fake_data::protocol_parameters(),
+            enable_signers_certification: true,
+            number_of_signers: 5,
+            stake_distribution_generation_method:
+                StakeDistributionGenerationMethod::RandomDistribution { seed: [0u8; 32] },
+        }
+    }
+}
+
+/// Methods that can be used to generate the stake distribution.
+pub enum StakeDistributionGenerationMethod {
+    /// Each party will have a random stake.
+    RandomDistribution {
+        /// The randomizer seed
+        seed: [u8; 32],
+    },
+
+    /// Use a custom stake distribution
+    Custom(StakeDistribution),
+}
+
+impl MithrilFixtureBuilder {
+    /// Set the protocol_parameters.
+    pub fn with_protocol_parameters(mut self, protocol_parameters: ProtocolParameters) -> Self {
+        self.protocol_parameters = protocol_parameters;
+        self
+    }
+
+    /// Set the number of signers that will be generated.
+    pub fn with_signers(mut self, number_of_signers: usize) -> Self {
+        self.number_of_signers = number_of_signers;
+        self
+    }
+
+    /// If set the generated signers won't be certified (meaning that they won't
+    /// have a operational certificate).
+    pub fn disable_signers_certification(mut self) -> Self {
+        self.enable_signers_certification = false;
+        self
+    }
+
+    /// Set the generation method used to compute the stake distribution.
+    pub fn with_stake_distribution(
+        mut self,
+        stake_distribution_generation_method: StakeDistributionGenerationMethod,
+    ) -> Self {
+        self.stake_distribution_generation_method = stake_distribution_generation_method;
+        self
+    }
+
+    /// Transform the specified parameters to a [MithrilFixture].
+    pub fn build(self) -> MithrilFixture {
+        let protocol_stake_distribution = self.generate_stake_distribution();
+        let signers = tests_setup::setup_signers_from_stake_distribution(
+            &protocol_stake_distribution,
+            &self.protocol_parameters.clone().into(),
+        );
+
+        MithrilFixture::new(
+            self.protocol_parameters,
+            signers,
+            protocol_stake_distribution,
+        )
+    }
+
+    fn generate_stake_distribution(&self) -> ProtocolStakeDistribution {
+        let mut kes_keys_seed = [0u8; 32];
+        let signers_party_ids = (0..self.number_of_signers).into_iter().map(|party_index| {
+            if self.enable_signers_certification {
+                build_party_with_operational_certificate(party_index, &mut kes_keys_seed)
+            } else {
+                format!("{:<032}", party_index)
+            }
+        });
+
+        match &self.stake_distribution_generation_method {
+            StakeDistributionGenerationMethod::RandomDistribution { seed } => {
+                let mut stake_rng = ChaCha20Rng::from_seed(*seed);
+
+                signers_party_ids
+                    .map(|party_id| {
+                        let stake = 1 + stake_rng.next_u64() % 999;
+                        (party_id, stake)
+                    })
+                    .collect::<Vec<_>>()
+            }
+            StakeDistributionGenerationMethod::Custom(stake_distribution) => stake_distribution
+                .clone()
+                .into_iter()
+                .collect::<ProtocolStakeDistribution>(),
+        }
+    }
+}
+
+fn build_party_with_operational_certificate(
+    party_index: usize,
+    kes_key_seed: &mut [u8],
+) -> PartyId {
+    let keypair = ColdKeyGenerator::create_deterministic_keypair([party_index as u8; 32]);
+    let (kes_secret_key, kes_verification_key) = Sum6Kes::keygen(kes_key_seed);
+    let operational_certificate = OpCert::new(kes_verification_key, 0, 0, keypair);
+    let party_id = operational_certificate
+        .compute_protocol_party_id()
+        .expect("compute protocol party id should not fail");
+    let temp_dir = setup_temp_directory_for_signer(&party_id, true)
+        .expect("setup temp directory should return a value");
+    if !temp_dir.join("kes.sk").exists() {
+        kes_secret_key
+            .to_file(temp_dir.join("kes.sk"))
+            .expect("KES secret key file export should not fail");
+    }
+    if !temp_dir.join("opcert.cert").exists() {
+        operational_certificate
+            .to_file(temp_dir.join("opcert.cert"))
+            .expect("operational certificate file export should not fail");
+    }
+    party_id
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::collections::BTreeSet;
+
+    #[test]
+    fn with_protocol_params() {
+        let protocol_parameters = ProtocolParameters::new(1, 10, 0.56);
+        let result = MithrilFixtureBuilder::default()
+            .with_protocol_parameters(protocol_parameters.clone())
+            .build();
+
+        assert_eq!(protocol_parameters, result.protocol_parameters());
+    }
+
+    #[test]
+    fn with_signers() {
+        let result = MithrilFixtureBuilder::default().with_signers(4).build();
+
+        assert_eq!(4, result.signers_with_stake().len());
+    }
+
+    #[test]
+    fn random_stake_distribution_generates_as_many_signers_as_parties() {
+        let result = MithrilFixtureBuilder::default()
+            .with_stake_distribution(StakeDistributionGenerationMethod::RandomDistribution {
+                seed: [0u8; 32],
+            })
+            .with_signers(4)
+            .build();
+
+        assert_eq!(4, result.stake_distribution().len());
+    }
+
+    #[test]
+    fn each_parties_generated_with_random_stake_distribution_have_different_stakes() {
+        let result = MithrilFixtureBuilder::default()
+            .with_stake_distribution(StakeDistributionGenerationMethod::RandomDistribution {
+                seed: [0u8; 32],
+            })
+            .with_signers(5)
+            .build();
+        let stakes = result.stake_distribution();
+
+        // BtreeSet dedup values
+        assert_eq!(stakes.len(), BTreeSet::from_iter(stakes.values()).len());
+    }
+}
diff --git a/mithril-common/src/test_utils/mithril_fixture.rs b/mithril-common/src/test_utils/mithril_fixture.rs
new file mode 100644
index 000000000..3cbb82881
--- /dev/null
+++ b/mithril-common/src/test_utils/mithril_fixture.rs
@@ -0,0 +1,80 @@
+use crate::{
+    crypto_helper::{ProtocolInitializer, ProtocolSigner, ProtocolStakeDistribution},
+    entities::{ProtocolParameters, Signer, SignerWithStake, StakeDistribution},
+};
+use std::collections::HashMap;
+
+/// A fixture of Mithril data types.
+#[derive(Debug, Clone)]
+pub struct MithrilFixture {
+    protocol_parameters: ProtocolParameters,
+    signers: Vec<SignerFixture>,
+    stake_distribution: ProtocolStakeDistribution,
+}
+
+/// A signer fixture, containing a [signer entity][SignerWithStake] with its
+/// corresponding protocol [signer][ProtocolSigner] and
+/// [initializer][ProtocolInitializer]
+#[derive(Debug, Clone)]
+pub struct SignerFixture {
+    /// A [SignerWithStake].
+    pub signer_with_stake: SignerWithStake,
+    /// A [ProtocolSigner].
+    pub protocol_signer: ProtocolSigner,
+    /// A [ProtocolSigner].
+    pub protocol_initializer: ProtocolInitializer,
+}
+
+impl MithrilFixture {
+    /// [MithrilFixture] factory.
+    #[cfg(any(test, feature = "test_only"))]
+    pub fn new(
+        protocol_parameters: ProtocolParameters,
+        signers: Vec<SignerFixture>,
+        stake_distribution: ProtocolStakeDistribution,
+    ) -> Self {
+        Self {
+            protocol_parameters,
+            signers,
+            stake_distribution,
+        }
+    }
+
+    /// Get the fixture protocol parameters.
+    pub fn protocol_parameters(&self) -> ProtocolParameters {
+        self.protocol_parameters.clone()
+    }
+
+    /// Get the fixture signers.
+    pub fn signers_fixture(&self) -> Vec<SignerFixture> {
+        self.signers.clone()
+    }
+
+    /// Get the fixture signers.
+    pub fn signers(&self) -> Vec<Signer> {
+        self.signers
+            .clone()
+            .into_iter()
+            .map(|s| s.signer_with_stake.into())
+            .collect()
+    }
+
+    /// Get the fixture signers with stake.
+    pub fn signers_with_stake(&self) -> Vec<SignerWithStake> {
+        self.signers
+            .iter()
+            .map(|s| &s.signer_with_stake)
+            .cloned()
+            .collect()
+    }
+
+    /// Get the fixture stake distribution.
+    pub fn stake_distribution(&self) -> StakeDistribution {
+        HashMap::from_iter(self.stake_distribution.clone())
+    }
+
+    /// Get the fixture protocol stake distribution.
+    pub fn protocol_stake_distribution(&self) -> ProtocolStakeDistribution {
+        self.stake_distribution.clone()
+    }
+}
diff --git a/mithril-common/src/test_utils/mod.rs b/mithril-common/src/test_utils/mod.rs
new file mode 100644
index 000000000..98dce8ba2
--- /dev/null
+++ b/mithril-common/src/test_utils/mod.rs
@@ -0,0 +1,20 @@
+//! Test utilities
+//!
+//! They contains:
+//! * A Open Api Spec tester
+//! * Some precomputed fake data
+//! * A builder of [MithrilFixture] to generate signers alongside a stake distribution
+//!
+//! Note: Most of those tools are behind the `test_only` features.
+
+#[cfg(any(test, feature = "test_only"))]
+pub mod apispec;
+#[cfg(any(test, feature = "test_only"))]
+pub mod fake_data;
+#[cfg(any(test, feature = "test_only"))]
+mod fixture_builder;
+mod mithril_fixture;
+
+#[cfg(any(test, feature = "test_only"))]
+pub use fixture_builder::{MithrilFixtureBuilder, StakeDistributionGenerationMethod};
+pub use mithril_fixture::{MithrilFixture, SignerFixture};
diff --git a/mithril-signer/tests/state_machine.rs b/mithril-signer/tests/state_machine.rs
index b01e541e4..5b69cea77 100644
--- a/mithril-signer/tests/state_machine.rs
+++ b/mithril-signer/tests/state_machine.rs
@@ -1,8 +1,7 @@
 mod test_extensions;
 
 use mithril_common::{
-    crypto_helper::tests_setup,
-    entities::{Epoch, SignerWithStake},
+    crypto_helper::tests_setup, entities::Epoch, test_utils::MithrilFixtureBuilder,
 };
 
 use test_extensions::StateMachineTester;
@@ -12,8 +11,8 @@ use test_extensions::StateMachineTester;
 async fn test_create_single_signature() {
 
     let protocol_parameters = tests_setup::setup_protocol_parameters();
-    let signers = tests_setup::setup_signers(10, &protocol_parameters);
-    let signers_with_stake = signers.iter().map(|(signer_with_stake, _, _)| signer_with_stake.to_owned()).collect::<Vec<SignerWithStake>>();
+    let fixture = MithrilFixtureBuilder::default().with_signers(10).with_protocol_parameters(protocol_parameters.into()).build();
+    let signers_with_stake = fixture.signers_with_stake();
     let mut tester = StateMachineTester::init(&signers_with_stake).await.expect("state machine tester init should not fail");
 
     tester
diff --git a/mithril-signer/tests/test_extensions/certificate_handler.rs b/mithril-signer/tests/test_extensions/certificate_handler.rs
index f0ebeebb1..d0ff6bd61 100644
--- a/mithril-signer/tests/test_extensions/certificate_handler.rs
+++ b/mithril-signer/tests/test_extensions/certificate_handler.rs
@@ -112,7 +112,7 @@ impl CertificateHandler for FakeAggregator {
 #[cfg(test)]
 mod tests {
     use mithril_common::{
-        chain_observer::FakeObserver, digesters::DumbImmutableFileObserver, fake_data,
+        chain_observer::FakeObserver, digesters::DumbImmutableFileObserver, test_utils::fake_data,
         CardanoNetwork,
     };