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

sahiuser1sahiuser1 Members
edited February 2014 in Sahi - Open Source
Hi sir

Can you please tell me the working of Setup and teardown functions
I want to do the following

1.login to sample application
2.add books with some parameters
3.logout
again do the same steps with add books with some diff parameters
can we accomplish it with Setup and teardown.If we can.Please tell me that

Regards
Rahul

Answers

  • function runTest($setUp, $testFunction, $args, $tearDown) {
            $setUp();
            $testFunction($args);
            $tearDown();
    }
    
    function setUp() {
      // do setup
    }
    
    function tearDown() {
      // do teardown
    }
    
    function testLogin($args) {
      //do stuff
    }
    
    function testLoginAndAddBooks($args) {
      // do moar stuffz
    }
    
    //execution :
    runTest(setUp, testLogin, {"arg1":"user1"},  tearDown);
    runTest(setUp, testLoginAndAddBooks, {"arg1":"user2"}, tearDown);
    

    Regards

    Wormi
Sign In or Register to comment.