Sunday, September 25, 2011

Adding Main() to JUnit to run from command prompt

//package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import junit.framework.*;

public class GE_TC1 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("", "*firefox");
public void testGE_TC1() throws Exception {"");
// Search for any word
selenium.type("textToSearch", "energy efficient");
// This is just a comment"searchSubmit");
assertEquals("GE: Search Results", selenium.getTitle());
assertTrue(selenium.isTextPresent("energy efficient"));
public static Test suite() {
//method added
return new TestSuite(GE_TC1.class);
public void tearDown(){
//Added . Will be called when the test will complete
public static void main(String args[]) {
// Added. Execution will started from here.;