Unit / Integration testing of BGA project

Game development with Board Game Arena Studio
Post Reply
User avatar
Alex_tgiu
Posts: 59
Joined: 28 December 2020, 22:11

Unit / Integration testing of BGA project

Post by Alex_tgiu »

I'm working as a Java programmer and am used, that programs have massive unit tests and high automated integration test coverage, so that there could always be a regression done after changing code, to see if everything still works.
In my BGA project, it feels like hacking, which is fun, but does not give me much confidence regarding faultlessness.
Yet, some logic is quite complex, many nested if-else blocks or loops over big data structures which cry for heavy unit testing.
Since I am not professionally experienced with PHP and JS, what chances do I have to do at least something in that direction with a BGA game?
User avatar
gilthe
Posts: 17
Joined: 30 October 2015, 22:05

Re: Unit / Integration testing of BGA project

Post by gilthe »

I think you'll have to make it temporarily standalone to get any meaningful level of that. That means modularizing the php side, so you can run as many of its functions as possible with a wrapper (or similar) from the command line. This usually requires masking/duplicating some BGA-specific functions used in php.
I did this to test specific edge cases as well as large-scale random situations for the elementary game logic. I wanted to but in the end did not also set up a standalone database, which would have allowed me to design tests closer to the way the code would be deployed (iirc, I found that it slowed it down too much). I read about others doing similar things in a more objective and systematic manner but I don't remember where unfortunately.
In my opinion, once you have the frontend involved, things get complicated because the framework is doing much of the lifting and that means everything gets very slow and barely automatizable. In any case, persistent states are ultimately generated only through php/SQL and not through JS, so I'd think you primarily need to worry about sampling possible inputs being transmitted from the frontend in order to get reasonable testing coverage.
User avatar
Alex_tgiu
Posts: 59
Joined: 28 December 2020, 22:11

Re: Unit / Integration testing of BGA project

Post by Alex_tgiu »

Thanks for your input.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: Unit / Integration testing of BGA project

Post by thoun »

On studio doc, you have an example of PHP unit testing. I use that to test easily complex functions.
Post Reply

Return to “Developers”