Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java i/o

  Asked By: Daryl    Date: Dec 01    Category: Java    Views: 611

I have a problem about testing classes.
Well, I have a part-time job as an assistant in my university.
A part of my job is to test the other student's program. Simple
program for OOP or data structure, like linked list or inheritance.
The programs are using CLI, not GUI, and my job is test the program.
I compile the program, if it compiled succesfully, I execute the
compiled program, give it some input, then compare between the actual
output and the desired output.
Well, sounds simple, but if you have to check about 180 programs a
week, and you have about 50 sets of input/desired output, that will
be very very annoying. I mean, I have to compile 180 programs, type
at least (50*180) input -and I suppose that will be impossible,
since all programs need more than one input, and compare between the
actual output and desired one.

So, I want to make a program to do this. My program will compile
the .java file (that's not a problem, I can use the exec() -I guess-
), if new file (.class) created, I run the class file. Now my program
will get input from some place (text file or database), give it to
(currently) running student-program. The student-program will
generate the output, and my program will get the output from student-
program, compare it with the desired output, and write the result to
another text file. Or, if the student-program trap in an error (like
maybe trapped in a loop), my program will close the student-program
automatically, and continue with other set of input.

I've read the Java Tutorial from http://java.sun.com, and I found
that there are streams which I think can be useful. Those are memory
streams, like CharArrayReader, CharArrayWriter ByteArrayInputStream,
and ByteArrayInputStream. I think maybe one of these streams can be
useful, but I don't know how. I've also read about JUnit, but I don't
know which one is easier, using JUnit, or hijack the memory streams
for my program. Beside that, some students use gcc instead of java,
so I guess hijack the program I/O is easier.

I will appreciate anything that can help me -source code, tutorial,
suggestion, anything-



2 Answers Found

Answer #1    Answered By: Opal Alexander     Answered On: Dec 01

You might check  out the following site:


Answer #2    Answered By: Coleman Smith     Answered On: Dec 01

Without looking at your work, I might suggest that you
use a deployment package such as ant.

it can take care of alot of the problems you are

Didn't find what you were looking for? Find more on java i/o Or get search suggestion and latest updates.