Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

DB layer 2.0 functional testing: Difference between revisions

From MoodleDocs
m (cat edit)
(Completing DML unit tests)
Line 2: Line 2:
{{Template:Development:dmllib 2.0}}
{{Template:Development:dmllib 2.0}}
== DDL tests ==
== DDL tests ==
Based on tests already used in xmldb, the following have been implemented in simpletest:
Based on tests already used in xmldb, the following methods have been implemented in simpletest:
 
* TestCreateTable
* TestDropTable
* TestAddEnumField
* TestAddNumericField
* TestDropField
* TestChangeFieldType
* TestChangeFieldPrecision
* TestChangeFieldSign
* TestChangeFieldNullability
* TestChangeFieldDefault
* TestAddUniqueIndex
* TestAddNonUniqueIndex
* TestFindIndexName
* TestDropIndex
* TestAddUniqueKey
* TestAddForeignUniqueKey
* TestDropKey
* TestAddForeignKey
* TestDropForeignKey
* TestChangeFieldEnum
* TestRenameIndex >>>'''Experimental'''<<<
* TestRenameKey >>>'''Experimental'''<<<
* TestRenameField
* TestRenameTable
 
The following database_manager method still need to be tested:


* create_table
* drop_table
* add_enum_field
* add_numeric_field
* drop_field
* change_field_type
* change_field_precision
* change_field_sign
* change_field_nullability
* change_field_default
* add_unique_index
* add_non_unique_index
* find_index_name
* drop_index
* add_unique_key
* add_foreign_unique_key
* drop_key
* add_foreign_key
* drop_foreign_key
* change_field_enum
* rename_index >>>'''experimental'''<<<
* rename_key >>>'''experimental'''<<<
* rename_field
* rename_table
* table_exists
* table_exists
* field_exists
* field_exists
Line 42: Line 39:
* create_temp_table
* create_temp_table


Additionally, the tests need to be expanded to include boundary conditions, including invalid or incomplete parameters.
== DML tests ==
The following methods have been implemented in unit tests:
 
* fix_sql_params
* get_tables
* get_indexes
* get_columns
* execute
* get_in_or_equal
* fix_table_names
* get_recordset
* get_recordset_list
* get_recordset_select
* get_recordset_sql
* get_records
* get_records_list
* get_records_select
* get_records_sql
* get_records_menu
* get_records_select_menu
* get_records_sql_menu
* get_record
* get_record_select
* get_record_sql
* get_field
* get_field_select
* get_field_sql
* get_fieldset_select
* get_fieldset_sql
* insert_record_raw
* insert_record
* update_record_raw
* update_record
* set_field
* set_field_select
* count_records
* count_records_select
* count_records_sql
* record_exists
* record_exists_select
* record_exists_sql
* delete_records
* delete_records_select
 
== Still to do ==
 
The tests need to be expanded to include boundary conditions, including invalid or incomplete parameters.


* How do these methods behave when given invalid params?
* How do these methods behave when given invalid params?
* Are exceptions in place, and are they caught appropriately?
* Are exceptions in place, and are they caught appropriately?

Revision as of 07:09, 3 July 2008

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.


DDL tests

Based on tests already used in xmldb, the following methods have been implemented in simpletest:

  • create_table
  • drop_table
  • add_enum_field
  • add_numeric_field
  • drop_field
  • change_field_type
  • change_field_precision
  • change_field_sign
  • change_field_nullability
  • change_field_default
  • add_unique_index
  • add_non_unique_index
  • find_index_name
  • drop_index
  • add_unique_key
  • add_foreign_unique_key
  • drop_key
  • add_foreign_key
  • drop_foreign_key
  • change_field_enum
  • rename_index >>>experimental<<<
  • rename_key >>>experimental<<<
  • rename_field
  • rename_table
  • table_exists
  • field_exists
  • index_exists
  • find_check_constraint_name
  • check_constraint_exists
  • find_key_name
  • find_sequence_name
  • delete_tables_from_xmldb_file
  • install_from_xmldb_file
  • create_temp_table

DML tests

The following methods have been implemented in unit tests:

  • fix_sql_params
  • get_tables
  • get_indexes
  • get_columns
  • execute
  • get_in_or_equal
  • fix_table_names
  • get_recordset
  • get_recordset_list
  • get_recordset_select
  • get_recordset_sql
  • get_records
  • get_records_list
  • get_records_select
  • get_records_sql
  • get_records_menu
  • get_records_select_menu
  • get_records_sql_menu
  • get_record
  • get_record_select
  • get_record_sql
  • get_field
  • get_field_select
  • get_field_sql
  • get_fieldset_select
  • get_fieldset_sql
  • insert_record_raw
  • insert_record
  • update_record_raw
  • update_record
  • set_field
  • set_field_select
  • count_records
  • count_records_select
  • count_records_sql
  • record_exists
  • record_exists_select
  • record_exists_sql
  • delete_records
  • delete_records_select

Still to do

The tests need to be expanded to include boundary conditions, including invalid or incomplete parameters.

  • How do these methods behave when given invalid params?
  • Are exceptions in place, and are they caught appropriately?