public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Push tests");
            const string imageUrl = "http://zumotestserver.azurewebsites.net/content/zumo2.png";
            const string wideImageUrl = "http://zumotestserver.azurewebsites.net/content/zumo1.png";
            result.AddTest(CreateRegisterChannelTest());
            result.AddTest(CreateToastPushTest("first text", "second text"));
            result.AddTest(CreateToastPushTest("ãéìôü ÇñÑ", "الكتاب على الطاولة"));
            result.AddTest(CreateToastPushTest("这本书在桌子上", "本は机の上に"));
            result.AddTest(CreateToastPushTest("הספר הוא על השולחן", "Книга лежит на столе"));
            result.AddTest(CreateToastPushTest("with param", "a value", "/UIElements/InputDialog"));
            result.AddTest(CreateRawPushTest("hello world"));
            result.AddTest(CreateRawPushTest("foobaráéíóú"));
            result.AddTest(CreateTilePushTest(
                "Simple tile", new Uri("/Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative), 0,
                "Simple tile", 
                new Uri("/Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative), "Back title", "Back content"));
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("After clicking OK, make sure the application is pinned to the start menu"));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Is the app in the start menu?", true));
            result.AddTest(CreateTilePushTest("Tile with image", new Uri(imageUrl), 3, "Test title", new Uri(wideImageUrl), "Back title", "Back content"));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Did the tile change?", true, 3000));
            result.AddTest(CreateFlipTilePushTest("Flip tile",
                new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative), 5, "Flip title",
                new Uri("/Assets/Tiles/IconicTileSmall.png", UriKind.Relative), "Flip back title", "Flip back content",
                new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative), new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative),
                "Flip wide back content", new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative)));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Did the tile change?", true, 3000));

            result.AddTest(CreateUnregisterChannelTest());
            return result;
        }
Ejemplo n.º 2
0
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Push tests");
            const string imageUrl = "http://zumotestserver.azurewebsites.net/content/zumo2.png";
            const string wideImageUrl = "http://zumotestserver.azurewebsites.net/content/zumo1.png";
            result.AddTest(CreateRegisterChannelTest());
            result.AddTest(CreateToastPushTest("sendToastText01", "hello world"));
            result.AddTest(CreateToastPushTest("sendToastImageAndText03", "ts-iat3-1", "ts-iat3-2", null, imageUrl, "zumo"));
            result.AddTest(CreateToastPushTest("sendToastImageAndText04", "ts-iat4-1", "ts-iat4-2", "ts-iat4-3", imageUrl, "zumo"));
            result.AddTest(CreateBadgePushTest(4));
            result.AddTest(CreateBadgePushTest("playing"));
            result.AddTest(CreateRawPushTest("hello world"));
            result.AddTest(CreateRawPushTest("foobaráéíóú"));
            result.AddTest(CreateTilePushTest("TileWideImageAndText02", new[] { "tl-wiat2-1", "tl-wiat2-2" }, new[] { wideImageUrl }, new[] { "zumowide" }));
            result.AddTest(CreateTilePushTest("TileWideImageCollection",
                new string[0], 
                new[] { wideImageUrl, imageUrl, imageUrl, imageUrl, imageUrl },
                new[] { "zumowide", "zumo", "zumo", "zumo", "zumo" }));
            result.AddTest(CreateTilePushTest("TileWideText02",
                new[] { "large caption", "tl-wt2-1", "tl-wt2-2", "tl-wt2-3", "tl-wt2-4", "tl-wt2-5", "tl-wt2-6", "tl-wt2-7", "tl-wt2-8" },
                new string[0], new string[0]));
            result.AddTest(CreateTilePushTest("TileSquarePeekImageAndText01",
                new[] { "tl-spiat1-1", "tl-spiat1-2", "tl-spiat1-3", "tl-spiat1-4" },
                new[] { imageUrl }, new[] { "zumo img" }));
            result.AddTest(CreateTilePushTest("TileSquareBlock",
                new[] { "24", "aliquam" },
                new string[0], new string[0]));

            result.AddTest(CreateUnregisterChannelTest());
            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Misc tests");
            
            result.AddTest(CreateFilterTestWithMultipleRequests(true));
            result.AddTest(CreateFilterTestWithMultipleRequests(false));

            result.AddTest(new ZumoTest("Validate that filter can bypass service", async delegate(ZumoTest test)
            {
                string json = "{'id':1,'name':'John Doe','age':33}".Replace('\'', '\"');
                var client = new MobileServiceClient(
                    ZumoTestGlobals.Instance.Client.ApplicationUri,
                    ZumoTestGlobals.Instance.Client.ApplicationKey,
                    new HandlerToBypassService(201, "application/json", json));
                var table = client.GetTable("TableWhichDoesNotExist");
                var item = new JObject();
                var inserted = await table.InsertAsync(item);
                List<string> errors = new List<string>();
                if (!Util.CompareJson(JObject.Parse(json), inserted, errors))
                {
                    foreach (var error in errors)
                    {
                        test.AddLog(error);
                    }

                    test.AddLog("Error comparing object returned by the filter");
                    return false;
                }
                else
                {
                    return true;
                }
            }));

            result.AddTest(CreateUserAgentValidationTest());
            result.AddTest(CreateParameterPassingTest(true));
            result.AddTest(CreateParameterPassingTest(false));

            result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - client wins", (clientItem, serverItem) =>
            {
                var mergeResult = clientItem.Clone();
                mergeResult.Version = serverItem.Version;
                return mergeResult;
            }));
            result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - server wins", (clientItem, serverItem) =>
            {
                return serverItem;
            }));
            result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - Name from client, Number from server", (clientItem, serverItem) =>
            {
                var mergeResult = serverItem.Clone();
                mergeResult.Name = clientItem.Name;
                return mergeResult;
            }));

            result.AddTest(CreateSystemPropertiesTest(true));
            result.AddTest(CreateSystemPropertiesTest(false));

            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Tests Setup");
            result.AddTest(CreateSetupTest());

            return result;
        }
        internal static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Custom API tests");

            DateTime now = DateTime.UtcNow;
            int seed = now.Year * 10000 + now.Month * 100 + now.Day;
            Random rndGen = new Random(seed);

#if !NET45
            result.AddTest(ZumoLoginTests.CreateLogoutTest());
#endif

            result.AddTest(CreateHttpContentApiTest(DataFormat.Xml, DataFormat.Json, rndGen));

#if !NET45
            List<ZumoTest> testsWhichNeedAuth = new List<ZumoTest>();

            foreach (ApiPermissions apiPermission in Util.EnumGetValues(typeof(ApiPermissions)))
            {
                testsWhichNeedAuth.Add(CreateJTokenApiTest(apiPermission, false, rndGen));
            }

            testsWhichNeedAuth.Add(ZumoLoginTests.CreateLoginTest(MobileServiceAuthenticationProvider.Google));
            testsWhichNeedAuth.Add(CreateJTokenApiTest(ApiPermissions.User, true, rndGen));
            testsWhichNeedAuth.Add(ZumoLoginTests.CreateLogoutTest());

            foreach (var test in testsWhichNeedAuth)
            {
                test.CanRunUnattended = false;
                result.AddTest(test);
            }
#endif

            foreach (DataFormat inputFormat in Util.EnumGetValues(typeof(DataFormat)))
            {
                foreach (DataFormat outputFormat in Util.EnumGetValues(typeof(DataFormat)))
                {
                    result.AddTest(CreateHttpContentApiTest(inputFormat, outputFormat, rndGen));
                }
            }


            result.AddTest(ZumoQueryTests.CreatePopulateTableTest());
            foreach (TypedTestType testType in Util.EnumGetValues(typeof(TypedTestType)))
            {
                result.AddTest(CreateTypedApiTest(rndGen, testType));
            }

            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Misc tests");
            
            result.AddTest(CreateFilterTestWithMultipleRequests(true));
            result.AddTest(CreateFilterTestWithMultipleRequests(false));
            result.AddTest(new ZumoTest("Validate that 'WithFilter' doesn't change client", async delegate(ZumoTest test)
            {
                var client = ZumoTestGlobals.Instance.Client;
                var filteredClient = client.WithFilter(new FilterWhichThrows());
                var table = client.GetTable<RoundTripTableItem>();
                var items = await table.Take(5).ToListAsync();
                test.AddLog("Retrieved items successfully, without filter which throws affecting request.");
                return true;
            }));

            result.AddTest(new ZumoTest("Validate that filter can bypass service", async delegate(ZumoTest test)
            {
                var client = ZumoTestGlobals.Instance.Client;
                string json = "{'id':1,'name':'John Doe','age':33}".Replace('\'', '\"');
                var filtered = client.WithFilter(new FilterToBypassService(201, "application/json", json));
                var table = filtered.GetTable("TableWhichDoesNotExist");
                var item = new JsonObject();
                await table.InsertAsync(item);
                List<string> errors = new List<string>();
                if (!Util.CompareJson(JsonObject.Parse(json), item, errors))
                {
                    foreach (var error in errors)
                    {
                        test.AddLog(error);
                    }

                    test.AddLog("Error comparing object returned by the filter");
                    return false;
                }
                else
                {
                    return true;
                }
            }));

            result.AddTest(CreateUserAgentValidationTest());
            result.AddTest(CreateParameterPassingTest(true));
            result.AddTest(CreateParameterPassingTest(false));
            return result;
        }
Ejemplo n.º 7
0
        private static ZumoTestGroup CreateGroupWithAllTests(List<ZumoTestGroup> testGroups, bool unattendedOnly)
        {
            ZumoTestGroup result = new ZumoTestGroup(unattendedOnly ? AllTestsUnattendedGroupName : AllTestsGroupName);
            foreach (var group in testGroups)
            {
                result.AddTest(ZumoTestCommon.CreateSeparator("Start of group: " + group.Name));
                foreach (var test in group.AllTests)
                {
                    if (test.CanRunUnattended || !unattendedOnly)
                    {
                        result.AddTest(test);
                    }
                }

                result.AddTest(ZumoTestCommon.CreateSeparator("------------------"));
            }

            return result;
        }
 private void lstTestGroups_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     int selectedIndex = this.lstTestGroups.SelectedIndex;
     if (selectedIndex >= 0)
     {
         ZumoTestGroup testGroup = allTests[selectedIndex];
         this.currentGroup = testGroup;
         List<ListViewForTest> sources = testGroup.GetTests().Select((t, i) => new ListViewForTest(i + 1, t)).ToList();
         this.lstTests.ItemsSource = sources;
         this.lblTestGroupTitle.Text = string.Format("{0}. {1}", selectedIndex + 1, testGroup.Name);
         SwapPanels(false);
     }
     else
     {
         this.lstTests.ItemsSource = null;
         this.currentGroup = null;
         SwapPanels(true);
     }
 }
Ejemplo n.º 9
0
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Login tests");
            result.AddTest(CreateLogoutTest());
            result.AddTest(CreateCRUDTest("w8Application", null, TablePermission.Application, false));
            result.AddTest(CreateCRUDTest("w8Authenticated", null, TablePermission.User, false));
            result.AddTest(CreateCRUDTest("w8Admin", null, TablePermission.Admin, false));

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password four times."));

            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, false));
                result.AddTest(CreateCRUDTest("w8Application", provider.ToString(), TablePermission.Application, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
                result.AddTest(CreateCRUDTest("w8Admin", provider.ToString(), TablePermission.Admin, true));
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password four times?", true));

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username anymore, and in some even the password should also not be required."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false));

            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Push tests");
            result.AddTest(CreateRegisterChannelTest());
            result.AddTest(CreateToastPushTest("sendToastText01", "hello world"));
            result.AddTest(CreateToastPushTest("sendToastImageAndText03", "ts-iat3-1", "ts-iat3-2", null, imageUrl, "zumo"));
            result.AddTest(CreateToastPushTest("sendToastImageAndText04", "ts-iat4-1", "ts-iat4-2", "ts-iat4-3", imageUrl, "zumo"));
            result.AddTest(CreateBadgePushTest(4));
            result.AddTest(CreateBadgePushTest("playing"));
            result.AddTest(CreateRawPushTest("hello world"));
            result.AddTest(CreateRawPushTest("foobaráéíóú"));
            result.AddTest(CreateTilePushTest("TileWideImageAndText02", new[] { "tl-wiat2-1", "tl-wiat2-2" }, new[] { wideImageUrl }, new[] { "zumowide" }));
            result.AddTest(CreateTilePushTest("TileWideImageCollection",
                new string[0],
                new[] { wideImageUrl, imageUrl, imageUrl, imageUrl, imageUrl },
                new[] { "zumowide", "zumo", "zumo", "zumo", "zumo" }));
            result.AddTest(CreateTilePushTest("TileWideText02",
                new[] { "large caption", "tl-wt2-1", "tl-wt2-2", "tl-wt2-3", "tl-wt2-4", "tl-wt2-5", "tl-wt2-6", "tl-wt2-7", "tl-wt2-8" },
                new string[0], new string[0]));
            result.AddTest(CreateTilePushTest("TileSquarePeekImageAndText01",
                new[] { "tl-spiat1-1", "tl-spiat1-2", "tl-spiat1-3", "tl-spiat1-4" },
                new[] { imageUrl }, new[] { "zumo img" }));
            result.AddTest(CreateTilePushTest("TileSquareBlock",
                new[] { "24", "aliquam" },
                new string[0], new string[0]));
            result.AddTest(CreateUnregisterChannelTest());
            result.AddTest(CreateRegisterTemplateChannelTest("Toast"));
            result.AddTest(CreateTemplateToastPushTest("sendToastText01", "World News in English!"));
            result.AddTest(CreateUnregisterTemplateChannelTest(ZumoPushTestGlobals.NHToastTemplateName));
            result.AddTest(CreateRegisterTemplateChannelTest("Tile"));
            result.AddTest(CreateTemplateTilePushTest("TileWideImageAndText02", new[] { "tl-wiat2-1", "在普通话的世界新闻!" }, new[] { wideImageUrl }, new[] { "zumowide" }));
            result.AddTest(CreateUnregisterTemplateChannelTest(ZumoPushTestGlobals.NHTileTemplateName));
            result.AddTest(CreateRegisterTemplateChannelTest("Badge"));
            result.AddTest(CreateTemplateBadgePushTest("10"));
            result.AddTest(CreateUnregisterTemplateChannelTest(ZumoPushTestGlobals.NHBadgeTemplateName));
            result.AddTest(CreateRegisterTemplateChannelTest("Raw"));
            result.AddTest(CreateTemplateRawPushTest("Nouvelles du monde en français!"));
            result.AddTest(CreateUnregisterTemplateChannelTest(ZumoPushTestGlobals.NHRawTemplateName));

            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Push tests");
            result.AddTest(CreateRegisterChannelTest());
            result.AddTest(CreateToastPushTest("first text", "second text"));
            result.AddTest(CreateToastPushTest("ãéìôü ÇñÑ", "الكتاب على الطاولة"));
            result.AddTest(CreateToastPushTest("这本书在桌子上", "本は机の上に"));
            result.AddTest(CreateToastPushTest("הספר הוא על השולחן", "Книга лежит на столе"));
            result.AddTest(CreateToastPushTest("with param", "a value", "/UIElements/InputDialog"));
            result.AddTest(CreateRawPushTest("hello world"));
            result.AddTest(CreateRawPushTest("foobaráéíóú"));
            result.AddTest(CreateTilePushTest(
                "Simple tile", new Uri("/Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative), 0,
                "Simple tile",
                new Uri("/Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative), "Back title", "Back content"));
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("After clicking OK, make sure the application is pinned to the start menu"));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Is the app in the start menu?", true));
            result.AddTest(CreateTilePushTest("Tile with image", new Uri(imageUrl), 3, "Test title", new Uri(wideImageUrl), "Back title", "Back content"));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Did the tile change?", true, 3000));
            result.AddTest(CreateFlipTilePushTest("Flip tile",
                new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative), 5, "Flip title",
                new Uri("/Assets/Tiles/IconicTileSmall.png", UriKind.Relative), "Flip back title", "Flip back content",
                new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative), new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative),
                "Flip wide back content", new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative)));
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Did the tile change?", true, 3000));

            result.AddTest(CreateUnregisterChannelTest());

            result.AddTest(CreateRegisterChannelTest(true, "toast"));
            result.AddTest(CreateToastPushTest("World News in English!", null, null, true));
            result.AddTest(CreateUnregisterChannelTest(true, "wp8" + ZumoPushTestGlobals.NHToastTemplateName));
            result.AddTest(CreateRegisterChannelTest(true, "tile"));
            result.AddTest(CreateTilePushTest("Tile Template", new Uri(imageUrl), 3, "在普通话的世界新闻!", null, null, null, true));
            result.AddTest(CreateUnregisterChannelTest(true, "wp8" + ZumoPushTestGlobals.NHTileTemplateName));
            result.AddTest(CreateRegisterChannelTest(true, "raw"));
            result.AddTest(CreateRawPushTest("Nouvelles du monde en français!", true));
            result.AddTest(CreateUnregisterChannelTest(true, "wp8" + ZumoPushTestGlobals.NHRawTemplateName));

            return result;
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Login tests");
            result.AddTest(CreateLogoutTest());
            result.AddTest(CreateCRUDTest("w8Public", null, TablePermission.Public, false));
            result.AddTest(CreateCRUDTest("w8Application", null, TablePermission.Application, false));
            result.AddTest(CreateCRUDTest("w8Authenticated", null, TablePermission.User, false));
            result.AddTest(CreateCRUDTest("w8Admin", null, TablePermission.Admin, false));

            Dictionary<MobileServiceAuthenticationProvider, bool> providersWithRecycledTokenSupport;
            providersWithRecycledTokenSupport = new Dictionary<MobileServiceAuthenticationProvider, bool>
            {
                { MobileServiceAuthenticationProvider.Facebook, true },
                { MobileServiceAuthenticationProvider.Google, true },
                { MobileServiceAuthenticationProvider.MicrosoftAccount, false },
                { MobileServiceAuthenticationProvider.Twitter, false },
            };

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password four times."));

            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, false));
                result.AddTest(CreateCRUDTest("w8Application", provider.ToString(), TablePermission.Application, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
                result.AddTest(CreateCRUDTest("w8Admin", provider.ToString(), TablePermission.Admin, true));

                bool supportsTokenRecycling;
                if (providersWithRecycledTokenSupport.TryGetValue(provider, out supportsTokenRecycling) && supportsTokenRecycling)
                {
                    result.AddTest(CreateLogoutTest());
                    result.AddTest(CreateClientSideLoginTest(provider));
                    result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
                }
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password four times?", true));

            //result.AddTest(CreateLogoutTest());
            //result.AddTest(CreateLiveSDKLoginTest());
            //result.AddTest(CreateCRUDTest("w8Authenticated", "Microsoft via Live SDK", TablePermission.User, true));

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username anymore, and in some even the password should also not be required."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest("w8Authenticated", provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false));

            return result;
        }
Ejemplo n.º 13
0
        private async void btnRunSelected_Click_1(object sender, RoutedEventArgs e)
        {
            var items = this.lstTests.SelectedItems;
            if (items.Count == 0)
            {
                await Alert("Error", "No tests selected");
            }
            else
            {
                ZumoTestGroup partialGroup = new ZumoTestGroup("Partial test group");
                foreach (ListViewForTest test in items)
                {
                    partialGroup.AddTest(test.Test);
                }

                await this.RunTestGroup(partialGroup);
            }
        }
Ejemplo n.º 14
0
        private async Task RunTestGroup(ZumoTestGroup testGroup)
        {
            var appUrl = this.txtAppUrl.Text;
            var appKey = this.txtAppKey.Text;

            string error = null;
            try
            {
                ZumoTestGlobals.Instance.InitializeClient(appUrl, appKey);
            }
            catch (Exception ex)
            {
                error = string.Format(CultureInfo.InvariantCulture, "{0}", ex);
            }

            if (error != null)
            {
                await Alert("Error initializing client", error);
            }
            else
            {
                try
                {
                    await testGroup.Run();
                }
                catch (Exception ex)
                {
                    error = string.Format(CultureInfo.InvariantCulture, "Unhandled exception: {0}", ex);
                }

                if (error != null)
                {
                    await Alert("Error", error);
                }
                else
                {
                    // Saving app info for future runs
                    var savedAppInfo = await AppInfoRepository.Instance.GetSavedAppInfo();
                    if (savedAppInfo.LastService == null || savedAppInfo.LastService.AppUrl != appUrl || savedAppInfo.LastService.AppKey != appKey)
                    {
                        if (savedAppInfo.LastService == null)
                        {
                            savedAppInfo.LastService = new MobileServiceInfo();
                        }

                        savedAppInfo.LastService.AppKey = appKey;
                        savedAppInfo.LastService.AppUrl = appUrl;
                        await AppInfoRepository.Instance.SaveAppInfo(savedAppInfo);
                    }
                }
            }
        }
Ejemplo n.º 15
0
        private async Task RunTestGroup(ZumoTestGroup testGroup)
        {
            var appUrl = this.txtAppUrl.Text;
            var appKey = this.txtAppKey.Text;

            await SaveAppInfo();

            string error = null;
            try
            {
                ZumoTestGlobals.Instance.InitializeClient(appUrl, appKey);
            }
            catch (Exception ex)
            {
                error = string.Format(CultureInfo.InvariantCulture, "{0}", ex);
            }

            if (error != null)
            {
                MessageBox.Show(error, "Error initializing client", MessageBoxButton.OK);
            }
            else
            {
                try
                {
                    await testGroup.Run();
                }
                catch (Exception ex)
                {
                    error = string.Format(CultureInfo.InvariantCulture, "Unhandled exception: {0}", ex);
                }

                if (error != null)
                {
                    MessageBox.Show(error, "Error", MessageBoxButton.OK);
                }
                else
                {
                    int passed = this.currentGroup.AllTests.Count(t => t.Status == TestStatus.Passed);
                    string message = string.Format(CultureInfo.InvariantCulture, "Passed {0} of {1} tests", passed, this.currentGroup.AllTests.Count());
                    MessageBox.Show(message, "Test group finished", MessageBoxButton.OK);
                    // Saving app info for future runs
                    // TODO: implement saving
                }
            }
        }
Ejemplo n.º 16
0
 private void SwapPanels(bool showTestGroups)
 {
     this.appBtnBack.IsEnabled = !showTestGroups;
     this.appBtnReset.IsEnabled = !showTestGroups;
     this.pnlGroups.Visibility = showTestGroups ? Visibility.Visible : Visibility.Collapsed;
     this.grdTests.Visibility = showTestGroups ? Visibility.Collapsed : Visibility.Visible;
     if (showTestGroups)
     {
         this.currentGroup = null;
     }
 }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Login tests");
            result.AddTest(CreateLogoutTest());
            result.AddTest(CreateCRUDTest(TablePublicPermission, null, TablePermission.Public, false));
            result.AddTest(CreateCRUDTest(TableApplicationPermission, null, TablePermission.Application, false));
            result.AddTest(CreateCRUDTest(TableUserPermission, null, TablePermission.User, false));
            result.AddTest(CreateCRUDTest(TableAdminPermission, null, TablePermission.Admin, false));

            int indexOfTestsWithAuthentication = result.AllTests.Count();

            Dictionary<MobileServiceAuthenticationProvider, bool> providersWithRecycledTokenSupport;
            providersWithRecycledTokenSupport = new Dictionary<MobileServiceAuthenticationProvider, bool>
            {
                { MobileServiceAuthenticationProvider.Facebook, true },
                { MobileServiceAuthenticationProvider.Google, false },   // Known bug - Drop login via Google token until Google client flow is reintroduced
                { MobileServiceAuthenticationProvider.MicrosoftAccount, false },
                { MobileServiceAuthenticationProvider.Twitter, false },
                { MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory, false }
            };

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password five times."));
#endif

            foreach (MobileServiceAuthenticationProvider provider in Util.EnumGetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
#if !WINDOWS_PHONE
                result.AddTest(CreateLoginTest(provider, false));
#else
                result.AddTest(CreateLoginTest(provider));
#endif
                result.AddTest(CreateCRUDTest(TableApplicationPermission, provider.ToString(), TablePermission.Application, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true));
                result.AddTest(CreateCRUDTest(TableAdminPermission, provider.ToString(), TablePermission.Admin, true));

                bool supportsTokenRecycling;
                if (providersWithRecycledTokenSupport.TryGetValue(provider, out supportsTokenRecycling) && supportsTokenRecycling)
                {
                    result.AddTest(CreateLogoutTest());
                    result.AddTest(CreateClientSideLoginTest(provider));
                    result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true));
                }
            }

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password five times?", true));
#endif

            result.AddTest(CreateLogoutTest());

#if WINDOWS_PHONE && !WP75
            result.AddTest(ZumoTestCommon.CreateInputTest("Enter Live App Client ID", testPropertyBag, ClientIdKeyName));
#endif

#if !WP75
            result.AddTest(CreateLiveSDKLoginTest());
            result.AddTest(CreateCRUDTest(TableUserPermission, MicrosoftViaLiveSDK, TablePermission.User, true));
#endif

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount)
                {
                    // Known issue - SSO with MS account will not work if Live SDK is also used
                    continue;
                }

                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true));
            }

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username or password anymore*."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount)
                {
                    // Known issue - SSO with MS account will not work if Live SDK is also used
                    continue;
                }

                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, userIsAuthenticated: true, usingSingleSignOnOrToken: true));
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false));
#endif

            foreach (var test in result.AllTests.Skip(indexOfTestsWithAuthentication))
            {
                test.CanRunUnattended = false;
            }

            // Clean-up any logged in user
            result.AddTest(CreateLogoutTest());

            return result;
        }
        private async Task RunTestGroup(ZumoTestGroup testGroup)
        {
            var clientInitialized = await InitializeClient();
            if (!clientInitialized)
            {
                return;
            }

            string error = null;
            try
            {
                await testGroup.Run();
            }
            catch (Exception ex)
            {
                error = string.Format(CultureInfo.InvariantCulture, "Unhandled exception: {0}", ex);
            }

            if (error != null)
            {
                await Alert("Error", error);
            }
        }
        private async Task RunTestGroup(ZumoTestGroup testGroup)
        {
            var clientInitialized = await InitializeClient();
            if (!clientInitialized)
            {
                return;
            }

            string error = null;
            try
            {
                await testGroup.Run();
            }
            catch (Exception ex)
            {
                error = string.Format(CultureInfo.InvariantCulture, "Unhandled exception: {0}", ex);
            }

            if (error != null)
            {
                await Util.MessageBox(error, "Error");
            }

            if (testGroup.Name.StartsWith(TestStore.AllTestsGroupName) && !string.IsNullOrEmpty(this.txtUploadLogsUrl.Text))
            {
                // Upload logs automatically if running all tests and write the the logs location to done.txt
                var logsUploadedURL = await Util.UploadLogs(this.txtUploadLogsUrl.Text, string.Join("\n", testGroup.GetLogs()), "winstorecs", true);
                StorageFolder storageFolder = KnownFolders.PicturesLibrary;
                StorageFile logsUploadedFile = await storageFolder.CreateFileAsync(ZumoTestGlobals.LogsLocationFile, CreationCollisionOption.ReplaceExisting);
                await FileIO.WriteTextAsync(logsUploadedFile, logsUploadedURL);
            }
        }
 public ListViewForTestGroup(int index, ZumoTestGroup testGroup)
 {
     this.index = index;
     this.testGroup = testGroup;
 }
        private async Task RunTestGroup(ZumoTestGroup testGroup)
        {
            var appUrl = this.txtAppUrl.Text;
            var appKey = this.txtAppKey.Text;

            await SaveAppInfo();

            string error = null;
            try
            {
                ZumoTestGlobals.Instance.InitializeClient(appUrl, appKey);
            }
            catch (Exception ex)
            {
                error = string.Format(CultureInfo.InvariantCulture, "{0}", ex);
            }

            if (error != null)
            {
                MessageBox.Show(error, "Error initializing client", MessageBoxButton.OK);
            }
            else
            {
                try
                {
                    await testGroup.Run();
                }
                catch (Exception ex)
                {
                    error = string.Format(CultureInfo.InvariantCulture, "Unhandled exception: {0}", ex);
                }

                if (error != null)
                {
                    MessageBox.Show(error, "Error", MessageBoxButton.OK);
                }
                else
                {
                    if (testGroup.Name.StartsWith(TestStore.AllTestsGroupName) && !string.IsNullOrEmpty(this.txtUploadUrl.Text))
                    {
                        // Upload logs automatically if running all tests
                        await Util.UploadLogs(this.txtUploadUrl.Text, string.Join("\n", testGroup.GetLogs()), "wp8", true);
                    }
                    else
                    {
                        int passed = this.currentGroup.AllTests.Count(t => t.Status == TestStatus.Passed);
                        string message = string.Format(CultureInfo.InvariantCulture, "Passed {0} of {1} tests", passed, this.currentGroup.AllTests.Count());
                        MessageBox.Show(message, "Test group finished", MessageBoxButton.OK);
                    }
                }
            }
        }
        public static ZumoTestGroup CreateTests()
        {
            ZumoTestGroup result = new ZumoTestGroup("Login tests");
            result.AddTest(CreateLogoutTest());
            result.AddTest(CreateCRUDTest(TablePublicPermission, null, TablePermission.Public, false));
            result.AddTest(CreateCRUDTest(TableApplicationPermission, null, TablePermission.Application, false));
            result.AddTest(CreateCRUDTest(TableUserPermission, null, TablePermission.User, false));
            result.AddTest(CreateCRUDTest(TableAdminPermission, null, TablePermission.Admin, false));

            Dictionary<MobileServiceAuthenticationProvider, bool> providersWithRecycledTokenSupport;
            providersWithRecycledTokenSupport = new Dictionary<MobileServiceAuthenticationProvider, bool>
            {
                { MobileServiceAuthenticationProvider.Facebook, true },
                { MobileServiceAuthenticationProvider.Google, true },
                { MobileServiceAuthenticationProvider.MicrosoftAccount, false },
                { MobileServiceAuthenticationProvider.Twitter, false },
            };

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("In the next few tests you will be prompted for username / password four times."));
#endif

            foreach (MobileServiceAuthenticationProvider provider in Util.EnumGetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                result.AddTest(CreateLogoutTest());
#if !WINDOWS_PHONE
                result.AddTest(CreateLoginTest(provider, false));
#else
                result.AddTest(CreateLoginTest(provider));
#endif
                result.AddTest(CreateCRUDTest(TableApplicationPermission, provider.ToString(), TablePermission.Application, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true));
                result.AddTest(CreateCRUDTest(TableAdminPermission, provider.ToString(), TablePermission.Admin, true));

                bool supportsTokenRecycling;
                if (providersWithRecycledTokenSupport.TryGetValue(provider, out supportsTokenRecycling) && supportsTokenRecycling)
                {
                    result.AddTest(CreateLogoutTest());
                    result.AddTest(CreateClientSideLoginTest(provider));
                    result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true));
                }
            }

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for username / password four times?", true));
#endif

            result.AddTest(CreateLogoutTest());

#if WINDOWS_PHONE && !WP75
            result.AddTest(ZumoTestCommon.CreateInputTest("Enter Live App Client ID", testPropertyBag, ClientIdKeyName));
#endif

#if !WP75
            result.AddTest(CreateLiveSDKLoginTest());
            result.AddTest(CreateCRUDTest(TableUserPermission, "Microsoft via Live SDK", TablePermission.User, true));
#endif

#if !WINDOWS_PHONE
            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("We'll log in again; you may or may not be asked for password in the next few moments."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount)
                {
                    // Known issue - SSO with MS account will not work if Live SDK is also used
                    continue;
                }

                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateTestWithSingleAlert("Now we'll continue running the tests, but you *should not be prompted for the username or password anymore*."));
            foreach (MobileServiceAuthenticationProvider provider in Enum.GetValues(typeof(MobileServiceAuthenticationProvider)))
            {
                if (provider == MobileServiceAuthenticationProvider.MicrosoftAccount)
                {
                    // Known issue - SSO with MS account will not work if Live SDK is also used
                    continue;
                }

                result.AddTest(CreateLogoutTest());
                result.AddTest(CreateLoginTest(provider, true));
                result.AddTest(CreateCRUDTest(TableUserPermission, provider.ToString(), TablePermission.User, true));
            }

            result.AddTest(ZumoTestCommon.CreateYesNoTest("Were you prompted for the username in any of the providers?", false));
#endif

            return result;
        }