diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9205243c82e6073245981324bc13096e8ec01947..54157bcf845c81a495c9e1e1fba805addb5df227 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,26 @@
 image: oarteam/batsim_ci
 
-build:
-  stage: build
+stages:
+  - build-and-test
+
+# unfortunately, it's difficult to create two separate jobs for building and testing
+# because the jobs will start again with a clean nix-store.. 
+build-and-test:
+  stage: build-and-test 
   script:
-    - nix-build ./default.nix -A batmen
\ No newline at end of file
+    #### In one command ####
+    - nix-shell ./default.nix --pure -A test_rebuild --command 'pytest'
+
+    #### In two separate commands ####
+    ## Build batmen
+    #- nix-build ./default.nix -A batmen
+    #- mkdir -p build && mv result/bin/batmen build/batmen
+
+    ## Test
+    #- nix-shell ./default.nix --pure -A test --command 'pytest'
+
+  allow_failure: true
+  artifacts:
+    when: always
+    paths:
+      - test-out/
diff --git a/src/broker/cloud_broker.cpp b/src/broker/cloud_broker.cpp
index d610ce27cfa4c00f7daa642e14ca5cb854a3b92f..00ebebad74fa2bb203beb9a653fcd3bdb7e94002 100644
--- a/src/broker/cloud_broker.cpp
+++ b/src/broker/cloud_broker.cpp
@@ -188,7 +188,11 @@ void CloudBroker::jobs_to_submit(
         user = user_queue.front();
     }
 
+    /* Reorder the user queue */
     user_queue.sort(CompareUsers());
+
+    /* Sort the jobs before sending them to submission, for determinism */
+    jobs.sort(JobComparator());
 }
 
 void CloudBroker::feedback_job_status(double date,
diff --git a/src/json_workload.cpp b/src/json_workload.cpp
index 79a590cafff6f07b7893d886e81ef3f19f51ef5f..0446f9d3296f35b9c104fe7b85c8cec416199b53 100644
--- a/src/json_workload.cpp
+++ b/src/json_workload.cpp
@@ -177,7 +177,18 @@ Job *Workload::job_from_json_object(const Value &object)
 
 bool JobComparator::operator()(const Job *j1, const Job *j2) const
 {
-    return j1->unique_number < j2->unique_number;
+    PPK_ASSERT_ERROR(j1->id.find('!') != string::npos,
+        "I thought jobID had always a form 'wl!id'...");
+
+    string id1 = j1->id.substr(j1->id.find('!') + 1, j1->id.size());
+    string id2 = j2->id.substr(j2->id.find('!') + 1, j2->id.size());
+
+    if (id1 == id2) /* different workload, same job number: comp on wl name */
+        return j1->id < j2->id;
+    if (id1.length() == id2.length()) /* same length: lexicographic order */
+        return id1 < id2;
+    return id1.length() < id2.length();
+
 }
 
 bool SessionComparator::operator()(const Session *s1, const Session *s2) const
diff --git a/src/queue.cpp b/src/queue.cpp
index 4ae78a5cde39529d2227ecf7b6e9fa8ca2c269b8..4b25b42afc85c3eddee5e85495945775ae64b4df 100644
--- a/src/queue.cpp
+++ b/src/queue.cpp
@@ -45,7 +45,7 @@ bool FCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
     (void) info;
 
     if (j1->release_date == j2->release_date)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->release_date < j2->release_date;
 }
@@ -67,7 +67,7 @@ bool LCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
     (void) info;
 
     if (j1->release_date == j2->release_date)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->release_date > j2->release_date;
 }
@@ -95,7 +95,7 @@ bool DescendingBoundedSlowdownOrder::compare(const SortableJob *j1, const Sortab
     (void) info;
 
     if (j1->bounded_slowdown == j2->bounded_slowdown)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->bounded_slowdown > j2->bounded_slowdown;
 }
@@ -116,7 +116,7 @@ bool DescendingSlowdownOrder::compare(const SortableJob *j1, const SortableJob *
     (void) info;
 
     if (j1->slowdown == j2->slowdown)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->slowdown > j2->slowdown;
 }
@@ -137,7 +137,10 @@ bool AscendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2, c
     (void) info;
 
     if (j1->job->nb_requested_resources == j2->job->nb_requested_resources)
-        return j1->job->submission_time < j2->job->submission_time;
+        if (j1->job->submission_time == j2->job->submission_time)
+            return jobcmp(j1->job, j2->job);
+        else
+            return j1->job->submission_time < j2->job->submission_time;
     else
         return j1->job->nb_requested_resources < j2->job->nb_requested_resources;
 }
@@ -159,7 +162,10 @@ bool DescendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2,
     (void) info;
 
     if (j1->job->nb_requested_resources == j2->job->nb_requested_resources)
-        return j1->job->submission_time < j2->job->submission_time;
+        if (j1->job->submission_time == j2->job->submission_time)
+            return jobcmp(j1->job, j2->job);
+        else
+            return j1->job->submission_time < j2->job->submission_time;
     else
         return j1->job->nb_requested_resources > j2->job->nb_requested_resources;
 }
@@ -181,7 +187,7 @@ bool AscendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *j
     (void) info;
 
     if (j1->job->walltime == j2->job->walltime)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->job->walltime < j2->job->walltime;
 }
@@ -203,7 +209,7 @@ bool DescendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *
     (void) info;
 
     if (j1->job->walltime == j2->job->walltime)
-        return j1->job->id < j2->job->id;
+        return jobcmp(j1->job, j2->job);
     else
         return j1->job->walltime > j2->job->walltime;
 }
diff --git a/src/queue.hpp b/src/queue.hpp
index a99be23fd15b966f5bbcaf46e0aee3234abc9abf..2c17c1ac1464ce6d7c9ebaf1f227f9bf93f5f238 100644
--- a/src/queue.hpp
+++ b/src/queue.hpp
@@ -2,7 +2,7 @@
 
 #include <list>
 
-struct Job;
+#include "json_workload.hpp"
 
 #include "schedule.hpp"
 
@@ -37,6 +37,9 @@ public:
     virtual ~SortableJobOrder();
     virtual bool compare(const SortableJob * j1, const SortableJob * j2, const CompareInformation * info = nullptr) const = 0;
     virtual void updateJob(SortableJob * job, const UpdateInformation * info = nullptr) const = 0;
+
+protected:
+    JobComparator jobcmp;
 };
 
 class FCFSOrder : public SortableJobOrder
diff --git a/test/expected_log/bin_packing-2machines-para_homo_jobs.csv b/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
index c43e8b8611224a44d82484e46175510e2445b186..9523f91f2d9c20b31f45d841ce92eaba0f0cd58e 100644
--- a/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
+++ b/test/expected_log/bin_packing-2machines-para_homo_jobs.csv
@@ -5,8 +5,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 1,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,0,687380.500000,""
 2,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
 9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,2213.000000,8213.000000,0.000000,2213.000000,1.000000,0,480221.000000,""
 4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
 5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
 6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6000.000000,7043.000000,13043.000000,0.000000,7043.000000,1.000000,1,1116315.500000,""
diff --git a/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv b/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
index be6a49695a1f0745fda6bddbc295b676b6921afb..c072e094eb21756511a2d3f7ceb68f40bebe1cb4 100644
--- a/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
+++ b/test/expected_log/bin_packing_energy-2machines-para_homo_jobs.csv
@@ -5,8 +5,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 1,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,0,687380.500000,""
 2,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,0.000000,3520.000000,3520.000000,0.000000,3520.000000,1.000000,1,687380.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
 9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,0,480221.000000,""
 4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
 5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
 6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,7043.000000,13193.000000,150.000000,7193.000000,1.021298,1,1116315.500000,""
diff --git a/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv b/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
index 4193aa76e1e18a95e65da223665b068b5dddd49e..566e7ac658a792af77b705d7945fe13211b8b1fd 100644
--- a/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
+++ b/test/expected_log/broker-bpNRJ-2machines-para_homo_jobs.csv
@@ -65,8 +65,8 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 65,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,1,21700.000000,""
 66,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,1,21700.000000,""
 67,bob1,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8085.000000,100.000000,8185.000000,85.000000,185.000000,1.850000,0,21078.437500,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6087.500000,2213.000000,8300.500000,87.500000,2300.500000,1.039539,0,454437.125000,""
-9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,1,396288.125000,""
+9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6087.500000,2213.000000,8300.500000,87.500000,2300.500000,1.039539,0,454437.125000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,6150.000000,2213.000000,8363.000000,150.000000,2363.000000,1.067781,1,396288.125000,""
 8,alice,100_sec,8993.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8993.000000,100.000000,9093.000000,0.000000,100.000000,1.000000,0,20559.250000,""
 68,bob1,100_sec,9000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,9000.000000,100.000000,9100.000000,0.000000,100.000000,1.000000,0,20917.562500,""
 69,bob1,100_sec,9000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,9000.000000,100.000000,9100.000000,0.000000,100.000000,1.000000,0,20917.562500,""
diff --git a/test/expected_log/cocktail_user_model-2machines_jobs.csv b/test/expected_log/cocktail_user_model-2machines_jobs.csv
index 4a198692578c3545a9c56f0ba51503fc1f52193e..8ee91af449910ff6156a59c7ac7673ee9f03de90 100644
--- a/test/expected_log/cocktail_user_model-2machines_jobs.csv
+++ b/test/expected_log/cocktail_user_model-2machines_jobs.csv
@@ -13,6 +13,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 2,alice,100_sec,1500.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1500.000000,100.000000,1600.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 3,alice,100_sec,1750.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1750.000000,100.000000,1850.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 4,alice,100_sec,1875.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,1875.000000,100.000000,1975.000000,0.000000,100.000000,1.000000,0,10731.250000,""
+3,caty,100_sec,2000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 6,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 7,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 8,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -21,7 +22,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 11,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 12,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 13,bob,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-3,caty,100_sec,2000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 5,alice,100_sec,2000.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.500000,100.000000,2100.500000,0.000000,100.000000,1.000000,0,17279.593750,""
 6,alice,100_sec,2157.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2157.500000,100.000000,2257.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 7,alice,100_sec,2283.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2283.000000,100.000000,2383.000000,0.000000,100.000000,1.000000,0,10731.250000,""
@@ -70,6 +70,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 30,alice,100_sec,4791.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4791.500000,100.000000,4891.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 31,alice,100_sec,4892.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4892.000000,100.000000,4992.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 32,alice,100_sec,4992.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,4992.500000,100.000000,5092.500000,0.000000,100.000000,1.000000,0,16818.906250,""
+8,caty,100_sec,5000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 38,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 39,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 40,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -78,7 +79,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 43,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 44,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 45,bob,100_sec,5000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-8,caty,100_sec,5000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,100.000000,5100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 33,alice,100_sec,5093.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5093.000000,100.000000,5193.000000,0.000000,100.000000,1.000000,0,11191.937500,""
 34,alice,100_sec,5193.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5193.500000,100.000000,5293.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 35,alice,100_sec,5294.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,5294.000000,100.000000,5394.000000,0.000000,100.000000,1.000000,0,10731.250000,""
@@ -128,6 +128,7 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 59,alice,100_sec,7706.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7706.000000,100.000000,7806.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 60,alice,100_sec,7806.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7806.500000,100.000000,7906.500000,0.000000,100.000000,1.000000,0,10731.250000,""
 61,alice,100_sec,7907.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,7907.000000,100.000000,8007.000000,0.000000,100.000000,1.000000,0,11191.937500,""
+13,caty,100_sec,8000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 78,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 79,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 80,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
@@ -136,7 +137,6 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 83,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 84,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 85,bob,100_sec,8000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
-13,caty,100_sec,8000.000000,1,-1.000000,1,COMPLETED_SUCCESSFULLY,8000.000000,100.000000,8100.000000,0.000000,100.000000,1.000000,0,17308.843750,""
 62,alice,100_sec,8007.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8007.500000,100.000000,8107.500000,0.000000,100.000000,1.000000,0,16818.906250,""
 63,alice,100_sec,8108.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8108.000000,100.000000,8208.000000,0.000000,100.000000,1.000000,0,10731.250000,""
 64,alice,100_sec,8208.500000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,8208.500000,100.000000,8308.500000,0.000000,100.000000,1.000000,0,10731.250000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_following_jobs.csv b/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
index 7579f125e91748a4bab264c6096d55272e19d5ed..6bb6b5b2c49e2f7129e8db84bae40f4fea27f536 100644
--- a/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_following_jobs.csv
@@ -1,7 +1,7 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
 1:s1,fb_user_think_time_only,1000,0.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,0.000000,1000.000000,1000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
-4:s4,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
+3:s3,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
 2:s2,fb_user_think_time_only,2000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,2000.000000,4000.000000,0.000000,2000.000000,1.000000,0,434000.000000,""
-3:s3,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
+4:s4,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,4000.000000,1000.000000,5000.000000,2000.000000,3000.000000,3.000000,0,217000.000000,""
 6:s6,fb_user_think_time_only,1000,3000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,4000.000000,1000.000000,5000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv b/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
index 0fae0f7e327afbbe6e04f947c75b6b3f14bd53c7..a874b8f9fbedd4b975363b09002d0cec24ba58b1 100644
--- a/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_preceding_jobs.csv
@@ -1,7 +1,7 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
 1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
-3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
-4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,500.000000,1500.000000,1.500000,1,217000.000000,""
-2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,2000.000000,4000.000000,1000.000000,3000.000000,1.500000,0,434000.000000,""
+2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,1,434000.000000,""
+3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,0,217000.000000,""
+4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1500.000000,2500.000000,2.500000,0,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
 6:s6,fb_user_think_time_only,1000,5000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,5000.000000,1000.000000,6000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
diff --git a/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv b/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
index 2d9681b864ec8d5329bcd41a741a4d66612bf089..4c2a974fd5efcbcab71f5f78fe6e5a3e95625859 100644
--- a/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
+++ b/test/expected_log/fb_user_think_time_only-many_start_sessions_jobs.csv
@@ -1,6 +1,6 @@
 job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
-1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,1,217000.000000,""
-2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,0,434000.000000,""
-3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
+1:s1,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,1000.000000,2000.000000,0.000000,1000.000000,1.000000,0,217000.000000,""
+2:s2,fb_user_think_time_only,2000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,2000.000000,3000.000000,0.000000,2000.000000,1.000000,1,434000.000000,""
+3:s3,fb_user_think_time_only,1000,1000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,1000.000000,3000.000000,1000.000000,2000.000000,2.000000,0,217000.000000,""
 4:s4,fb_user_think_time_only,1000,1500.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1500.000000,2500.000000,2.500000,0,217000.000000,""
 5:s5,fb_user_think_time_only,1000,2000.000000,16,2592000.000000,1,COMPLETED_SUCCESSFULLY,3000.000000,1000.000000,4000.000000,1000.000000,2000.000000,2.000000,1,217000.000000,""
diff --git a/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv b/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
index 4bc200b6ae3055a07f5cddf0e4de062263d55217..8307607d0de4badee282d79095c2cbf2315cd3df 100644
--- a/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
+++ b/test/expected_log/multicore_filler-2machines-para_homo_jobs.csv
@@ -5,12 +5,12 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 3,w0,blast_vm_large,0.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,10560.000000,3520.000000,14080.000000,10560.000000,14080.000000,4.000000,0,454960.000000,""
 8,w0,blast_vm_xlarge,0.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,14080.000000,2213.000000,16293.000000,14080.000000,16293.000000,7.362404,0,350760.500000,""
 10,w0,blast_vm_xlarge,1000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,16293.000000,2213.000000,18506.000000,15293.000000,17506.000000,7.910529,0,350760.500000,""
-11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,18506.000000,2213.000000,20719.000000,12506.000000,14719.000000,6.651152,0,350760.500000,""
-4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,20719.000000,7043.000000,27762.000000,14719.000000,21762.000000,3.089876,0,807303.875000,""
-5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,27762.000000,7043.000000,34805.000000,21762.000000,28805.000000,4.089876,0,807303.875000,""
-6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,34805.000000,7043.000000,41848.000000,28805.000000,35848.000000,5.089876,0,807303.875000,""
-7,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,41848.000000,7043.000000,48891.000000,35848.000000,42891.000000,6.089876,0,807303.875000,""
-9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,48891.000000,2213.000000,51104.000000,42891.000000,45104.000000,20.381383,0,350760.500000,""
+4,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,18506.000000,7043.000000,25549.000000,12506.000000,19549.000000,2.775664,0,807303.875000,""
+5,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,25549.000000,7043.000000,32592.000000,19549.000000,26592.000000,3.775664,0,807303.875000,""
+6,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,32592.000000,7043.000000,39635.000000,26592.000000,33635.000000,4.775664,0,807303.875000,""
+7,w0,blast_vm_medium,6000.000000,2,-1.000000,1,COMPLETED_SUCCESSFULLY,39635.000000,7043.000000,46678.000000,33635.000000,40678.000000,5.775664,0,807303.875000,""
+9,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,46678.000000,2213.000000,48891.000000,40678.000000,42891.000000,19.381383,0,350760.500000,""
+11,w0,blast_vm_xlarge,6000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,48891.000000,2213.000000,51104.000000,42891.000000,45104.000000,20.381383,0,350760.500000,""
 12,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,51104.000000,3520.000000,54624.000000,37104.000000,40624.000000,11.540909,0,454960.000000,""
 13,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,54624.000000,3520.000000,58144.000000,40624.000000,44144.000000,12.540909,0,454960.000000,""
 14,w0,blast_vm_large,14000.000000,4,-1.000000,1,COMPLETED_SUCCESSFULLY,58144.000000,3520.000000,61664.000000,44144.000000,47664.000000,13.540909,0,454960.000000,""
diff --git a/test/expected_log/routine_greedy-2machines_jobs.csv b/test/expected_log/routine_greedy-2machines_jobs.csv
index c67a2357cdec86789f7dcbb8b8a6373066d6f386..e22260e1ccd57528b6f43019d3880792537b1480 100644
--- a/test/expected_log/routine_greedy-2machines_jobs.csv
+++ b/test/expected_log/routine_greedy-2machines_jobs.csv
@@ -33,14 +33,14 @@ job_id,workload_name,profile,submission_time,requested_number_of_resources,reque
 7,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 8,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 9,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-10,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-11,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-12,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
-13,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 9,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+10,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 10,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+11,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 11,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+12,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 12,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
+13,bob1,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 13,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 14,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
 15,bob2,100_sec,2000.000000,1,3600.000000,1,COMPLETED_SUCCESSFULLY,2000.000000,100.000000,2100.000000,0.000000,100.000000,1.000000,0,21700.000000,""
diff --git a/test/helper.py b/test/helper.py
index f05701658535a7cd1c5301ccd279f6f5b41c2a75..ffe972e0886db8e43c2da9aeb3927bf198ca9294 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -59,7 +59,7 @@ def init_instance(test_name):
     return (output_dir, robin_filename, schedconf_filename)
 
 def has_expected_output(test_file):
-    return os.path.exists('test/expected_log/' + test_file + '/_jobs.csv')
+    return os.path.exists('test/expected_log/' + test_file + '_jobs.csv')
 
 def assert_expected_output(test_file):
     expected = 'test/expected_log/' + test_file + '_jobs.csv'
diff --git a/test/test_broker.py b/test/test_broker.py
index 6866ae6032631f69684e9e743f81b157fd853bd9..fc72749af6b1b06fc99c68183505d7f11d470b03 100644
--- a/test/test_broker.py
+++ b/test/test_broker.py
@@ -23,6 +23,9 @@ def test_broker_mono(platform_monoC, workload_static, sched_mono):
     ret = run_robin(robin_filename)
     assert ret.returncode == 0
 
+    if has_expected_output(test_name):
+        assert_expected_output(test_name)
+
 
 def test_broker_multi(platform_multiC, workload_static, sched_multi):
     """Test the broker mode with multicore platform files and schedulers"""
@@ -41,3 +44,6 @@ def test_broker_multi(platform_multiC, workload_static, sched_multi):
     instance.to_file(robin_filename)
     ret = run_robin(robin_filename)
     assert ret.returncode == 0
+
+    if has_expected_output(test_name):
+        assert_expected_output(test_name)
diff --git a/test/test_schedulers_multi.py b/test/test_schedulers_multi.py
index f2b646e9e69d38417e62cc6bd30ed5f85e91e85c..ce0f4b029ee3cd217d674b7169025d48c26683ec 100644
--- a/test/test_schedulers_multi.py
+++ b/test/test_schedulers_multi.py
@@ -21,7 +21,7 @@ def test_multicore_filler(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)
 
 
 def test_bin_packing(platform_multiC, workload_static):
@@ -44,7 +44,7 @@ def test_bin_packing(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)
 
 
 def test_bin_packing_energy(platform_multiC, workload_static):
@@ -67,4 +67,4 @@ def test_bin_packing_energy(platform_multiC, workload_static):
     assert ret.returncode == 0
 
     if has_expected_output(test_name):
-        assert assert_expected_output(test_name)
+        assert_expected_output(test_name)