Unittest and Panda3D

I like doing Test Driven Development, but I dont know how to do that with Panda3D. There’s only so much you can test by writing tests for the functions. You pretty quickly get to things you want to test in game. I’d like to find a way to do that with automated tests.

Simple stuff like ‘if x is pressed, the player should move forward’ and ‘object A should collide with B’ and ‘object A should not collide with C’. But also more complicated stuff for the high level tests.

But I cant seem to get Python’s unittest and Panda3D to cooperate.

I have a few ideas for workarounds, but I might be making things way more complicated than they need to be, so I figured I ask first if anyone has any experience with this.

That’s what application testers are for. And they cannot always be completely replaced by a programmatic approach.

Logic is difficult to test using a program. If it were possible, then there would be no bugs in the games. For example: an AI character is stuck in rocks somewhere, and so on.

The examples you gave seem functional tests. You can do unit tests with Panda3D, they are very useful, but you may also want to add some functional tests. As instance, you can define a script which launches the application, then it simulates your event “if x is pressed”, then it takes a screenshot of the result. Then, in your functional test, you can do the same (launching the application and simulating the event), take a screenshot and compare the observed screenshot with the expected one.

Unitttest is my prefered Python testing library, I should have clarified that better, it does have a confusing name.

I’ve been looking into how software is tested and in general it’s a big mess. I’ll summarize it with this analogy:

You should look at where the finger is pointing, not the finger itself.

The finger points towards ‘produce code that works’ but most of the software industry has gone off the rails with a cargo cult like worshipping of buzzwords like Scrum and Kanban without ever looking up how it’s creators intended it. People are saying Agile has failed and arguing about post Agile but few have ever actually done Agile. Most have done some vague buzzwordy abomination.

The gaming industry manages to do an even worse job, with it’s crunch time for coders and manual testers.

Panda3D is opensource and entirely interacted with through code. (As opposed to say Unity3D, which uses more of a ‘click on things in menu’s’ approach) This should make it possible to have very strong automated testing with Panda3D. I’ll experiment a bit in between learning and practising my Panda3D and if I eventually find a system that works I’ll make post about it. I think Continuous Delivery (as explained by the youtube channel with the same name) is the future. That requires automated testing on all levels, which I feel should be possible with Panda3D.

Very infrequently have I seen a data driven comparison between methodologies – in fact, I’ve never seen one, I think.

The core issue that the Scrum, Kanban, Agile, etc attempt to address is that each program developer does not have cognitive access to the overall functioning of complex programs. So, they are methods of ignorance mobilization. If the developer doesn’t understand the entirety of program function, and cannot imagine the interactions that atomic commits will make, there is really nothing that will prevent those bugs from occurring, at least not without putting virtually as much time and effort into building test cases as writing the actual game code itself.

A program can contain bugs which remain for years which automated tests know to ignore, or which are entirely unknown both to the developer and the automated tests. This naturally may lead to combinatoric complexity when analyzing new bug introductions, I believe.

This view may come across as overly nihilistic, which I do not intend – I think that spending the time to understand whole program function can basically eliminate bugs at the development stage.