Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
up vote 2 down vote accepted
  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!

share|improve this answer
But I want to create AdminLogin function into new file and I want to reuse like require_once function. It is possible? – Set Kyar Wa Lar Oct 28 '13 at 9:31
If i understand correctly than yes. You can call method from another class in php. Look at this answer… – alexey.chumagin Oct 28 '13 at 9:37
Using setup is way for calling methods before each tests. – alexey.chumagin Oct 28 '13 at 9:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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