怎样用Ant测试Spring项目(Ant测试自动化--下

来源:百度文库 编辑:神马文学网 时间:2024/05/01 01:00:45

怎样用Ant测试Spring项目

 


 


   对于Spring项目,还有另外的讲究。

一、可以运行,但是要设置Eclipse,以使Eclipse自动往我的   

中复制Spring配置文件。

  

  

  

        

         

        

    

      

        


 


        

        

        

         

            


 


       


 


        


 


                 

                    

                     


 


        

       

     

 

 

        


 


                  


 


                            classpathref="compile.path"/>


 


                  


 


                            classpathref="compile.path"/>


 


        


 


       

        


 


                  

               

               

 

                  


 


                           

                             

                             

                            

                            

                           


 


                            

                           

                           

                           

                       

   

        

        

        

            

            

        

        


 


                  


 


        

 


 

 

 


二、不需要借助于Eclipse自动构建功能的Ant文件:

 


 


 

 

  

 

  

 

        

 

         

 

        

 

        

 

      

 

      

 

        

 


 


        

 

        

 

        

 

        

 

         

 

        

 

            

 


 


       

 


 


        

 


 


                 

 

                     

 

                      

 


 


        

 

       

 

     

 

 

 

 

 

        

 


 


                  

 


 


                            classpathref="compile.path"/>

 


 


                  

 


 


                            classpathref="compile.path"/>

 


 


        

 


 


  

 

    

 

   

 

   

 

   

 

   

 

       

 

           

 

            

 

            

 

           

 

           

 

       

 

   

 

   

 

   

 

   

 

                

 

     

 

   

 

   

 

      

 

           

 

            

 

      

 

   

 


 


 

 

       

 

 

        

 


 


                  

 

               

 

               

 

 

 

                  

 


 


                           

 

                             

 

                             

 

                             

 

                            

 

                             

 

                            

 


 


                            

 

                           

 

                           

 

                           

 

                       

 

   

 

        

 

        

 

        

 

            

 

            

 

        

 

        

 


 


                  

 


 


        

 

 

 

 

 


 

 

 


这样,我手工把Spring等文件复制到war目录中。然后,再将这个目录也加到Junit任务的classpath路径中。 

也就是说,现在,classpath中由3部分组成:

1,jar文件集

2,.class文件集

3,Spring、Hibernate等配置文件集。

实际上,我们也可以进一步改进。将JUnit任务和发布war包的任务合在一起。


 

 

 


三、下面就是将JUnit融合进原有war包发布的ant文件后的东东:


 


 


 


 

 

 


 


 


 


 

 

 

   

 

   

 


 


   

 

   

 

   

 

   

 

   

 

   

 

   

 

   

 

   

 

   

 


 


   

 

   

 

   

 

   

 


 


 

    

 

    

 

    

 

    

 

   

 

   

 

       

 

           

 

       

 

   

 


 


 

 

   

 

   

 

   

 


 


 

 


 


 

 

 

 

   

 

   

 

   

 

           destdir="${telecom_LDBS.classbindir}"

 

           includes="com/**"

 

           debug="yes">

 

   

 

   

 


 


   

 

   

 

            tofile="${telecom_LDBS.src}/com/telecom/ldbs/common/util/ApplicationResources.properties"/>

 

   

 

            includes="**/*Resources.properties"/>

 


 


   

 

     

 

       

 

       

 

     

 

   

 


 


   

 

     

 

     

 

   

 

 

 


 


 

 


 


  

 

 

 

   

 

   

 

   

 

   

 

       

 

           

 

            

 

            

 

           

 

           

 

       

 

   

 

   

 

       

 

           

 

            

 

           

 

           

 

       

 

   

 

   

 

     

 

            

 

            

 

            

 

     

 

   

 

   

 

     

 

            

 

     

 

   

 

   

 

                

 

     

 

   

 

   

 

      

 

           

 

            

 

      

 

   

 


 


 

 


 

 

 


 

 

 

 

   

 


 


   

 

            

 

                

 

        

 

   

 

 

 


 


   

 

       

 

            

 

                

 

                

 

                

 

                

 

                

 

            

 

       

 

   

 


 


 

 

   

 

       

 

            

 

                

 

                

 

                

 

                

 

                

 

                

 

                

 

            

 

       

 

   

 


 


 

 

 

 

   

 

   

 

   

 

   

 

        

 

   

 

   

 

        

 

   

 

 

 

 

 

 

 

 

 

 

 

        

 


 


                  

 

               

 

               

 

 

 

                  

 


 


                           

 

                             

 

                             

 

                             

 

                            

 

                             

 

                            

 


 


                            

 

                           

 

                           

 

                           

 

                       

 

   

 

        

 

        

 

        

 

            

 

            

 

        

 

        

 


 


                  

 


 


        

 

 

 

 

 

   

 

 


 

 

 


只是添加了几个目录,然后又加上了junit任务即可。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/shendl/archive/2005/11/18/532592.aspx