Posts about workflowhttp://cestlaz.github.io/categories/workflow.atom2018-09-19T23:47:48ZMike ZamanskyNikolaUnit Tests Grading Workflowhttp://cestlaz.github.io/posts/unit-tests-grading-workflow/2018-04-20T17:49:28-04:002018-04-20T17:49:28-04:00Mike Zamansky<div id="outline-container-org20b6b78" class="outline-2">
<h2 id="org20b6b78"></h2>
<div class="outline-text-2" id="text-org20b6b78">
<p>
I've talked before about unit testing (<a href="http://cestlaz.github.io/posts/testing-testing">here</a>, and <a href="http://cestlaz.github.io/posts/testing-part2">here</a>). My premise is
that in addition to being an important industry technique, it's a
sound practice for students studying CS. I also contend that it can
make grading easier on the teacher. Maybe not as easy as an
auto-grader but those have <a href="https://cestlaz.github.io/posts/2015-10-16-graders.html/#.WtplHHXwZhE">their own problems</a>.
</p>
<p>
Since I spent most of today grading I thought I'd share my current
workflow and how unit tests have made me more efficient.
</p>
<p>
I have each student make a single GitHub repo for all individual
homeworks, labs and small projects. They'll make additional repos for
larger and group projects. They fill out a Google form to give me the
repo link. I download the form and end up with a CSV file something like this:
</p>
<div class="highlight"><pre><span></span>Doe, John, git@github.com:johndoe/mymoework.git
Doe, Jane, git@github.com:janedoe/labs.git
etc.
</pre></div>
<p>
My goal is to clone each students repo into a directory and then
throughout the term, they add assignments to their own repos using the
names and specifications I give them. For example, after assigning
three assignments, I could pull everything from their repos and I
would have a directory structure something like this:
</p>
<pre class="example">
hw
├── doe_jane
│ ├── hw_01
│ ├── hw_02
│ └── hw_03
│
└── doe_john
├── hw_01
└── hw_02
</pre>
<p>
To get there, I have to change the csv file to a small shell script:
</p>
<div class="highlight"><pre><span></span>git clone git@github.com:johndoe/mymoework.git doe_john
git clone git@github.com:janedoe/labs.git doe_jane
etc.
</pre></div>
<p>
I usually do this in Emacs with a macro.
</p>
<p>
Now I'm ready to go.
</p>
<p>
Whenever there's a new assignment, I just have to update all the
repos. I go into the root hw directory and loop through all the
subdirectoryes:
</p>
<div class="highlight"><pre><span></span>cs /path/to/hw_root
for i in `ls`
do
cd /path/to/hw_root/$i
git pull
done
</pre></div>
<p>
At this point I could go into each repo but we can do better. Since I
have all of my students submit a Makefile with a default target to
build an executable named <code>main</code> and also a target named <code>tests</code> which
will build an executable to run the unit tests named <code>tests</code> I do this
instead of a straight pull:
</p>
<div class="highlight"><pre><span></span>cs /path/to/hw_root
for i in `ls`
do
cd /path/to/hw_root/$i
git pull
cd hw_03 # or whatever assignment I'm grading
make tests
make
done
</pre></div>
<p>
Now, if I want, I can go into each directory, run the tests by typing
<code>./tests</code> and the hw or project with <code>./main</code>. I can also add a
couple of lines to the for loop above like:
</p>
<div class="highlight"><pre><span></span>echo "$i Test Report\n----------------\n" >> /path/to/hw_root/test_report
./tests >> /path/to/hw_root/test_rport
echo "----------------------\n\n"
</pre></div>
<p>
This gives me a single file with everyone's test results. Either by
doing this or by running the tests in each folder manually I can
quickly see what works and what doesn't.
</p>
<p>
While I'm doing this, I have Emacs up and with <b>dired mode</b> and more
specifically <b>ag-dired-regexp</b> which lets me easily
navigate to any student's files. Combined with the test results I can
quickly evaluate the entire assignment.
</p>
<p>
Put all of this together and it makes grading somewhat bearable. I can
work through well written, correct assignments extremely quickly and
drill down into the other projects efficiently as well.
</p>
</div>
</div>