DZone Forums
Go Back   DZone Forums > Community > Enterprise Development > Testing & QA
Reload this Page Getting command line arguements in JUnit/ Eclipse
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
nmh nmh is offline
Member
 
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Join Date: Feb 2009
Default Getting command line arguements in JUnit/ Eclipse - 04-16-2009, 01:39 AM

Can some one please tell how to get a variable from command line arguements in Junit when using eclipse.

In a normal program the main method you have String args[]

Under run configuration you can give the arguements[] ${String_prompt} or ${file_prompt}

Even though in test cases can give the ${String_prompt} or ${file_prompt} at the runtime there is no args[] variables to access that value programattically.

bascially i want to have something like this

In the test file have to initialize a object SourceFile. Source files constructor is like this.
SourceFile(String s).

This String should be taken from command line. But there is no way to get that String from command line.

I mean can't create a Source file like this.

SourceFile sf = new SourceFile(args[0])

How to solve this problem. I thanks in advance
Reply With Quote
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 25
Thanks: 0
Thanked 2 Times in 2 Posts
Join Date: Feb 2008
Default 11-16-2009, 01:29 PM

see JUnit FAQ
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse JUnit 4 Plug-in Test misterb Eclipse 1 09-25-2009 10:36 AM
Getting command arguements in JUnit nmh Eclipse 5 04-19-2009 02:36 AM
Eclipse Ganymede : undefined command: plug-in='org.eclipse.tm.terminal' longbeach Eclipse 1 03-18-2009 12:24 AM
How to give command line arguments in eclipse nmh Eclipse 2 02-19-2009 08:06 AM
Junit test cases for a plugin failing when run from command line. sahuabinash Eclipse 0 09-17-2008 06:11 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com