All Collections
Tests / Autograding
Autograder: Simulating input into student code
Autograder: Simulating input into student code

Running tests and mimicking input into student code

Vinay avatar
Written by Vinay
Updated over a week ago

You can call the below commands to add input to running a file in both bash unit tests and I/O command line tests:

Putting input in a string

If you don't have much input to feed into student code, then you can pipe it in with a string: 

### Bash ####
{command} <<< "input string"

For example, in python, running a file called print_age.py  with two consecutive arguments of 4  and 6 , you could do the following:

### Bash ####
python print_age.py <<< "input string"

Putting input in a file

First upload the file as a helper file.  

### Bash ####
{command} < helper_file.txt

For the same example above:

### Bash ####
python print_age.py < helper_file.txt

Did this answer your question?