Dataform Tests: Difference between revisions
- Overview
- Activity administration
- Building an activity
- CSS tips and tricks
- JS tips and tricks
- Activating RSS
- Activity workflow
- Grading
m (added link to spanish translation of page) |
|||
Line 21: | Line 21: | ||
TBC | TBC | ||
===Available steps=== | ===Available steps=== | ||
====I start afresh==== | |||
* Resets (truncates) all dataform tables to remove any records and reset sequences. | |||
* This step is essential for any standalone scenario that adds entries with content since such a scenario has to refer to input elements by the name field_{fieldid}_{entryid} (or field_{fieldid}_-1 for a new entry) and the ids have to persist between runs. | |||
====I add a test dataform==== | ====I add a test dataform==== | ||
* Adds a test dataform as teacher 1 in course 1 and displays the dataform. | |||
* The step begins in a new test site. | |||
====I delete this dataform==== | |||
* Deletes the dataform. | |||
* This step begins inside the designated dataform. | |||
* Useful at the end of standalone scenarios for cleanup. | |||
====I go to manage dataform "TABNAME_STRING"==== | ====I go to manage dataform "TABNAME_STRING"==== | ||
* Goes to the specified manage tab of the current dataform. | |||
* The step begins from the dataform's course page. | |||
Example: | Example: | ||
<nowiki> | <nowiki> | ||
Line 28: | Line 40: | ||
</nowiki> | </nowiki> | ||
====I add a dataform field "FIELDTYPE_STRING" with "SETTINGSLIST_STRING"==== | ====I add a dataform field "FIELDTYPE_STRING" with "SETTINGSLIST_STRING"==== | ||
* Adds a field of the specified type to the current dataform with the provided table data (usually Name). | |||
* The step begins from the dataform's course page. | |||
'''Example''': | '''Example''': | ||
<nowiki> | <nowiki> | ||
Line 56: | Line 71: | ||
You can include in the settings list only some of the form settings but the order should be preserved. For example, if you want to add a field with only name and description (the rest will be the default settings) you can add the following step: | You can include in the settings list only some of the form settings but the order should be preserved. For example, if you want to add a field with only name and description (the rest will be the default settings) you can add the following step: | ||
<nowiki> | <nowiki> | ||
And I add a dataform field "checkbox" with "Field 01 Field description | And I add a dataform field "checkbox" with "Field 01 Field description 01” | ||
</nowiki> | </nowiki> | ||
====I add a dataform view "VIEWTYPE_STRING" with "SETTINGSLIST_STRING"==== | |||
* Adds a view of the specified type to the current dataform with the provided table data (usually Name). | |||
* The step begins in the dataform's Manage | Views tab. | |||
====I set view "VIEWNAME_STRING" as default==== | |||
* Sets a view as the default view of a dataform instance. | |||
* The step begins in the dataform's Manage | Views tab | |||
* with the designated view (by name) already added. | |||
====I add a dataform filter with "SETTINGSLIST_STRING"==== | ====I add a dataform filter with "SETTINGSLIST_STRING"==== | ||
* Adds a filter with the specified data to the current dataform. | |||
* The step begins in the dataform's Manage | Filters tab. | |||
====I add a dataform entry==== | |||
* Adds an entry without data to the current dataform. | |||
* You should be in the dataform page, and the dataform should have a default view with submission options. | |||
===Adding tests=== | ===Adding tests=== | ||
See https://docs.moodle.org/dev/Acceptance_testing#Writing_features for general test writing guidelines. | See https://docs.moodle.org/dev/Acceptance_testing#Writing_features for general test writing guidelines. |
Revision as of 00:53, 17 February 2014
Unit tests
TBC
Acceptance tests
Setup
See https://docs.moodle.org/dev/Acceptance_testing for information about preparing your Moodle installation for acceptance testing. Note that this is not recommended for production sites.
Running the tests
Administrator can run Dataform acceptance tests with the Moodle behat command line tool (see https://docs.moodle.org/dev/Acceptance_testing#Running_tests).
Alternately administrator can use the Dataform Acceptance testing interface from
Administration > Site administration > Plugins > Activity modules > Dataform > Acceptance testing
for testing particular Dataform features by name or tags.
The current implementation of the Dataform Acceptance testing interface assumes that a selenium server is running. To run a test, select a feature or tags and click 'Run tests'. The page will hang until the tests are completed. If you run long tests it may be better to run them from a command line.
Available tests
TBC
Available steps
I start afresh
- Resets (truncates) all dataform tables to remove any records and reset sequences.
- This step is essential for any standalone scenario that adds entries with content since such a scenario has to refer to input elements by the name field_{fieldid}_{entryid} (or field_{fieldid}_-1 for a new entry) and the ids have to persist between runs.
I add a test dataform
- Adds a test dataform as teacher 1 in course 1 and displays the dataform.
- The step begins in a new test site.
I delete this dataform
- Deletes the dataform.
- This step begins inside the designated dataform.
- Useful at the end of standalone scenarios for cleanup.
I go to manage dataform "TABNAME_STRING"
- Goes to the specified manage tab of the current dataform.
- The step begins from the dataform's course page.
Example:
And I go to manage dataform “filters”
I add a dataform field "FIELDTYPE_STRING" with "SETTINGSLIST_STRING"
- Adds a field of the specified type to the current dataform with the provided table data (usually Name).
- The step begins from the dataform's course page.
Example:
And I add a dataform field "checkbox" with "Field 01 Field description 01 Managers only Yes "
The settings list is a tab separated values string for the following field form items:
Name Description Visible Editable Label param1 param2 param3 param4 param5 param6 param7 param8 param9 param10
You can prepare a list of settings in a spreadsheet (each row a new set). When you select in the spreadsheet the cells of a settings set and paste it into the fixture file it will be pasted as a tab separated values string.
The content of the param items may differ between field types.
You can include in the settings list only some of the form settings but the order should be preserved. For example, if you want to add a field with only name and description (the rest will be the default settings) you can add the following step:
And I add a dataform field "checkbox" with "Field 01 Field description 01”
I add a dataform view "VIEWTYPE_STRING" with "SETTINGSLIST_STRING"
- Adds a view of the specified type to the current dataform with the provided table data (usually Name).
- The step begins in the dataform's Manage | Views tab.
I set view "VIEWNAME_STRING" as default
- Sets a view as the default view of a dataform instance.
- The step begins in the dataform's Manage | Views tab
- with the designated view (by name) already added.
I add a dataform filter with "SETTINGSLIST_STRING"
- Adds a filter with the specified data to the current dataform.
- The step begins in the dataform's Manage | Filters tab.
I add a dataform entry
- Adds an entry without data to the current dataform.
- You should be in the dataform page, and the dataform should have a default view with submission options.
Adding tests
See https://docs.moodle.org/dev/Acceptance_testing#Writing_features for general test writing guidelines.