Wednesday, October 3, 2012

Sample Ant Script for running targets parallel and sequential

Recently ,I faced a challenge for making one target which can run the entire suite with lot of module dependencies.This was resolved with the help of ant targets: sequential and parallel.


Requirement :
I need to run the following sequetially

1.compile target
2. run and run_psdata targets paralelly
3.run_PreData,run_DFPPulls,run_AdTechPulls.... parallelly
4.run_PostData,run_Sales parallely
5.run_Administration,run_E2EPartner360,..... parallelly
6.run_Alerts,run_CustomFields  parallelly
7.Stop selenium

Below is the code to do all the above steps sequentially


<target name="CItarget">    
        <sequential>
            <antcall target="compile"/>
            <parallel>
              <antcall target="run"/>
              <antcall target="run_PSDATA"/>
            </parallel>
             <parallel>
                <antcall target="run_PreData"/>
                <antcall target="run_DFPPulls"/>
                <antcall target="run_AdTechPulls"/>
                <antcall target="run_AppnexusPulls"/>
                <antcall target="run_FTPPulls"/>
                <antcall target="run_OASPulls"/>
                <antcall target="run_GDFPPulls"/>
                <antcall target="run_FreewheelPulls"/>
                <antcall target="run_ThirdPartyPulls"/>
            </parallel>
    <parallel>
        <antcall target="run_PostData"/>
        <antcall target="run_Sales"/>
    </parallel>
            <parallel>
                <antcall target="run_Administration"/>
                <antcall target="run_E2EPartner360"/>
                <antcall target="run_Finance"/>
                <antcall target="run_Loaders"/>
                <antcall target="run_Accounts"/>
                <antcall target="run_Adops"/>
            </parallel>
            <parallel>
                 <antcall target="run_Alerts"/>
                <antcall target="run_CustomFields"/>
            </parallel>
            <antcall target="stop-selenium"/>
       </sequential>
    </target>

2 comments: