首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

Eclipse + Spring 上 Ant自动化测试

2012-11-03 
Eclipse + Spring 下 Ant自动化测试项目使用MyEclipse8.6开发,并且使用的Spring,下面是我的自动化测试脚本

Eclipse + Spring 下 Ant自动化测试

项目使用MyEclipse8.6开发,并且使用的Spring,下面是我的自动化测试脚本,呵呵

?

/*** 整个测试下BeanFactory只运行一次* @author Administrator**/public class BeanFactory {private static ApplicationContext context ;static{context = new ClassPathXmlApplicationContext("applicationContext.xml");}private BeanFactory(){}public static Object getBean(String beanName){return context.getBean(beanName);}}?/**
 * 一个简单的测试 */public class SeoKeyServiceTest {static SeoKeyService seoKeyService;@BeforeClasspublic static void init(){seoKeyService = (SeoKeyService)BeanFactory.getBean("seoKeyService");}@Testpublic void testBasic(){SeoKeyWord skw = new SeoKeyWordTestFactory().getBrandKeyWord();skw = seoKeyService.saveSeoKeyWord(skw);assertNotNull(skw);seoKeyService.deleteSeoKeyWord(skw.getId());skw = seoKeyService.getSeoKeyWordById(skw.getId());assertTrue(skw == null);}}

下面是我的自动化测试脚本,没有complie过程,使用Eclipse的 Build Automatically

?

<project default="junit"  name="My First Ant project " ><description>***单元测试</description><property name="junit.data" value="report"></property><path id="classpath.main"><fileset dir="../s**mmon/lib" includes="**/*.jar" excludes="b*eb/ant.jar"></fileset><fileset dir="D:/javalab/junit" includes="**/*.jar"></fileset></path><target name="init" ><delete dir="${junit.data}"></delete></target><target name="junit" depends="init"><mkdir dir="${junit.data}"/><junit printsummary="yes" fork="true" haltonfailure="false"><classpath><path refid="classpath.main"></path><pathelement location="../s**common/bin"/><pathelement location="WebRoot/WEB-INF/classes"/></classpath><formatter type="xml"/> <batchtest haltonfailure="false"todir="${junit.data}"> <fileset dir="test" includes="**/*Test.java" > </fileset></batchtest></junit></target></project>
?

?

热点排行