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 want to open a popup before running my tests and after completing my test run. I want to give few inputs from the popup on basis of that my test will run.

Suppose I have multiple links on which my project is present to test. I want to select the link from popup and then my test cases should run on that selected link.

I have made an html file which have all fields necessary for me. I am trying to open that file in a popup before selenium start running my tests.

Can anyone suggest how to achieve this? I am using Selenium webdriver with Testng.

share|improve this question
    
What programming language? What xUnit framework? –  Twaldigas Jul 1 at 13:03
    
I am using java and Testng framework. –  razizcool4all Jul 1 at 13:15
    
Sorry, but I do not know a framework named "Testing" and when I google for it, I can not find it. Do you have a link for me? –  Twaldigas Jul 1 at 14:06
    
He says he is using TestNG not testing, you can find the website here: testng.org –  Niels van Reijmersdal Jul 1 at 15:57
    
hey @Niels any kind of suggestion is highly appreciated. –  razizcool4all Jul 2 at 6:28

1 Answer 1

TestNG provide a lot of annotations for thinks like that: @BeforeTest, @BeforeSuite, BeforeGroups and more: http://testng.org/doc/documentation-main.html#annotations

It may be look like that:

@BeforeTest
public void setup() {
    // open your popup and click on the link
}

@Test
public void test() {
    // test case
}

@AfterTest
public void tearDown() {
    // close popup
}

TestNG also provide Listeners: http://testng.org/doc/documentation-main.html#testng-listeners. With Listeners you can say what before or after a test happens. Also what happens when a test finish, failed, skipped or succeed. Maybe this provide a better way for you.

share|improve this answer
    
I am facing problem in opening popup. That popup may contain a dropdown. so need to get that selected value from dropdown and then proceed. –  razizcool4all Jul 2 at 7:21
    
Selenium 2 / WebDriver has a Select class for dropdowns: selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/… –  Twaldigas Jul 2 at 7:30

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.