コード例 #1
0
        static int Main(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] == "-testInputsFile" && (i + 1) < args.Length)
                {
                    string filename = args[i + 1];
                    if (File.Exists(filename))
                    {
                        string testInputsFile = File.ReadAllText(filename);
                        var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
                        var testInputs = serializer.Deserialize<Dictionary<string, string>>(new JsonTextReader(new StringReader(testInputsFile)));
                        PlayFabApiTest.SetTitleInfo(testInputs);
                    }
                    else
                    {
                        Console.WriteLine("Loading testSettings file failed: " + filename);
                        Console.WriteLine("From: " + Directory.GetCurrentDirectory());
                    }
                }
            }

            UUnitTestSuite suite = new UUnitTestSuite();
            // With this call, we should only expect the unittests within PlayFabSDK to run - This could be expanded by adding other assemblies manually
            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                suite.FindAndAddAllTestCases(assembly, typeof(UUnitTestCase));

            suite.RunAllTests();
            UUnitTestResult result = suite.GetResults();
            Console.WriteLine(result.Summary());
            Console.WriteLine();
            return result.AllTestsPassed() ? 0 : 1;
        }
コード例 #2
0
        public static void Start(bool postResultsToCloudscript = true, string filter = null, TestTitleData testInputs = null
#if !DISABLE_PLAYFABCLIENT_API
                                 , Action <PlayFabResult <ExecuteCloudScriptResult> > onComplete = null
#endif
                                 )
        {
            TestTitleData = testInputs;
            VerifyTestTitleData();

#if !DISABLE_PLAYFABCLIENT_API
            PlayFabApiTest.SetTitleInfo(TestTitleData);
#endif
#if ENABLE_PLAYFABSERVER_API || ENABLE_PLAYFABADMIN_API
            PlayFabServerApiTest.SetTitleInfo(TestTitleData);
#endif

            SuiteFinished             = false;
            AllTestsPassed            = false;
            _postResultsToCloudscript = postResultsToCloudscript;
            _suite = new UUnitTestSuite();
            _suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);
#if !DISABLE_PLAYFABCLIENT_API
            _onComplete = onComplete;
#endif
        }
コード例 #3
0
        public static void Start(bool postResultsToCloudscript = true, string filter = null, TestTitleData testInputs = null
#if !DISABLE_PLAYFABCLIENT_API
                                 , Action <PlayFabResult <ExecuteCloudScriptResult> > onComplete = null
#endif
                                 )
        {
            // Fall back on hard coded testTitleData if necessary (Put your own data here)
            if (testInputs == null)
            {
                testInputs = new TestTitleData {
                    titleId = "6195", userEmail = "*****@*****.**"
                }
            }
            ;
#if !DISABLE_PLAYFABCLIENT_API
            PlayFabApiTest.SetTitleInfo(testInputs);
#endif

            SuiteFinished             = false;
            AllTestsPassed            = false;
            _postResultsToCloudscript = postResultsToCloudscript;
            _suite = new UUnitTestSuite();
            _suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);
#if !DISABLE_PLAYFABCLIENT_API
            _onComplete = onComplete;
#endif
        }
コード例 #4
0
        public static void TestImmediately()
        {
            ClearDebugLog();
            UUnitTestSuite suite = new UUnitTestSuite();
            suite.FindAndAddAllTestCases(typeof(UUnitTestCase));
            suite.RunAllTests();
            UUnitTestResult result = suite.GetResults();

            if (!result.AllTestsPassed())
            {
                Debug.LogWarning(result.Summary());
                throw new Exception("Not all tests passed.");
            }
            else
            {
                Debug.Log(result.Summary());
            }
        }
コード例 #5
0
        public void Start()
        {
            suite = new UUnitTestSuite();
            suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);

            if (textDisplay == null)
            {
                Canvas canvas = new GameObject("Canvas", typeof(Canvas)).GetComponent <Canvas>();
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
                textDisplay       = new GameObject("Test Report", typeof(Text)).GetComponent <Text>();
                textDisplay.font  = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
                RectTransform textTransform = textDisplay.rectTransform;
                textTransform.SetParent(canvas.transform, false);
                textTransform.anchorMin        = new Vector2(0, 0);
                textTransform.anchorMax        = new Vector2(1, 1);
                textTransform.pivot            = new Vector2(0, 1);
                textTransform.anchoredPosition = Vector2.zero;
            }
        }
コード例 #6
0
        public static void TestImmediately()
        {
            ClearDebugLog();
            UUnitTestSuite suite = new UUnitTestSuite();

            suite.FindAndAddAllTestCases(typeof(UUnitTestCase));
            suite.RunAllTests();
            UUnitTestResult result = suite.GetResults();

            if (!result.AllTestsPassed())
            {
                Debug.LogWarning(result.Summary());
                throw new Exception("Not all tests passed.");
            }
            else
            {
                Debug.Log(result.Summary());
            }
        }
コード例 #7
0
        public void Start()
        {
            testTitleData = TestTitleDataLoader.LoadTestTitleData(testTitleDataAsset == null ? null : testTitleDataAsset.text);
            suite         = new UUnitTestSuite();
            suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);

            if (textDisplay == null)
            {
                var canvas = new GameObject("Canvas", typeof(Canvas)).GetComponent <Canvas>();
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
                textDisplay       = new GameObject("Test Report", typeof(Text)).GetComponent <Text>();
                textDisplay.font  = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
                var textTransform = textDisplay.rectTransform;
                textTransform.SetParent(canvas.transform, false);
                textTransform.anchorMin          = new Vector2(0, 0);
                textTransform.anchorMax          = new Vector2(1, 1);
                textTransform.pivot              = new Vector2(0, 1);
                textTransform.anchoredPosition   = Vector2.zero;
                textTransform.offsetMax          = Vector2.zero;
                textTransform.offsetMin          = Vector2.zero;
                textDisplay.resizeTextForBestFit = true;
            }
        }