Run test cases multiple times

518 views
Skip to first unread message

las

unread,
Dec 16, 2009, 1:15:34 PM12/16/09
to testng-users
Hi,
I am a newbie with testng, please advise. I have a test data (few
thousand) in a file and one to run a few test cases on each line of
data. I used netbeans and its testng plugin create a test class
below.
I run the test at the command line:

java mypack.TestMulti

Is this proper way to test ?

Thanks.
las

--------------codes sample----------------------
package mypack;
class TestMulti {
static File file;
static Scanner scanner;
static StringBuffer stringBuff = new StringBuffer();
public static void main (String[] args) {

file = new File ("c:\MybigFile.dat");
scanner = new Scanner(file);
scanner.useDelimiter("\r\n");

while (scanner.hasNext()) {
stringBuff.setLength(0);
stringBuff.append (scanner.next());

TestNG testng = new TestNG();
testng.setTestClasses(new Class[]
{mypack.TestMulti.class} );
testng.run();
}
}

@Test
public void method1 () {
Assert.assertEquals (myExpectValue,stringBuff.toString());
}

@Test
public void method2 () {
Assert.assertEquals (myExpectValue2,stringBuff.toString());
}

}

Karthik Krishnan

unread,
Dec 16, 2009, 3:46:05 PM12/16/09
to testng...@googlegroups.com
Test annotation has an attribute invocationCount to set up the execution number.




--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.



las

unread,
Dec 21, 2009, 3:44:04 PM12/21/09
to testng-users
Thanks for your suggestion!
lt
Reply all
Reply to author
Forward
0 new messages