Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unit Testing

Featured Replies

I posted my question on the RAGE forum but haven't had any responses. In short, is there any way to include/use the RAGE SDK in unit testing? I get an error which makes no sense and I'd love to have guarantees in my coding.

I find it super difficult to see large projects like Rage and LSPD:FR can have such scalable projects without unit testing... Especially with the ability to mock objects

Sorry for the tagging that's about to happen.. But I'm dying to understand it..

@Sam, @LMS, @alexguirre, @ScottehBoyy, @Albo1125, @LtFlash

Edited by ainesophaur

I've never done this before personally - it's much easier to just run your code in the game,especially as you can test your code basically in real time. 

There's no need to reload the entire game every time. You can just reload the LSPDFR Plugin or any other Plugin you're using from the RPH console - you can replace the files while you're in game too. 

If you decide to do it this way, what might help you is renaming Ragepluginhooksdk.dll to RAGEPluginHook.dll as that's the name it'll look for. 

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

  • Author
1 hour ago, Albo1125 said:

I've never done this before personally - it's much easier to just run your code in the game,especially as you can test your code basically in real time. 

There's no need to reload the entire game every time. You can just reload the LSPDFR Plugin or any other Plugin you're using from the RPH console - you can replace the files while you're in game too. 

If you decide to do it this way, what might help you is renaming Ragepluginhooksdk.dll to RAGEPluginHook.dll as that's the name it'll look for. 

You're a genius .. Further in the logs it does show that it's trying to load RagePluginHookSDK.dll but I copied the DLL and had both names which worked. I can't believe I didn't try that.. Thanks again.

On a side note, it's more to verify behavior of your project. For instance, the test I'm writing is to have a binder of keys and actions to simultaneously react to key presses on a keyboard and controller that I'm interested in. With the unit test, I can verify the behavior of my code in pure c# environment.. Not having to load the game, clean objects up, etc.. After having a full suite of tests, Id be able to verify that my plugins work as expected in 20 seconds without launching the game.. At least as much as possible.

If you get unit testing to work please post a tutorial about it. I'd love to be able to use it but I have yet to figure out any good way what with having to launch the game. 

Likewise, if anyone can figure out and demonstrate a way to do interactive debugging of RAGE plugins that would be awesome as well. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

My "Transportation" mod has almost 130 *.cs files but I managed to debug it using RAGE logging system only because of a very intuitive architecture in core parts. In a problematic area I log info about specific stages being executed + current value of variables. I usually have more troubles with specific architecture decisions (they are as good for one reason as bad for another) than fixing bugs => pay close attention to a project of your plugin since it will influence how easy it'll be to maintain.

I did not use any advanced techniques of debugging in my mods, as it was said it's impossible at this moment.

Edited by LtFlash

Something I've also taken a liking to is using lots of Game.LogTrivials in problematic parts so I can see exactly where it's going wrong. I also use the variable value printing LtFlash mentioned. 

Another nice thing you can do is copy the .pdb file of your assembly to the same folder in your GTAV directory. If an exception occurs, the pdb will tell you exactly in which class and which line of your code this happened. 

If you're used to unit testing I guess that could work too. Glad it's working now! :) 

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

  • Management Team

The only parts I unit test are things like networking, IO, etc. I don't really unit test any game-related calls.

On 4/24/2016 at 6:07 AM, PNWParksFan said:

Likewise, if anyone can figure out and demonstrate a way to do interactive debugging of RAGE plugins that would be awesome as well. 

The game's DRM is not a big fan of debugging. For some reason only native code debugging works well (granted you strip the anti-debug checks). As for .NET, I only got it working via WinDbg with SOS loaded.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.