Jump to content
Sign in to follow this  
freebirduk

Integration test harness for P3D v4 SimConnect?

Recommended Posts

I'm doing some feasibility work on the development of a new add-on for Prepar3d v4. I've not developed for this platform before and I'm concerned about the time overhead of running tests connecting to the sim when the sim takes many minutes to load and stabilize.

For sure much can be done by referencing SimConnect in the add-on via dependency injection and then mocking it's behaviour. Most of the unit testing will be done this way. However for integration testing I'm concerned that constantly loading up the sim to run tests will be prohibitively slow.

I wonder therefore if there is some kind of SimConnect test harness or emulator available which allows realistic and predictable behaviours to be generated without loading the full sim? I can see that this wouldn't be true integration testing but I suspect it would save hours watching the Sim UI load and settle.

Any pointers gratefully received.

Share this post


Link to post
Share on other sites

Good point, if I understand correctly and to add. A way to restart simconnect without restarting the sim. I occasionally lose simconnect to a client and no way to restart without rebooting

Share this post


Link to post
Share on other sites

This has never been much of a problem for me. Most of the time you can just leave the sim running. The API is up only when and if the sim is running properly anyway, and most processes can only start when you are actually sitting in the cockpit (connection is possible much earlier than that though, which you have to account for in your code). I never had an issue where I had to reboot the computer, and very rarely do I have to restart the sim.

For testing purposes it is advisable to run a bare bones sim installation, which won't take that long to load anyway. Even on my mobile devel laptop P3D V4 only takes 20 seconds until the virtual cockpit is shown, on the main development desktop it is half that time.

TBH, while this sounds unprofessional - I wouldn't bother too much with the dilligent approach to developer tests. There are so many undocumented surprises hidden in SimConnect, and so many things are described incorrectly or not at all, that you will soon end up running a (frustrating) trial&error routine anyway. IMHO you would be inducing quite the risk if you try to "mock its behaviour", because that may not at all be what the real thing is doing in all situations.

Best regards


LORBY-SI

Share this post


Link to post
Share on other sites
On 1/11/2018 at 2:01 PM, Lorby_SI said:

This has never been much of a problem for me. Most of the time you can just leave the sim running. The API is up only when and if the sim is running properly anyway, and most processes can only start when you are actually sitting in the cockpit (connection is possible much earlier than that though, which you have to account for in your code). I never had an issue where I had to reboot the computer, and very rarely do I have to restart the sim.

For testing purposes it is advisable to run a bare bones sim installation, which won't take that long to load anyway. Even on my mobile devel laptop P3D V4 only takes 20 seconds until the virtual cockpit is shown, on the main development desktop it is half that time.

TBH, while this sounds unprofessional - I wouldn't bother too much with the dilligent approach to developer tests. There are so many undocumented surprises hidden in SimConnect, and so many things are described incorrectly or not at all, that you will soon end up running a (frustrating) trial&error routine anyway. IMHO you would be inducing quite the risk if you try to "mock its behaviour", because that may not at all be what the real thing is doing in all situations.

Best regards

A good point about bare bones. It's rare for me to fly without 5-6 add-ons at least so I quickly forget what it's like flying the out-of-the-box product.

What you say about unexpected behaviour is rather what I was anticipating. I guess I was hoping for a test-harness which could "do what SimConnect does" in various scenarios without the overhead of the full UI. Without this I think I'll take a layered approach using

  1. Lower level functions which have no regard to the machinations of SimConnect. These can be unit tested in the usual way.
  2. A "talks to SimConnect" layer which, from what you say, will be something of an iterative process as I see how the API responds in real time.

Thanks for your input - Really useful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...