x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Unit testing blueprints with Automation System

I'm currently working on a plugin for an online service that is made up of native C++ and a Blueprint wrapper layer. I've just got to the stage where I need to automate testing of the various functions on our build server. It's fairly straightforward to setup and test the C++ functions, but I'm at as loss as to the best way to test the Blueprint wrapper.

I need to be able to do this through the Automation System to allow the tests to execute when building on the automated build server. Is there a way that I could load a "Unit test" scene and execute the blueprints though there? Or is there a better option? Any advice would be greatly appreciated.

Product Version: UE 4.9
Tags:
more ▼

asked Sep 16 '15 at 09:15 PM in Packaging & Deployment

avatar image

Silent8Strike
31 3 4 6

avatar image Nsomnia Sep 16 '15 at 09:36 PM

This is a long shot guess but what about blutility?

avatar image Silent8Strike Sep 17 '15 at 06:09 PM

Thanks for the reply, I've never heard of Blutility but it looks like it might be useful. I'll have to spend some more time looking into it.

avatar image Doug E ♦♦ STAFF Sep 21 '15 at 07:34 PM

Hey Silent8Strike-

I believe what you're trying to do is possible however I will need to test the process before I can say for sure. I'll update you once I'm able to make a test case.

Cheers

Doug Wilson

avatar image Silent8Strike Sep 21 '15 at 07:41 PM

Thanks Doug, looking forward to seeing what you come up with!

avatar image Rythym STAFF Sep 29 '15 at 06:23 PM

Hey Silent8Strike!

Quick question on your implementation at a high level while I help look into this for you. Are you creating a Blueprint based off your C++ class, then attaching a Blueprint Interface to it? If not, just a quick breakdown on the implementation would be super helpful.

Thanks!

avatar image Silent8Strike Sep 29 '15 at 06:51 PM

Hi Bob,

Right now the Blueprint layer to access my C++ functions is modeled after the OnlineSubsystem's latent async task nodes. This seemed like the cleanest way to implement the C++ functions in Blueprint as almost all of them are latent.

Currently I have a proxy UObject class that consists of BlueprintCallable functions that match all my native C++ functions. These functions do nothing but call my native C++ code. Again, this is based on the OnlineSubsystem's blueprint node handling, so I'm not sure I can explain it adequately.

The hope was that we could automate running all the blueprint functions on build, therefor testing the Blueprint and native C++ automatically and at the same time. If we end up having to run it manually its not the end of the world, but the automation makes catching errors a lot more likely.

Let me know if you need any more details.

avatar image Rythym STAFF Sep 29 '15 at 08:00 PM

Thanks for the additional info!

Another quick set of question(s)/comments :)

Is this proxy object being used by anything else, or just simply a test wrapper for the C++ object? I only ask because if there is no other logic in the proxy object, what do you wish to test? Just that the Blueprints exposure works?

Assuming your proxy class has its method(s) being called from a blueprint, you should be able to use the native UE4 Automation Framework to load that blueprint asset and call your exposed functions in a unit test form.

Here's some more info on UE4's automation system:

https://docs.unrealengine.com/latest/INT/Programming/Automation/TechnicalGuide/index.html https://docs.unrealengine.com/latest/INT/Programming/Automation/index.htm

The documentation needs some love, but if you have access to source, you can take a look at EditorAutomationTests.cpp as an example of how to implement them. (Under ..Engine\Source\Editor\UnrealEd\Private\Tests)

You can also run the tests from a command line, which should help get them running on your CIS/Build system in an automated fashion.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Thanks for getting back to me so quickly. The proxy object is not being used for anything else, so yes I'm just looking to confirm the blueprint calls are working correctly. Most of the BP calls are straight pass though to the C++, but others do some conversion of types and such so we just need to make sure everything works.

I've actually been working on setting up a blueprint as a unit test framework. It currently consists of several blueprints that contain all the methods to test, plus a master test blueprint that manages logging errors/success and cycling through the test blueprints.

As long as I can load and execute that via the automation system I should be good to go. I'll dig through the source and docs you mentioned and see if I can hook it up.

more ▼

answered Sep 29 '15 at 09:19 PM

avatar image

Silent8Strike
31 3 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

In 4.14 they made some changes to the functional testing so it's now more or less usable to write some basic tests in the blueprints ( I made a video demonstrating this https://www.youtube.com/watch?v=f4LpDXjFgVQ ) . Should be possible to test any blueprint with it, we'd just need to add some assertions on top of this functional test to make this more "unit-testing" like.

more ▼

answered Nov 19 '16 at 02:56 PM

avatar image

WakkaWakka
11 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question