[Tutor] Introductory questions on test-driven development and implementing Git version control.

boB Stepp robertvstepp at gmail.com
Fri Apr 24 21:09:45 CEST 2015


I have just started reading "Test-Driven Development by Example" by
Kent Beck during my lunch breaks at work. This book was a suggestion
by Danny Yoo in another thread. So far it has been good reading. My
current programming work flow is to add a little bit of code, run a
*manual* test(s), inspect the results, correct anything that fails,
rerun my manual test(s), etc. Frequently I run the entire program to
see if anything has been damaged by the work so far. So TDD feels like
it would fit very well with what I already try to do *manually*. I've
known for a while that I need to move towards comprehensive automated
testing, and I finally feel I know enough Python that I can focus on
TDD and not be constantly struggling with Python syntax issues. And I
really like this idea of writing a test first, it fails, now make the
test pass, repeat.

My wife (A teacher.) has been after me a lot lately to write some
programs to make her teaching life better. So I would like to start
one of her projects using TDD from the get-go. Also, this sounds like
a good time to try to implement using version control software. While
setting up Vim recently, I had to install Git (In order to get Vundle
going.). So now I have that to play with. And to throw more fuel onto
the fire of learning, why not jump into OOP for this project as well?
It's about time! Plus it will make life with Tkinter a bit better,
too.

The project(s) will be coded in Python 3.4 on Windows 7 64-bit on my
home computer. All projects that I actually complete for my wife will
be implemented in her classroom, which has quite a variety of hardware
and OS platforms: lap tops and desk tops, some of which are rather
old, running Windows XP, Windows 7, and Ubuntu Linux. And possibly
other combos that I have not been made aware of yet.

First question: What testing modules/frameworks should I start out
with? Doing a quick scan of the books I have, mention is made of
doctest and unittest modules in the Python standard libraries. But
mention is also made of two third party modules, nose and pytest. What
would be the most productive use of my learning time while entering
TDD waters for the first time? And beyond automating unit tests, how
is integration testing done in an automated fashion? Will I require
special software for this? And then there is user interface testing...

And what would be the best approach to integrating Git with these
efforts? Just how often does one commit one's code to the version
control system? Or do I have some GCEs (Gross Conceptual Errors) here?
Can Git be set up to automatically keep track of my code as I create
and edit it?

And as to automated testing: I really, ..., really would like to
implement it on my side projects at work. But all such programs start
in a proprietary scripting environment, which can call external Python
(or other languages) scripts. The resulting final program is almost
always an unavoidable amount of propriety scripting language (Which I
always strive to minimize the amount of.), Solaris shell
commands/scripts and Python. As I have been learning more Python and
implementing it at work, I have found that the most successful
approach seems to be to first get all of the information I need out of
the CSA (commercial software environment) upfront, save it in temp
files, then call a Python script to start the heavy duty processing,
do everything possible in Python, generate a "reload" script file that
contains language the CSA understands, and finally run that inside the
CSA. How do I go about automating the testing of something like this?
And apply TDD write tests first principles?

And I would like to have all of that under version control, too. But
while I am allowed to write my own programs for this CSA, I am not
allowed to install anything else, strange as this may sound! Since the
only functional editors in these bare-bones Solaris 10 environments
are some simplistic default editor that I do not know the name of and
vi, I long ago gravitated to doing my actual coding on my Windows PC
(Being careful to save things with Unix line endings.) and FTPing to
the environments where these programs will actually run. I AM allowed
to install anything I want (within reason)on my PC. So I am thinking
install and use Git there?

And if successful automated testing can be done with this CSA
situation, how difficult is it to backtrack and add test suites to
stuff already written and being used? Are there special strategies and
techniques for accomplishing such a feat?

And any other suggestions to best start learning all of this as well
as possible?

As always, many thanks in advance!


-- 
boB


More information about the Tutor mailing list