2016-01-22 107 views
0

我遇到了testNG问题,如何从testNG文件创建.jar(可执行)。即时通讯使用月食月神。如何创建testNG可执行.jar

谢谢

+1

http://stackoverflow.com/questions/16393223/how-to-create-a-executable-jar-file-for-testng-and-the-runnnig-point-should-be-t应该有所帮助。 –

+1

请参阅我的回答: - http://stackoverflow.com/questions/34489971/how-to-execute-testng-project-without-main-method-from-command-line/34506017#34506017 –

回答

0

你的问题很混乱。但我想你想要使用testng来生成jar文件,其中你有一系列具有不同功能的类用于自动化测试。

创建testng类文件,输入ITestListenerISuiteListener,并根据需求实现功能。

生成具有不同的目标,在那里你可以编译代码的Ant文件。 你必须在ant xml文件中设置生成jar的目标。

有了你只是需要导入和其他项目的构建路径设置这个jar文件。 现在您可以访问在jar中创建的所有功能。

下面的代码将有助于创建可执行的JAR到蚂蚁的xml文件。

<!-- compile-build is previous target. current build is depend on it. After compilation this build executed --> 
<!-- directory-attrib is attribule to where you save your jar --> 
<!-- bin.dir is you compiled class file, generally it is bin directory --> 
<!-- version-num is version num specified by you --> 
<property name="bin.dir" value="${basedir}/bin" /> 
<target name="build" depends="compile-build" 
    description="build and pack Jar API classes"> 
    <jar destfile="${directory-attrib}/ur-jar-name.jar" basedir="${bin.dir}"> 
     <manifest> 
      <attribute name="Built-By" value="${user.name}" /> 
      <section name="Build-Info"> 
       <attribute name="Version" value="${version-num}" /> 
      </section> 
     </manifest> 
    </jar> 
</target> 

生成构建xml文件并编译为Ant构建。

相关问题