void MainPage_Loaded(object sender, RoutedEventArgs e) { // Setup the groups data source _groups = new ObservableCollection <GroupDescription>(); E2ETests.ItemsSource = _groups; string storageBlobContainerUrl = ReadFile(E2E_TEST_BLOB_STORAGE_CONTAINER); string storageSasTokenBase64Encoded = ReadFile(E2E_TEST_BLOB_STORAGE_CONTAINER_SAS_TOKEN); if (string.IsNullOrEmpty(storageSasTokenBase64Encoded)) { // Manual testing txtRuntimeUri.Text = ""; // Set the default URI here txtTags.Text = ""; // Set the default tags here } else { // Automated testing string storageSasToken = TestHarness.DecodeBase64String(storageSasTokenBase64Encoded); DownloadInputFromStorageAsync(storageBlobContainerUrl, storageSasToken, INPUT_PARAM_FILE).ContinueWith(task => { var testConfig = task.Result; App.Harness.SetAutoConfig(testConfig); Deployment.Current.Dispatcher.BeginInvoke(() => { txtRuntimeUri.Text = App.Harness.Settings.Custom["MobileServiceRuntimeUrl"]; txtTags.Text = App.Harness.Settings.TagExpression; ExecuteE2ETests(null, null); }); }); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); string storageBlobContainerUrl = ReadFile(E2E_TEST_BLOB_STORAGE_CONTAINER); string storageSasTokenBase64Encoded = ReadFile(E2E_TEST_BLOB_STORAGE_CONTAINER_SAS_TOKEN); if (!String.IsNullOrEmpty(storageSasTokenBase64Encoded)) { // Automated testing string storageSasToken = TestHarness.DecodeBase64String(storageSasTokenBase64Encoded); var testConfig = DownloadInputFromStorage(storageBlobContainerUrl, storageSasToken, INPUT_PARAM_FILE); App.Harness.SetAutoConfig(testConfig); rootFrame.Navigate(typeof(TestPage), e.Arguments); } }
/// <summary> /// Initializes a new instance of the TestPage. /// </summary> public TestPage() { InitializeComponent(); // Setup the groups data source _groups = new ObservableCollection <GroupDescription>(); _tests = new ObservableCollection <TestDescription>(); CollectionViewSource src = (CollectionViewSource)this.Resources["cvsTests"]; src.Source = _tests; // Start a test run App.Harness.Reporter = this; if (App.Harness.Settings.Custom != null && App.Harness.Settings.Custom.ContainsKey("TestFrameworkStorageContainerSasToken")) { App.Harness.Settings.Custom["TestFrameworkStorageContainerSasToken"] = TestHarness.DecodeBase64String(App.Harness.Settings.Custom["TestFrameworkStorageContainerSasToken"]); } Task.Factory.StartNew(() => App.Harness.RunAsync()); }