UNITY3D official test Plug-in learning-unit testing, integration testing

Source: Internet
Author: User

Welcome to Unity Learning, unity training, Unity Enterprise training and education zone, there are many Unity3d resources, unity3d training videos, unity3d tutorials, Unity3d FAQs, Unity3d Project source code, "Dog Planing Learning Network" Unity's Ultimate Academy, dedicated to building the industry Unity3d training, learning the first brand.
in fact, Unity has a long test support, from the Mono Editor's unittest option, as well as the installation directory of NUnit.dll can be seen. Only few people in the country studied it. this time took the test plug under the Assertstore research, summed up a set of feasible solutions https://www.assetstore.unity3d.com/#/content/13802
children's shoes, which have not been used in unit testing before, can be used in the unit test of vs to download a vs2012This plugin is divided into 2 test modes, Unit test unittest and integration test integration
one drawback of unit test mode is that it can only be run in the editor state. You can use a lot of editor's things, but can not run the state means that does not support ngui,playmarker and so on. integration testing calls Unity's running functions and then runs the test cases one by one. is equivalent to the actual game running environment, so it is generally used for integration testingintegration testing is divided into 2 types, dynamic integration testing and general integration testingThe following will be explained
1. After the plugin is downloaded, the examples second is an example of integration testing.
2. One more tab, then open the Integration test panel
3. Each integration test needs to be judged by the asserted component.
4. After the test is complete, the test panel will be labeled in the Hierarchy panel. (The callback that is tied to the hierarchy shows that the playmarker ' play ' word is gone--)This common integration test is typically used to render visible if the y-coordinate is less than 5. But there's a lot of restraintcalling a function is cumbersome and cannot be assert.istrue (...) like vs. So we're going to use dynamic integration testing .
5. Examples of dynamic integration testing here, you can see how the DynamicIntegrationTest.cs script is written.


Using System;
Using System.Collections.Generic;
Using Unityengine;
[Integrationtest.dynamictestattribute ("exampleintegrationtests")]//bound scene name
[Integrationtest.ignore]
[Integrationtest.expectexceptions (False, typeof (ArgumentException))]
[Integrationtest.succeedwithassertions]
[Integrationtest.timeoutattribute (1)]
[Integrationtest.excludeplatformattribute (Runtimeplatform.android, Runtimeplatform.linuxplayer)]
public class Dynamicintegrationtest:monobehaviour
{
public void Start ()
{
Integrationtest.pass (Gameobject);
}
}

6. Test script, first feature Dynamictestattribute ("..") is the scene name of the binding. If the scene is under the name, the dynamic test script is automatically mounted to the test panel. It's more comfortable to use.

[Align=left] [Color=rgb (0,0,0)] [Backcolor=rgb (254,254,242)] [/backcolor] [/color] [/align]

[Integrationtest.dynamictestattribute ("exampleintegrationtests")]
[Integrationtest.excludeplatformattribute (Runtimeplatform.android, Runtimeplatform.linuxplayer)]
public class Test1:monobehaviour
{
public void Start ()
{
Integrationtest.assert (Gameobject);
}
}
[Integrationtest.dynamictestattribute ("exampleintegrationtests")]
[Integrationtest.excludeplatformattribute (Runtimeplatform.android, Runtimeplatform.linuxplayer)]
public class Test2:monobehaviour
{
public void Start ()
{
Integrationtest.assert (Gameobject);
}
}
7. In such a. cs file, create a number of test classes. Then for different modules, divided into different test scenarios, to test. You can also support many plugins such as Ngui. Nothing but some button response events force a call with reflection.

For more information, please visit"Dog Planing Learning Network" Unity Ultimate Academy 
Disclaimer: This document is from"Dog Planing Learning Net"Community-Unity Ultimate Academy, is the Netizen self-published Unity3d study articles, if there is any content infringement of your relevant interests, please communicate with the official, we will deal with it immediately.
?

UNITY3D official test Plug-in learning-unit testing, integration testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.