Added the script that creates all the test files and classes (won't work unchanged, but have at least been added for now)
1. Amended paths
2. Amended script and template names
3. Delete commented-out portion
4. Checking if the output files already exist before creating them
Taken out the static tables from 00-clean-db.sql
Fixture directory tree to match our library directory structure, allowing selective sets of test data per perl class
No longer loading legacy data
1. For every new model creation, run 00-clean-db.sql .
2. Always load the static reference data
3. Automatic 'legacy' loading of the 10-load-fixture-data.sql for all tests if not told otherwise.
4. Loading of selective fixture file if specifically told to (where class A::B::C::D loads files from static/test/fixtures/A/B/C/D)
--- a/lib/LIMS2/Test.pm
+++ b/lib/LIMS2/Test.pm
@@ -23,7 +23,6 @@ use Digest::MD5;
 use LIMS2::Model::Util::PgUserRole qw( db_name );
 use LIMS2::Model::Util::RefdataUpload;
 use File::Basename;
-#use Smart::Comments;

 const my $FIXTURE_RX => qr/^\d\d\-[\w-]+\.sql$/;

@@ -126,6 +125,24 @@ sub _build_test_data {

 sub _build_model {
     my ( $class, $name, $args ) = @_;
+    my ($fixture_directory, $new);
+
+    # Fixture data processing
+    if ($args->{classdata}) {
+       # Fixture data is derived from the caller's classname, i.e
+       #  if the caller package is "A::B::C::D", we look for files in '/data/fixtures/A/B/C/D'
+       my $classname = (caller(0))[0];
+       my $classdir;
+       ($classdir = $classname) =~ s/::/\//g;
+       $fixture_directory = '/test/fixtures/' . $classdir;
+       $new = 1;
+    } elsif ($args->{classdir}) {
+       $fixture_directory = $args->{classdir};
+       $new = 1;
+    } else {
+       $fixture_directory = '/test/fixtures/legacy';
+       $new = 0;
+    }

 #    my $user = $args->{user} || 'tests';
     my $user = $args->{user} || 'lims2';
@@ -141,11 +158,18 @@ sub _build_model {

     unless ( $ENV{SKIP_LOAD_FIXTURES} ) {
        # Base fixture data (only file remaining is 'delete all data' file)
-       load_files('/static/test/fixtures/');
+       load_files('/static/test/fixtures/00-clean-db.sql');
        # Reference data (part of every test)
-       # Need to be loaded in this particular order!!
+       #  (Need to be loaded in this particular order!!)
        load_static_files();
-
+       # Finally load the test data
+       if ($new) {
+           # A complete set of csv files, to be loaded in a specific order
+           load_dynamic_files($fixture_directory);
+       } else {
+           # Test data delivered in the form of a legacy sql file
+           load_files($fixture_directory);
+       }
     }

     $model->schema->storage->txn_begin;
@@ -153,6 +177,10 @@ sub _build_model {
 }
Renamed from lims2_create_static_fixtures.pl to lims2_create_fixtures.pl
(all internal references updated accordingly)
add new test for creating a SEP plate via csv upload
SEP plate csv upload requires different csv headers than from any other plate type
Load fixtures: Simple load of text file (sql or csv) into the database
Tests for LIMS2::Model::Util::RefdataUpload
Final changes for the testing framework: Load static and dynamic feature sets.
Merge branch 'devel' into lerlands