因为工作上的原因和春节假期,Triones框架的开发在暂停一个月后继续。
今天重新审查了整个框架的设计,发现问题依然很多,目前的Triones框架已经初步解决了Eclipse插件架构的应用问题,但是在可测试性、MVC框架支持、组件容器支持等方面还存在许多问题。当前看来必须首先解决可测试性的问题,否则框架的开发会存在很多障碍。
今天的任务: 搭建Eclipse的自动测试环境。
第一步:安装
先下载了Eclipse的自动测试程序包,解开压缩包,根据文档说明,运行测试环境需要以下工具:
1、Ant
2、Info-Zip UnZip 解压缩程序,http://www.info-zip.org/pub/infozip/UnZip.html
必须安装好并加入到系统路径。
此外,还必须有一个Eclipse SDK版本(Eclipse-SDK-*.zip)以压缩包的形式放置到测试目录下。
第二步:运行
进入测试目录,运行 runtests,然后就等待运行吧。
明天再详细分析Eclipse的测试框架以及考虑如何应用到Triones框架中。
Eclipse runtests参考:
runtests [-os <operating system>] [-ws <windowing system>] [-arch <architecture>] [-noclean] [<testTarget>][-properties <path>][-vm <path to java executable>]
下面是参数说明:
Parameter
Description
-os <operating system>
The OS the tests are being run on. One of: aix, hpux, linux, qnx, solaris, win32. Default win32
-ws <windowing system>
The windowing system the tests are being run on. One of: motif, gtk, photon, win32. Default win32
-arch <architecture>
The architecture the tests are being run on. One of: ppc, PA_RISC, x86, sparc. Default x86
-noclean
Run tests without installing a clean Eclipse between test targets. Default is to install a clean Eclipse between test targets.
-properties
Used to reference a properties file containing additional Ant properties used in running tests.Can be used to pass additional vm arguments to the Java virtual machine running the tests by adding the entry "extraVMargs=<the args to pass to the vm>" to the specified properties file.
-vm
The full path to the java executable with which to run the tests. Use this to specify a specific virtual machine with which to run the tests. For example, "-vm c:\jdk142\jre\bin\java". Default set to "java" (i.e. java executable on system path).
当然也可以设定测试目标,默认是all - 全部运行 。
all
Runs all the targets below.
ant
Runs the JUnit plugin tests for the Platform-Ant component.
core
Runs the JUnit plugin tests for the Platform-Core component.
help
Runs the JUnit plugin tests for the Platform-Help component.
jdtcorebuilder
Runs the JUnit plugin tests for the JDT-Core component. This target is executed on Windows operating systems only.
jdtcorecompiler
Runs the JUnit plugin tests for the JDT-Core component. This target is executed on Windows operating systems only.
jdtcoremodel
Runs the JUnit plugin tests for the JDT-Core component. This target is executed on Windows operating systems only.
jdtdebug
Runs the JUnit plugin tests for the JDT-Debug component.
jdtui
Runs the JUnit plugin tests for the JDT-UI component.
jdtuirefactoring
Rruns additional JUnit plugin tests for the JDT-UI component.
swt
Runs the JUnit plugin tests for the Platform-SWT component. This target is executed on Windows operating systems only.
teamcore
Runs the JUnit plugin tests for the Platform-VCM component.
teamcvs
Runs additional JUnit plugin tests for the Platform-VCM component.
ui
Runs the JUnit plugin tests for the Platform-UI component.
update
Runs the JUnit plugin tests for the Platform-Update component.
genHtml
Converts xml test results in the "eclipse-testing\results" directory to html.
等待测试运行完就可以到eclipse-testing/results 目录查看测试结果了:
org.eclipse.core.tests_.html
Unit Test Results
Designed for use with JUnit and Ant.
Summary
Tests
Failures
Errors
Success rate
Time
969
0
0
100.00%
803.085
Note: failures are anticipated and checked for with assertions while errors are unanticipated.
Packages
Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.
Name
Tests
Errors
Failures
Time(s)
org.eclipse.core.tests.resources
715
0
0
627.943
org.eclipse.core.tests.runtime
254
0
0
175.142
Package org.eclipse.core.tests.resources