Quality Assurance / Unit Testing

Hi there

Lately my co-developers and I have been experiencing a lot of small changes that somehow break some core systems. While manually testing stuff extensively can indeed help, the best course of action would (in my eyes) be to get some automated testing involved.

How do you guys ensure that any changes haven’t broken another piece of your code?

I have looked in to https://github.com/DarkRedemption/GUnit, but I don’t quite see how I should be able to simulate an actual player, at least not without defining a Player Stub manually, which would probably be a lot of work.

Any tips that you can share?

Thanks

The bots that come with gmod are basically player simulations

Hmm that does indeed sound interesting. We’re talking about the NextBots right?

If you have libraries that you can separate out from the body of your codebase, you can use the Busted suite to make sure the little things work.

I find it also helps to force developers to document anything in the global namespace, preferably in LDoc style (Although if you’re co-developers, it’s a little hard to force big things like this, and it might not help you all that much.)

https://github.com/SuperHighVoltage/NextBot-Player-base - NextBots wich simulate a player.

Bots aren’t 100% simulations of players though - they don’t run any clientside code, and can’t run console commands with Player:ConCommand

I’ll have a look and see if it’s something that we can use. Thanks

Are these NextBots extended with some player behavior or what is the difference between these are the ones in default GarrysMod? The ReadMe is rather lacking sadly.

What would you use to validate that client side code works as intended?

By having an actual client connected. Perhaps you should look into connecting with a client and using -textmode.

My friends.

[sp]if I had any[/sp]

Also, theres another command that lets you run multiple instances of gmod in steam, but you can only let them connect to a lan server, eg a self-made dedicated server on your pc (Wich normally most devs do…).

The Bots have the player functions & tables added if I remember right, having some variables, like the SteamID and Name meta var, faked with some random things.

Adding on to what Whitestar mentioned, you can easily do so by creating a .bat file on your desktop or wherever and having its contents be:



@echo off
start "Gmod" /D "F:\Program Files (x86)\Steam\SteamApps\common\GarrysMod" hl2.exe -multirun -steam


Replace the directory with your gmod directory, of course. And the server must have sv_lan set to 1.

What exactly is this useful for?

This is what I am doing right now yes. I am trying to explore the options of automated testing, as I would rather not have to repeat the same 200 tests manually every time I make a change :slight_smile:

It makes your game headless. That is, with no graphics. You start it and it’s just a console. It’s useful cause if you’re going to be doing this testing stuff, you’ll have a real client connect with that enabled, and not have the game take up as much resources as if you had started it normally.

Shit you guys are way too fancy.

I just run



bot_zombie 1
bot
bot
bot
bot
...


in the console. They are literally considered players by the game.

Bots don’t run client code, which is what he wants.

This is kinda off-topic but, anyone know why my other client is stuck at “Authenticating with steam”? I have sv_lan 1.

you need to add -insecure on your server

That worked, but after I restarted and tried to connect again I got the same error, even though i have -insecure and sv_lan 1

I’m not sure what i’m doing wrong, any idea?

-insecure has to go in the command line. (Next to +gamemode, +maxplayers, +map, etc)

[editline]October 19 2016[/editline]

Oh, didn’t see screenshot. What message are you getting when your client is kicked?