简体   繁体   中英

How to create Testcases and Testsuite in Webdriver in Eclipse?

I want to organize my testcases in Webdriver. Lets say I have 20 testcases in separate files, namely

Tc1.java, Tc2.java, Tc3.java, Tc4.java, Tc5.java, Tc6.java, Tc7.java ...Tc19.java, Tc20.java 

and 1 testsuite file lets say Ts.java.

each testcase has atleast 1 method(function).

My question is how can I call all the testcases(Tc1 to Tc20) in Ts.java ?

Also how do I pass the parameters from Ts.java to corresponding testcases. Please help. Thank you

Simply choose JUnit or TestNG framework and use a whole list of tools that these frameworks provide for you. Google will help you to find a lot of articles and tutorials for both of them. Good luck.

You can try this. Make sure TC1.java extends TestCase

import junit.framework.Test;
import junit.framework.TestSuite;

public class TestingSuite {

  public static Test suite() {
     TestSuite suite = new TestSuite();
     suite.addTestSuite(TC1.class);
     suite.addTestSuite(TC2.class);
     suite.addTestSuite(TC3.class);

  return suite;
}

public static void main(String[] args) {
   junit.textui.TestRunner.run(suite());
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM