Question Bank Problem

Re: Question Bank Problem

par Ray Morris,
Nombre de réponses : 0

 > were you saying that the question bank itself needs unit tests or your modifications for the search needs unit tests?

Both, mainly for question bank generally. The integrator has asked that my modification have unit tests. There are no existing unit tests for the question bank view, so my understanding is that in order test that question bank still works correctly with my modification, we'd need at least some unit tests for qb generally.  In other words, to prove in an automated way that I didn't break question bank, we'd need unit tests for question bank.

My experience with unit testing is limited, but from what I've seen, I don't know how to write unit tests for question bank without making significant changes.  I very much hope that Tim is correct, that he knows a way to do so. If I wrote them, I'd need to rework a lot of his code, getting him to sign off on all of the changes.  That's been a time consuming process in the past.

 

> it struck me that creating unit tests for another persons code might not be trivial.

Absolutely.  It would be hard for me to write unit tests for the significant amount of existing code, especially given my limited experience with unit testing.  It may be hard for Tim to write unit tests for my modification, though he was very involved in the process of getting my code to working in a way that he was ready to sign off on, so in some ways the modification is our code.  I imagine I could write unit tests for just my part, if unit tests for question bank generally were in existence.

 

If we used Behat rather than PHPUnit much fewer modifications may be needed, but I don't know if that's the best approach.

I'll defer to Tim on that because I suspect he's more clueful than I on the subject, and also because he's the maintainer.