Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Problems with TestNG Classpath

Uwe Hartl

2008-08-04

Replies: Find Java Web Hosting

Author LoginPost Reply

Hello,

I want to use TestNG but get always errors that my DB_Test class is not
found on the classpath.

when I start it with
"uwh1@(protected)"

I get the following error messages.

[Parser] Running:
Command line suite


===============================================
DB
Total tests run: 0, Failures: 0, Skips: 0
===============================================

Caught: org.testng.TestNGException:
Cannot find class in classpath: DB_Test
    at DB_TestNG.main(TestNGControlFile.groovy:53)


Can someone give me a hint what I am doing wrong?

Thanks in advance!

Uwe




the files:


############# File 'TestNGControlFile.groovy' ###################
import org.testng.annotations.*
import org.testng.TestNG
import org.testng.TestListenerAdapter
import org.testng.xml.*
import static org.testng.AssertJUnit.*;

public class DB_TestNG {

 /**
 * Main entry point to run <code>DB_TestNG</code> as
 * simple Groovy class
 */
 public static void main(String[] args){

   // create a suite for all DB related stuff
   XmlSuite dbSuite = new XmlSuite();
   dbSuite.setName("DB");
   // create the test
   XmlTest tests = new XmlTest(dbSuite);
   tests.setName("DB");
   // set the classes to be tested
   def classes = []
   // #### Insert Classes below here !!!!!!!!!!!!
   classes << new XmlClass("DB_Test")
   // put the classes into the test
   tests.setXmlClasses(classes)

   /**
    * here all the suites can be switched on or off for testing
    */
   def suites = []
   suites << dbSuite
   // suites << othersuite
   // ######### insert Suites here ###########
   
   /**
    * run the stuff
    */
   // create the TEstNG
   TestNG tng = new TestNG();
   // add the Suites and go
   tng.setXmlSuites(suites);
   tng.run();
 }
}
############# end of file 'TestNGControlFile.groovy' ###################

############# File 'DB_Test.groovy' ###################

import org.testng.annotations.*
import org.testng.TestNG
import org.testng.TestListenerAdapter
import static org.testng.AssertJUnit.*;

/**
*
*/
public class DB_Test {
 @BeforeSuite
 public void BeforeSuite(){
   println "beforesuite"
 }
 
 @AfterSuite
 public void AfterSuite(){
   println "AfterSuite"
 }

 @Test(groups = [setup_db])
 final void newDB(){
   println "newDB()"

 }

  @Test(dependsOnGroups = [setup_db])
  final void open() {
   
 }
}
############# end of file 'DB_Test.groovy' ###################


--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.