I am testing with PHPUnit and Selenium2. I am testing the admin panel. So, I need to add Admin Login Test into all my admin panel tests.

I want to create a new Admin Login Test with a new file and I want to call this function from all my tests. How I can create and call my Admin Login Test ?

1 Answer 1

  1. Create function AdminLogin
    1. Create into each test class method SetUp (doc)
    2. Call admin_login by SetUp

Looks like:

protected function setUp()

This method calls before each test into test class

Good luck!

  • But I want to create AdminLogin function into new file and I want to reuse like require_once function. It is possible? Oct 28, 2013 at 9:31
  • If i understand correctly than yes. You can call method from another class in php. Look at this answer stackoverflow.com/questions/13503734/… Oct 28, 2013 at 9:37
  • Using setup is way for calling methods before each tests. Oct 28, 2013 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.