18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

setUp() and tearDown() for entire suite using Ant?

JulianBJulianB Members
edited November -1 in Sahi - Open Source
Hello,

I'm looking for a was to include a was to add set up and tear down for the entire testsuite. As far as I understand sahi only supports the setUp() and tearDown() Methods before and after a single test.

Is it possible to modify the ant file in a way that will force it to execute something before running the testsuite and execute something else after running it?

A little less asbtract: I want to restore the database every time the testsuite has run and I'm looking to do it via Ant.

Regards,
Julian

Comments

  • narayannarayan Administrators
    Hi Julian,

    You can perform any action before and after calling the <sahi ... /> task.
        <target name="runfftests">
    
            <antcall target="yourSetupTarget"/>
    
            <sahi suite="../userdata/scripts/demo/demo.suite"
                    browserType="firefox"
                  baseurl="http://${urlbase}/demo/"
                  sahihost="localhost"
                  sahiport="9999"
                  failureproperty="sahi.failed"
                  haltonfailure="false"
                  threads="6">
                <report type="html"/>
            </sahi>
            <antcall target="failsahi"/>
    
            <antcall target="yourTeardownTarget"/>
    
        </target>
    
  • JulianBJulianB Members
    edited September 2011
    Great thank you! Will give this a try.

    Edit: Works like a charm, thanks!
Sign In or Register to comment.