Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As a college student do you write unit-test for the project code you write? Do you know how to properly use TDD? Have you been taught to use testing frameworks (jUnit for example)?

I've just recently heard that a major company's project team was delivering software to User Acceptance Testing group that had only 7% line code coverage for unit testing. While that shocks me, it just tells me that this company's software engineering practice are immature. However I wonder if they could just hire a few recent graduates and raise the bar on the teams practices - assuming that these newly minted programmers were trained in the best practices.

Are you 2008 - 2010 CS graduates using best practices of unit testing your code?

share|improve this question
3  
a better question might be 'does your college test unit testing?' –  Steven A. Lowe Dec 5 '10 at 5:53
    
And assuming that that the code is reasonably testable without some serious refactoring. Considering their current coverage makes me think it might not be. –  Steve Evers Dec 5 '10 at 8:47
    
uh, that should be 'does you college teach unit testing?' –  Steven A. Lowe Dec 5 '10 at 15:01
2  
The answer to this question is 0%. The only reason I know of Req Test Matrix is because of an engineering senior project. There was zero effort put into talking about how to test and verify if something worked. The good news is my job allows me to develop and write the requirements and allow a third-party test and verify the requirements have been meet. –  Ramhound Feb 23 '11 at 18:06
2  
I don't know... I did maths at university. I can guarantee you though that a company that doesn't already test code will not change just because they hire a few graduates. –  Ben Aug 29 '11 at 20:50

7 Answers 7

I don't write unit-tests for the software I write for assignments, I usually just do some of my own testing and debugging.

Honestly, CS at my university is fairly broken, half the students are diehard passionate programmers who have learned nearly everything on their own. The other half can barely write a hello world in Java, and know no other languages and have extreme problems with even trivial programs. Students barely get much programming experience, most manage to squeak by copy & pasting code form books and the internet without really understanding it.

As part of the degree plan, you have to take courses on architecture and management that involve agile and the concepts of software testing and test driven development. However, these courses are taken pretty late (senior year) and are certainly not utilized in other courses.

If I had more time, I'd probably unit-test my code properly; unfortunately I'm working and taking 19 hours, so I've got alot of assignments and I can usually bang them out pretty quick and test them enough. I have gotten dinged a couple points for a bug here or there though, and unit-testing my code would certainly help get better grades on the assignments.

Sadly, my experience is that any REAL software development, any type of real-world systems programming or coding standards or best practice is done by those who write code on the weekends, and read about it on their own, and look for it on their own. The students who just go to class, I can't imagine how they're going to get hired. You get shown what all exists and that you need to know it in class, but not enough implementation.

Professors can't grade 50 students' programming assignments every week, so if they want to have lots of actual practice, they have us do group work. This results in the one or two good programmers doing almost all the work, and the rest follow along and try to read and modify their code. Maybe other Universities are better, and I think they claim to be; but I think in practice they aren't really any different.

share|improve this answer
2  
<pessimism>Unfortunately, those students will get hired. The scary part: they'll get promoted to their level of incompetence and you'll/we'll have to maintain what they wrote.</pessimism> –  Steve Evers Dec 5 '10 at 8:49
    
Yep, fair assessment of my University as well. Most classes covered CS theory, typically the assignments would be proofs or coding problems related to the current topic. With one exception none of my CS professors thought it was important to teach us good SW development practices. The one that did taught part time and owned his own consulting company (best professor I had). –  Ken Henderson Dec 5 '10 at 12:49
    
I am glad to hear it is not just my University. It seems that most good practices are either never taught or are barely touched upon. I think that because so many students in CS programs never really pass the clueless stage the professors feel that they either can't or won't be able to teach these students and therefore just skip it altogether. –  Ryan Matthews Aug 29 '11 at 19:39
    
"Professors can't grade 50 students' programming assignments every week." If the professor used unit testing as a way to grade assignments, then this would be perfectly possible. Students submit code, and the grade would be based on if it passes all the tests. Unit tests could be graded with unit testing, too. The test tests would check a set of possible implementations with the tests to be tested. –  AJMansfield Sep 5 '13 at 18:02

As a college student do you write unit-test for the project code you write?

MS thesis project; sorta. I do interactive testing with Lisp/Slime. Some stuff gets unit tests, some stuff doesn't.

Do you know how to properly use TDD?

Meh, tried it, didn't see the point. Rather test during than before.

Have you been taught to use testing frameworks (jUnit for example)?

Why should a professor waste our time teaching me an API? If I can't learn an API, I need to leave the field.

share|improve this answer
    
"Why should a professor waste our time teaching me an API? " Indeed, they should teach you to think and learn, not to use a specific product... As to jUnit: Java didn't exist when I graduated, let alone jUnit, unit testing was unheard of (at least as it is today) :) –  jwenting Aug 30 '11 at 6:22

(I graduated in 2008)

We learned ABOUT unit testing, and had to do so for some assignments in a class called "Team Software Project". The class was about software engineering practices. Other than that one class, it wasn't mentioned, but that class was required to get a BSc in Computer Science. The Computer Science department also offered a Software Engineering concentration that was more project-based, with classes devoted to testing, HCI, project management, etc. but still with a theoretical CS core.

share|improve this answer

Time is a big factor in this. You could do one programming assignment per month with time to TDD it, or you could do one every two weeks with some other testing method. In the workplace, the month is worth it because you will live with that code for months/years/decades, and maybe even make money from it. In the classroom where it's written and promptly thrown away (if not immediately at last check-in, at least at the end of the semester, maybe at the end of two for some special projects class), it just doesn't make educational sense. Your professor would rather you learn twice as many programming concepts through personal experience (a project), than learn one concept and spend weeks making the code bulletproof.

The goals are different. With the exception of a software engineering course, required-TDD on all projects might actually be a warning sign of a less-than-optimally-effective instructor at the college-project level (you're going to learn less).

And for laughs, there's always the silly case of write a unit test for Hello World before you know how to program... because you're learning how to write your first program :) Laugh. Do not take hello world example seriously.

share|improve this answer
    
better yet: assignment: write a test to test the accuracy of a test for a "hello world" program :) –  jwenting Aug 30 '11 at 6:23

In my university you can't complete a Software Engineering degree without taking a particular subject that focuses on teaching Agile software development methodologies. In that subject you can't claim any feature's implemented without reasonable testing through JUnit and Selenium.

However: TDD was taught but not enforced and due to group work some students could avoid exposing themselves to Selenium and/or JUnit.

share|improve this answer

Generally when the coverage is so low it has nothing to do with the skill level of the developers or how recently they graduated.

Usually two things have caused this, old code that was written before TDD was common (when much of your code base was written ten years ago, it would be extremely unlikely that you would have test coverage) and tight (often impossible) deadlines. Testing is one of the first casualties of the impossible deadline.

So adding new people more familar with testing is unlikely to change either fo those two conditions and test converage will likely only slowly improve.

That said, I personally have only rarely seen a recent graduate who cared much about testing. That is because the projects they work on in school are both small and not in need of maintenance over time. So the critical reasons for test converage are not there and most studnets don't do TDD routinely. Recent grads often also have to be taught about using source control. There is a huge difference between working on enterprise software and class assignments and thus these things are not really on their radar until they get dropped into a large and continuing project.

share|improve this answer

Just graduated recently with a degree in CS. I can honestly say that besides material that was focused on testing, I was never required to turn in tests. That doesn't mean I didn't write them though. I wish my school had discussed testing more. Testing, and source control.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.