【IT168 技术文章】
再来说说qaweb生成stax任务文件,远程启动测试,以及结果收集;
首先,当用户前端页面提交一个新的测试任务后,qaweb会根据所提交的测试任务的相关信息生成一个stax任务文件(xml),在qaweb上会有一个taskXmls目录存放这些任务文件,会自动为每一个测试机建立一个子目录,由于每一任务文件都是由测试机和认识任务唯一确定的,所以,每个子目录下只存放对应测试机的所以任务文件。
其次,当已存在相应的任务文件时,在前端页面出发测试任务执行后,qaweb会通过调用staf命令,使用正确的stax任务文件在远程客户端上完成测试任务,并收集测试结果会qaweb。(staf会根据stax xml文件中的配置确定是在哪一台远程测试机执行任务)
再次,在qaweb下会有一个results目录,结构与前面提到的taskXmls目录一致,qaweb会将将客户端的测试结果放入相应的子目录。同时,当qaweb完成测试任务后,会向用户邮箱发送一封包含测试结果连接的邮件,用户通过点击链接可以直接查看测试结果。
附:stax测试任务文件样本
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">51Testing
<stax>51Testing
<scrīpt>
STAXServicesDir = '{STAF/Config/STAFRoot}{STAF/Config/Sep/File}services{STAF/Config/Sep/File}stax'
STAXJarFile = '%s{STAF/Config/Sep/File}STAXMon.jar' % STAXServicesDir
</scrīpt>
<defaultcall function='test1'>51Testing
{ 'MachList': ['qatestxpie6', 'local'], 'duration': '2m', 'STAXJarFile': STAXJarFile }51Testing
</defaultcall>
<function name='test1'><sequence>
<!--远程启动测试 -->
<stafcmd>
<location>'qatestxpie6'</location>51Testing
<service>'process'</service>51Testing
<request>'start command "ruby" parms "E:/SearchAutoTest/TestSuites/TestXXXSuite.rb" "http://www.test.cn/" "E:/SearchAutoTest/" wait'</request>
<!--拷贝测试结果到qaweb本地 -->
<stafcmd>
<location>'qatestxpie6'</location>51Testing
<service>'fs'</service>51Testing
<request>'copy directory E:/SearchAutoTest//TestResults/Blog todirectory E:/results/1 tomachine localhost'</request>51Testing
</stafcmd>
<!--在测试客户端删除测试结果 -->
<stafcmd>
<location>'qatestxpie6'</location>
<service>'fs'</service>
<request>'delete entry E:/SearchAutoTest//TestResults/XXX children confirm'</request>51Testing
</stafcmd>51Testing
<stafcmd>
<location>'qatestxpie6'</location>
<service>'fs'</service>
<request>'copy directory E:/SearchAutoTest//Log/XXX todirectory E:/results/1 tomachine localhost'</request></stafcmd></sequence></function>51Testing
</stax>