| 1 | [[TOC()]] |
| 2 | = Regression testing protocol = |
| 3 | |
| 4 | Below we describe the regression testing procedure we use to verify XGAP importing, exporting and database backend capabilities. This procedure involves a series of automated imports and exports; the results of the exports should match the imports otherwise there is an error somewhere in the XGAP infrastructure. Users extending XGAP can use this method to verify proper functioning of their XGAP instance. |
| 5 | |
| 6 | == Requirements being tested == |
| 7 | |
| 8 | The testing protocol aims to test the following: |
| 9 | * A connection with MySQL can be established |
| 10 | * The referred database exists in MySQL |
| 11 | * The default user ('molgenis') exists and has been granted database rights |
| 12 | * The molgenis' generated SQL data model file is correct |
| 13 | * MySQL is set up correctly and is able to insert the datastructure |
| 14 | * Tar.gz extraction functions works correctly |
| 15 | * Generated CSV importer/exporter uses the correct input/output files |
| 16 | * Generated CSV importer/exporter can instantiate the database |
| 17 | * Generated CSV importer/exporter finds the corresponding datatypes and mappers |
| 18 | * Generated CSV importer/exporter performs import/export process correctly according to datatypes, mappers, contraints, table names, etc. |
| 19 | * All imported components are contained within an investigation and cannot conflict with another investigation |
| 20 | * All investigations are unique |
| 21 | * Custom XGAP CSV exporter is able to use queryrules to export one specific investigation to a unique location |
| 22 | * Custom XGAP CSV exporter procedure can successfully query the database with additional argument "all investigations" |
| 23 | * Directory/file compare tool can determine if directory content is equal and file content is equal |
| 24 | * Control data for directory/file compare tool yields correct results (two positive and two negative controls) |
| 25 | == Procedure: full data roundtrip with multiple investigations == |
| 26 | We assume that we have two data sets with each one investigation. In this example we use 'Bailey' and 'Lyons' from XGAP DataSets. The test protocol involves: |
| 27 | |
| 28 | 1) Start with an empty database by cleaning it[[BR]] |
| 29 | ''Passes only if:'' The connection with MySQL is established, database exists, user exists and has rights, generated SQL file is correct (syntax, constraints, char encoding etc), MySQL is set up correctly and is able to insert the datastructure. (thereby removing all existing XGAP content) |
| 30 | |
| 31 | 2) Extract investigation "Bailey" from an archive and import from extract directory '''A'''[[BR]] |
| 32 | ''Passes only if:'' Tar.gz extraction tool works correctly, CSV import procedure detects files and imports correctly according to contraints, table names, etc. |
| 33 | |
| 34 | 3) Extract investigation "Lyons" from an archive and import from extract directory '''B'''[[BR]] |
| 35 | ''Passes only if:'' Same as 2), plus there must be no 'id' like fields present that could conflict with "Bailey", all entries are independant of previous imports, investigation must be unique. |
| 36 | |
| 37 | 4) Perform an 'Export all' on the database to a single tar.gz archive[[BR]] |
| 38 | ''Passes only if:'' CSV export procedure can successfully query the database with argument 'all investigations, write out files in the right format, in the appropriate locations. |
| 39 | |
| 40 | 5) Empty the database[[BR]] |
| 41 | ''Passes only if:'' Same as 1). |
| 42 | |
| 43 | 6) Import the previously exported data from the tar.gz archive[[BR]] |
| 44 | ''Passes only if:'' Same as 3), but now the CSV import procedure has one dataset containing two investigations that are imported simultaniously, so there may be no conflicts. |
| 45 | |
| 46 | 7) Perform an 'Export one investigation' on the database by selecting "Bailey" into directory '''C'''[[BR]] |
| 47 | ''Passes only if:'' CSV export procedure can successfully query the database for one specific investigation amongst many, write out the appropriate files in the right format, in the right locations. |
| 48 | |
| 49 | 8) Perform an 'Export one investigation' on the database by selecting "Lyons" into directory '''D'''[[BR]] |
| 50 | ''Passes only if:'' Same as 7), plus locations of files may not overlap. |
| 51 | |
| 52 | 9) Check whether file compare function works properly by executing it on positive and negative controls[[BR]] |
| 53 | ''Passes only if:'' Both positive and both negative controls for the compare function on existing test files are successful. |
| 54 | |
| 55 | 10) Compare directory '''A''' vs. '''C''' and '''B''' vs. '''D'''. Both comparisons should yield "true"[[BR]] |
| 56 | ''Passes only if:'' Directory content is equal (number and names of files) and file content is equal (number and content of each line). |
| 57 | |
| 58 | Example result: |
| 59 | {{{ |
| 60 | Step 9 |
| 61 | Difference in files detected: |
| 62 | * File 1: containsA.txt |
| 63 | * File 2: containsB.txt |
| 64 | * Line in file 1: A |
| 65 | * Line in file 2: B |
| 66 | Difference in files detected: |
| 67 | * File 1: containsB.txt |
| 68 | * File 2: containsA.txt |
| 69 | * Line in file 1: B |
| 70 | * Line in file 2: A |
| 71 | Positive 'file content compare' control 1 (true): true |
| 72 | Positive 'file content compare' control 2 (true): true |
| 73 | Negative 'file content compare' control 1 (false): false |
| 74 | Negative 'file content compare' control 2 (false): false |
| 75 | Step 10 |
| 76 | Comparing 'Bailey_extract' vs 'bailey_export'.. |
| 77 | Comparing 'data' vs 'data'.. |
| 78 | --> Directories are equal. |
| 79 | --> Directories are equal. |
| 80 | Comparing 'Lyons_extract' vs 'lyons_export'.. |
| 81 | Comparing 'data' vs 'data'.. |
| 82 | --> Directories are equal. |
| 83 | --> Directories are equal. |
| 84 | Directories of Bailey are equal: true |
| 85 | Directories of Lyons are equal: true |
| 86 | }}} |
| 87 | |
| 88 | == Extending the automated test cases == |
| 89 | |
| 90 | The following test cases have been implemented: |
| 91 | |
| 92 | * Full data roundtrip using test sets Bailey and Lyons |
| 93 | * Full data roundtrip using test sets Keurentjes and Beamer |
| 94 | |
| 95 | This code can be found in [http://www.xgap.org/browser/xgap_1_2_distro/handwritten/java/regressiontest/csv/Case1.java Case1.java] and [http://www.xgap.org/browser/xgap_1_2_distro/handwritten/java/regressiontest/csv/Case2.java Case2.java] in the folder [http://www.xgap.org/browser/xgap_1_2_distro/handwritten/java/regressiontest handwritten/java/regressiontest/csv]. |
| 96 | Interested users can add more test cases in a similar fashion. |