⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 web-tests.xdt

📁 appfuse一套结合STRUTS+SPRING+HIBERNATE的框架
💻 XDT
字号:
<XDtTagDef:tagDef namespace="Form" handler="org.example.antbook.xdoclet.FormTagsHandler"/>
<!--<XDtForm:className/>-START-->
    <!-- runs <XDtForm:classNameLower/>-related tests -->
    <target name="<XDtForm:className/>Tests"
        depends="Search<XDtForm:className/>s,Edit<XDtForm:className/>,Save<XDtForm:className/>,Add<XDtForm:className/>,Delete<XDtForm:className/>"
        description="Call and executes all <XDtForm:classNameLower/> test cases (targets)">
        <echo>Successfully ran all <XDtForm:className/> JSP tests!</echo>
    </target>

    <!-- Verify the edit <XDtForm:classNameLower/> screen displays without errors -->
    <target name="Edit<XDtForm:className/>"
        description="Tests editing an existing <XDtForm:className/>'s information">
        <webtest name="edit<XDtForm:className/>">
            &config;
            <steps>
                &login;
                <invoke description="View <XDtForm:className/> List" url="/<XDtConfig:configParameterValue paramName="appModuleNameSlash"/><XDtForm:classNameLower/>s.html"/>
                <clicklink description="edit first record in list" label="1"/>
                <verifytitle description="we should see the <XDtForm:classNameLower/>Detail title"
                    text=".*${<XDtForm:classNameLower/>Detail.title}.*" regex="true"/>
            </steps>
        </webtest>
    </target>

    <!-- Edit a <XDtForm:classNameLower/> and then save -->
    <target name="Save<XDtForm:className/>"
        description="Tests editing and saving a <XDtForm:classNameLower/>">
        <webtest name="save<XDtForm:className/>">
            &config;
            <steps>
                &login;
                <invoke description="View <XDtForm:className/> List" url="/<XDtConfig:configParameterValue paramName="appModuleNameSlash"/><XDtForm:classNameLower/>s.html"/>
                <clicklink description="edit first record in list" label="1"/>
                <verifytitle description="we should see the <XDtForm:classNameLower/>Detail title"
                    text=".*${<XDtForm:classNameLower/>Detail.title}.*" regex="true"/>

                <!-- update some of the required fields -->
                <XDtMethod:forAllMethods>
                <XDtMethod:ifMethodTagValueEquals tagName="hibernate.property" paramName="not-null" value="true">
                <XDtType:ifIsOfType value="return-type" type="java.lang.String" extent="concrete-type">
                <setinputfield description="set <XDtMethod:propertyName/>" name="<XDtForm:classNameLower/>Form:<XDtMethod:propertyName/>" value="<XDtMethod:propertyName/>"/>
                </XDtType:ifIsOfType>
                </XDtMethod:ifMethodTagValueEquals>
                </XDtMethod:forAllMethods>
                <clickbutton label="${button.save}" description="Click Save"/>

                <verifytitle description="Page re-appears if save successful"
                    text=".*${<XDtForm:classNameLower/>Detail.title}.*" regex="true"/>
            </steps>
        </webtest>
    </target>

    <!-- Add a new <XDtForm:className/> -->
    <target name="Add<XDtForm:className/>"
        description="Adds a new <XDtForm:className/>">
        <webtest name="add<XDtForm:className/>">
            &config;
            <steps>
                &login;
                <invoke description="View <XDtForm:className/> List" url="/<XDtConfig:configParameterValue paramName="appModuleNameSlash"/><XDtForm:classNameLower/>s.html"/>
                <clickbutton description="Click 'Add' button'" label="${button.add}"/>
                <verifytitle description="we should see the <XDtForm:classNameLower/>Detail title"
                    text=".*${<XDtForm:classNameLower/>Detail.title}.*" regex="true"/>

                <!-- enter required fields -->
                <XDtMethod:forAllMethods>
                <XDtMethod:ifMethodTagValueEquals tagName="hibernate.property" paramName="not-null" value="true">
                <setinputfield description="set <XDtMethod:propertyName/>" name="<XDtForm:classNameLower/>Form:<XDtMethod:propertyName/>" value="<XDtMethodEx:randomValueForWebTest/>"/>
                </XDtMethod:ifMethodTagValueEquals>
                </XDtMethod:forAllMethods>
                <clickbutton label="${button.save}" description="Click button 'Save'"/>

                <verifytitle description="<XDtForm:className/> List appears if save successful"
                    text=".*${<XDtForm:classNameLower/>List.title}.*" regex="true"/>
                <verifytext description="verify success message" text="${<XDtForm:classNameLower/>.added}"/>
            </steps>
        </webtest>
    </target>

    <!-- Delete existing <XDtForm:classNameLower/> -->
    <target name="Delete<XDtForm:className/>"
        description="Deletes existing <XDtForm:className/>">
        <webtest name="delete<XDtForm:className/>">
            &config;
            <steps>
                &login;
                <invoke description="View <XDtForm:className/> List" url="/<XDtConfig:configParameterValue paramName="appModuleNameSlash"/><XDtForm:classNameLower/>s.html"/>
                <clicklink description="delete first record in list" label="1"/>
                <prepareDialogResponse description="Confirm delete" dialogType="confirm" response="true"/>
                <clickbutton label="${button.delete}" description="Click button 'Delete'"/>
                <verifyNoDialogResponses/>
                <verifytitle description="display <XDtForm:className/> List" text=".*${<XDtForm:classNameLower/>List.title}.*" regex="true"/>
                <verifytext description="verify success message" text="${<XDtForm:classNameLower/>.deleted}"/>
            </steps>
        </webtest>
    </target>

    <!-- Verify the people list screen displays without errors -->
    <target name="Search<XDtForm:className/>s"
        description="Tests search for and displaying all <XDtForm:classNameLower/>s">
        <webtest name="search<XDtForm:className/>s">
            &config;
            <steps>
                &login;
                <invoke description="click View <XDtForm:className/>s link" url="/<XDtConfig:configParameterValue paramName="appModuleNameSlash"/><XDtForm:classNameLower/>s.html"/>
                <verifytitle description="we should see the <XDtForm:classNameLower/>List title"
                    text=".*${<XDtForm:classNameLower/>List.title}.*" regex="true"/>
            </steps>
        </webtest>
    </target>
<!--<XDtForm:className/>-END-->
</project>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -