473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Getting Method Arguements from a Comma-Delimited Text File

Hello all-
I'm pretty new here (and to C#) and am hoping you can help.
The title pretty much says it all...

I am doing some API testing would like to be able to pick up the
arguemnts for my method calls from a text file instead of putting them
in the code.

Here is an example of what I'm trying to do:

public void myMethod(int i, int j, string s)
{...}

I would like to send the arguemnts from a text file, where each line is
a call to the method.

EG. The text file looks something like:
12, 15, joe
07, 64, fred
etc.

Any suggestions or sample code hugely appreciated.
Thanks in advance,

Jeff
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
2 1496
You can write a TextReader, read each line from the file and call the method
from your test program. I assume your method is in a test DLL and you'll
have to write a client to test the DLL

- Shuvro

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

"JeffM" <Je***@devdex.com> wrote in message
news:#r**************@tk2msftngp13.phx.gbl...
Hello all-
I'm pretty new here (and to C#) and am hoping you can help.
The title pretty much says it all...

I am doing some API testing would like to be able to pick up the
arguemnts for my method calls from a text file instead of putting them
in the code.

Here is an example of what I'm trying to do:

public void myMethod(int i, int j, string s)
{...}

I would like to send the arguemnts from a text file, where each line is
a call to the method.

EG. The text file looks something like:
12, 15, joe
07, 64, fred
etc.

Any suggestions or sample code hugely appreciated.
Thanks in advance,

Jeff
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
Thanks for the reply,
I should have mentioned that I am also using NUnit to monitor output,
but don't like having to compile all of my inputs into the code and
recompile every time I have a new data set. So a text file for inputs
would be much nicer.

Can you make any suggestions for setting up the text reader. I am new to
C# so any details much appreciated.
Thanks,

Jeff


*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Andreas Neudecker | last post by:
Hello. I am relatively new to Python and I have a strange problem with some code. In a class the __call__ method gets parameters like this: class WhatsUp: __call__ ( self, var1,
18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
8
by: Dawn Minnis | last post by:
Hey guys If I have a program (see codeSnippet1) that I compile to be called test.o Then run it as test.o n n 2 3 4 I want the code to be able to strip out the two characters at the start...
4
by: Mark | last post by:
hey, i'm trying to get the current windows user and the groups they are in. Intergrated windows auth on and annoymous access turned off on IIS. However when trying to compile the following code...
4
by: Panos Laganakos | last post by:
I want a class method to take action depending on the type of the arguement passed to it. ie: getBook(id) # get the book by ID getBook(name) # get the book by name .... Other languages use...
4
by: Yobbo | last post by:
Hi All My query is as follows: SELECT STRINGTEXT, TOKENID FROM WEBSTRINGS WHERE TOKENID IN (6,20,234,19,32,4,800,177) All I want is my resultset to come back in the order that I have...
3
by: Gilles Ganault | last post by:
Hello I'd like to make sure there isn't an easier way to extract all the occurences found with re.finditer: ======================= req = urllib2.Request(url, None, headers) response =...
2
by: Nike | last post by:
I have a small question w.r.t usage of default arguements in template.. I shall try to elaborate this with an example.. let's say I have some template function , where EntryType is the input for...
5
by: mmmtacos | last post by:
Hey, I'm pretty new to Java and am having some trouble writing a put() method for one of my programs. The basic idea of it is to have a matrix, made by a multi-dimensional array, then to create the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.