Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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
add comment

1 Answer

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()
{
    AdminLogin();
}

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? –  uvuv 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 stackoverflow.com/questions/13503734/… –  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
add comment

Your Answer

 
discard

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.