3.3.2. Tests

class pyslet.qtiv2.tests.AssessmentTest(parent)

Bases: pyslet.qtiv2.core.QTIElement, pyslet.qtiv2.core.DeclarationContainer

A test is a group of assessmentItems with an associated set of rules that determine which of the items the candidate sees, in what order, and in what way the candidate interacts with them. The rules describe the valid paths through the test, when responses are submitted for response processing and when (if at all) feedback is to be given:

<xsd:attributeGroup name="assessmentTest.AttrGroup">
        <xsd:attribute name="identifier" type="string.Type" use="required"/>
        <xsd:attribute name="title" type="string.Type" use="required"/>
        <xsd:attribute name="toolName" type="string256.Type" use="optional"/>
        <xsd:attribute name="toolVersion" type="string256.Type" use="optional"/>
</xsd:attributeGroup>

<xsd:group name="assessmentTest.ContentGroup">
        <xsd:sequence>
                <xsd:element ref="outcomeDeclaration" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="timeLimits" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="testPart" minOccurs="1" maxOccurs="unbounded"/>
                <xsd:element ref="outcomeProcessing" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="testFeedback" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
</xsd:group>
SortDeclarations()

Sort the outcome declarations so that they are in identifier order. This is not essential but it does help ensure that output is predictable. This method is called automatically when reading items from XML files.

RegisterPart(part)

Registers a testPart, asssessmentSection or assessmentItemRef in parts.

GetPart(identifier)

Returns the testPart, assessmentSection or assessmentItemRef with the given identifier.

3.3.2.2. Test Structure

class pyslet.qtiv2.tests.Selection(parent)

Bases: pyslet.qtiv2.core.QTIElement

The selection class specifies the rules used to select the child elements of a section for each test session:

<xsd:attributeGroup name="selection.AttrGroup">
        <xsd:attribute name="select" type="integer.Type" use="required"/>
        <xsd:attribute name="withReplacement" type="boolean.Type" use="optional"/>
        <xsd:anyAttribute namespace="##other"/>
</xsd:attributeGroup>

<xsd:group name="selection.ContentGroup">
        <xsd:sequence>
        <xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        </xsd:sequence>
</xsd:group>
class pyslet.qtiv2.tests.Ordering(parent)

Bases: pyslet.qtiv2.core.QTIElement

The ordering class specifies the rule used to arrange the child elements of a section following selection. If no ordering rule is given we assume that the elements are to be ordered in the order in which they are defined:

<xsd:attributeGroup name="ordering.AttrGroup">
        <xsd:attribute name="shuffle" type="boolean.Type" use="required"/>
        <xsd:anyAttribute namespace="##other"/>
</xsd:attributeGroup>

<xsd:group name="ordering.ContentGroup">
        <xsd:sequence>
        <xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        </xsd:sequence>
</xsd:group>
class pyslet.qtiv2.tests.SectionPart(parent)

Bases: pyslet.qtiv2.core.QTIElement

Sections group together individual item references and/or sub-sections. A number of common parameters are shared by both types of child element:

<xsd:attributeGroup name="sectionPart.AttrGroup">
        <xsd:attribute name="identifier" type="identifier.Type" use="required"/>
        <xsd:attribute name="required" type="boolean.Type" use="optional"/>
        <xsd:attribute name="fixed" type="boolean.Type" use="optional"/>
</xsd:attributeGroup>

<xsd:group name="sectionPart.ContentGroup">
        <xsd:sequence>
                <xsd:element ref="preCondition" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="branchRule" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="itemSessionControl" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="timeLimits" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
</xsd:group>
CheckPreConditions(state)

Returns True if this item or section’s pre-conditions are satisfied or if there are no pre-conditions in effect.

GetBranchTarget(state)

Returns the identifier of the next item or section to branch to, or one of the pre-defined EXIT_* identifiers. If there is no branch rule in effect then None is returned. state is a variables.TestSessionState instance used to evaluate the branch rule expressions.

class pyslet.qtiv2.tests.AssessmentSection(parent)

Bases: pyslet.qtiv2.tests.SectionPart

Represents assessmentSection element

<xsd:attributeGroup name="assessmentSection.AttrGroup">
        <xsd:attributeGroup ref="sectionPart.AttrGroup"/>
        <xsd:attribute name="title" type="string.Type" use="required"/>
        <xsd:attribute name="visible" type="boolean.Type" use="required"/>
        <xsd:attribute name="keepTogether" type="boolean.Type" use="optional"/>
</xsd:attributeGroup>

<xsd:group name="assessmentSection.ContentGroup">
        <xsd:sequence>
                <xsd:group ref="sectionPart.ContentGroup"/>
                <xsd:element ref="selection" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ordering" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="rubricBlock" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:group ref="sectionPart.ElementGroup" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
</xsd:group>
class pyslet.qtiv2.tests.AssessmentItemRef(parent)

Bases: pyslet.qtiv2.tests.SectionPart

Items are incorporated into the test by reference and not by direct aggregation:

<xsd:attributeGroup name="assessmentItemRef.AttrGroup">
        <xsd:attributeGroup ref="sectionPart.AttrGroup"/>
        <xsd:attribute name="href" type="uri.Type" use="required"/>
        <xsd:attribute name="category" use="optional">
                <xsd:simpleType>
                        <xsd:list itemType="identifier.Type"/>
                </xsd:simpleType>
        </xsd:attribute>
</xsd:attributeGroup>

<xsd:group name="assessmentItemRef.ContentGroup">
        <xsd:sequence>
                <xsd:group ref="sectionPart.ContentGroup"/>
                <xsd:element ref="variableMapping" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="weight" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="templateDefault" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
</xsd:group>
GetItem()

Returns the AssessmentItem referred to by this reference.