首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何生成PDE测试类的列表?

如何生成PDE测试类的列表?
EN

Stack Overflow用户
提问于 2012-08-30 07:15:17
回答 1查看 114关注 0票数 0

我正在实验这个文章的示例代码

我有一个代码的工作示例,但是本文的作者提到了PDE测试类列表:

PDE测试运行程序将在PDE测试运行中运行的测试类的逗号分隔列表作为参数。在示例代码中,要运行的单个测试类的名称是硬编码的,即phonebookexample.dialogs.PhoneBookEntryEditorDialogTest,但是可以很容易地自动生成PDE测试类的列表。

他的示例中的代码在-classnames属性中使用了一个测试类:

代码语言:javascript
复制
<target name="run_pde_tests">
   <property name="test.classes.list" value="phonebookexample.dialogs.PhoneBookEntryEditorDialogTest"/>
   <mkdir dir="${test.reports.dir}/output/ws"/>
   <java dir="${plugin.dir}" classname="org.eclipse.equinox.launcher.Main" fork="yes" classpathref="equinox.launcher.class.path">
       <arg line="-application org.eclipse.pde.junit.runtime.uitestapplication -data ${test.reports.dir}/output/ws -dev bin -clean -port ${pde.test.port} -testpluginname PhoneBookExample -classnames ${test.classes.list}"/>
   </java>
</target>

有没有人知道我如何用ant生成一个测试类列表,并将这个列表交给org.eclipse.pde.junit.runtime.uitestapplication的-classnames属性?

EN

回答 1

Stack Overflow用户

发布于 2012-09-18 17:00:55

我解决了我的问题。这是我的解决方案。我将test.dir.totest指向包含插件的目录。文件集是用java文件创建的。此集合被转换为一个空格分隔的列表,一个分配给ant属性的列表。在java任务中使用此属性来运行测试。

代码语言:javascript
复制
<!-- point to a directory with java files to PDE unit test -->
    <property name="test.dir.totest" location="/pathtomytestclasses/testplugin"/>
 <!-- Include all java files in the given directory and sub directories -->
 <path id="semantics.classpath">     
      <fileset dir="${test.dir.totest}" id="test.files">
           <include name="**/*.java"/>
      </fileset>
 </path>


 <!-- this will convert the java files to a space separated list -->
 <!-- ant place it in a javafiles ant property -->
 <!-- This property is passed in the arg line of the ant java task -->
 <!-- to run the PDE tests -->
 <pathconvert pathsep=" " property="javafiles">
      <path refid="semantics.classpath"/>
      <!-- this regex will create 3 groups -->
      <!-- group 1 is the path -->
      <!-- group 2 is the filename withouth the .java extension -->
      <!-- group 3 is the file extension -->
      <mapper type="regexp" from="^(.+)/([^/]+)$?.java" to="my.package.name.\2"/>
 </pathconvert>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12191732

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档