Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio Version 16\r
-VisualStudioVersion = 16.0.29519.181\r
+# Visual Studio Version 17\r
+VisualStudioVersion = 17.6.33829.357\r
MinimumVisualStudioVersion = 10.0.40219.1\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Tests", "Tizen.Applications.Tests\Tizen.Applications.Tests.csproj", "{F0D122C4-48E1-4037-A97D-F7BC75365C81}"\r
EndProject\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
EndProject\r
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}"\r
-EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Usb.Tests", "Tizen.Usb.Tests\Tizen.Usb.Tests.csproj", "{E62E2556-106D-4559-9F81-7E60F2A575BA}"\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Usb.Manual.Tests", "Tizen.Usb.Manual.Tests\Tizen.Usb.Manual.Tests.csproj", "{840C727C-876C-477F-92ED-5AA8473AB3FF}"\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.MediaVision.ImageClassifier.Tests", "Tizen.MediaVision.ImageClassifier.Tests\Tizen.MediaVision.ImageClassifier.Tests.csproj", "{9B315B92-8187-41D3-A909-EC9C88C55BBE}"\r
EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{9578A8A4-0500-44FB-BB71-D56A93E5B514}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewAutoTemplate", "NewTemplate\NewAutoTemplate\NewAutoTemplate.csproj", "{6261B915-0F97-424C-91FA-B494EA9A2033}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewManualTemplate", "NewTemplate\NewManualTemplate\NewManualTemplate.csproj", "{FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}"\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
Debug|Any CPU = Debug|Any CPU\r
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU\r
{E62E2556-106D-4559-9F81-7E60F2A575BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{E62E2556-106D-4559-9F81-7E60F2A575BA}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{E62E2556-106D-4559-9F81-7E60F2A575BA}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
{9B315B92-8187-41D3-A909-EC9C88C55BBE}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
{9B315B92-8187-41D3-A909-EC9C88C55BBE}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{9B315B92-8187-41D3-A909-EC9C88C55BBE}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {9578A8A4-0500-44FB-BB71-D56A93E5B514}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {6261B915-0F97-424C-91FA-B494EA9A2033}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FE12333F-1B32-4F2F-9F4C-2F1B1AFCDA43}.Release|Any CPU.Build.0 = Release|Any CPU\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
--- /dev/null
+
+
+using NUnitLite.TUnit;
+using System.Diagnostics;
+using System.Threading;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.Auto.NewTemplate
+{
+ public class App : NUIApplication
+ {
+
+ private View _view;
+ private Window _window;
+ private Layer _layer;
+ private const string TextTitle = "Tizen Template Auto TCT \n\n";
+ private const float TextSize = 30.0f;
+ private const string TAG = "Tizen Auto Tests";
+
+
+ public App() : base()
+ {
+ Tizen.Log.Debug(TAG, "Call App()");
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ _window = GetDefaultWindow();
+ _window.BackgroundColor = Color.Green;
+
+ _view = new View()
+ {
+ Size = new Size(100, 100),
+ BackgroundColor = Color.White,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = ParentOrigin.Center,
+ PivotPoint = PivotPoint.Center,
+ };
+
+ _layer = _window.GetDefaultLayer();
+ _layer.Add(_view);
+
+ var mainTitle = new TextLabel()
+ {
+ MultiLine = true,
+ Text = TextTitle + $"Process ID: {Process.GetCurrentProcess().Id}\nThread ID: {Thread.CurrentThread.ManagedThreadId}\n",
+ PixelSize = TextSize,
+ BackgroundColor = Color.Cyan,
+ Size2D = new Size2D(_window.WindowSize.Width / 2, _window.WindowSize.Height / 2),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = ParentOrigin.Center,
+ PivotPoint = PivotPoint.Center,
+ };
+ _view.Add(mainTitle);
+ }
+
+ protected override void OnResume()
+ {
+ base.OnResume();
+ var tRunner = new TRunner();
+ tRunner.LoadTestsuite();
+ tRunner.Execute();
+ }
+
+ protected override void OnPause()
+ {
+ base.OnPause();
+ }
+
+ protected override void OnTerminate()
+ {
+ base.OnTerminate();
+ Exit();
+ }
+
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <TargetFramework>net6.0-tizen8.0</TargetFramework>
+ <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <Import Project="..\..\Common\dependencies.props" />
+
+ <!-- Include Nuget Package for Xamarin building -->
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)" />
+ <PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)" />
+ <PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\nunit.framework\nunit.framework.csproj" />
+ <ProjectReference Include="..\..\nunitlite\nunitlite.csproj" />
+ </ItemGroup>
+</Project>
+
--- /dev/null
+/*
+* Copyright (c) 2017 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using NUnitLite.TUnit;
+using NUnit.Framework.Interfaces;
+using NUnit.Framework.TUnit;
+using System.Reflection;
+using Tizen.NUI.Components;
+using Tizen.Applications;
+using Tizen.NUI;
+using System.Threading.Tasks;
+using NUnit.Framework.Internal;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.Manual.NewTemplate
+{
+ public class ManualTemplate
+ {
+ private List<string> _listTcsName;
+ private List<ItemData> _listItem;
+ private TSettings _tSettings;
+ private TRunner _tRunner;
+ private List<string> _listNotPass;
+ private ToastMessage _toastMessage;
+ private float _pointSize = 20.0f;
+
+ private List<TestcaseInfo> _listTcsInfo;
+ private List<string> _currentTCInfo;
+
+ private static ManualTemplate _instance;
+ private static Object _lockObject = new object();
+
+ private View _viewInit, _viewDetail, _viewCase, _viewPageMainTest;
+ private FlexibleView _flvInit;
+ private ViewAdapter _viewAdapter;
+ private ScrollableBase _scrollableBase;
+ private TableView _tableViewInit, _tableViewDetail;
+ private View _viewContainerButton1, _viewContainerButton2, _viewContentTest;
+ private View _viewSummary, _viewInitButton;
+ private Button _btnInitRun, _btnDone, _btnBackViewTest;
+ private Button _btnPass, _btnFail, _btnBlock, _btnDetailRun;
+ private Button _btnHome, _btnPrevious, _btnNext;
+ private TextLabel _txtNotRun;
+ private TextLabel _txtSummary;
+
+ private int _currentTCNum = 0;
+
+ private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute";
+ private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";
+ private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";
+
+
+ public static ManualTemplate GetInstance()
+ {
+ lock (_lockObject)
+ {
+ if (_instance == null)
+ {
+ _instance = new ManualTemplate();
+ }
+ }
+ return _instance;
+ }
+
+ private ManualTemplate()
+ {
+ InitializeView();
+ }
+ public void InitializeView()
+ {
+ FocusManager.Instance.FocusIndicator = new View()
+ {
+ PositionUsesPivotPoint = true,
+ PivotPoint = new Position(0, 0, 0),
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BorderlineColor = Color.Orange,
+ BorderlineWidth = 4.0f,
+ BorderlineOffset = -1f,
+ BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.2f),
+ };
+
+ Window.Instance.BackgroundColor = Color.White;
+
+ _toastMessage = new ToastMessage();
+ _pointSize = ManualTest.GetPointSize();
+ RunType.Value = RunType.MANUAL;
+ _tRunner = new TRunner();
+ _tRunner.LoadTestsuite();
+ _tRunner.SingleTestDone += OnSingleTestDone;
+ _listTcsName = new List<string>();
+ _listItem = new List<ItemData>();
+ _listNotPass = TSettings.GetInstance().GetNotPassListManual();
+ int count = 0;
+ if (_listNotPass.Count == 0)
+ {
+ foreach (KeyValuePair<string, ITest> pair in _tRunner.GetTestList())
+ {
+ count++;
+ _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN });
+ _listTcsName.Add(pair.Key);
+ }
+ }
+ else
+ {
+ foreach (var tc in _listNotPass)
+ {
+ count++;
+ _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN });
+ _listTcsName.Add(tc);
+ }
+ }
+
+ _tSettings = TSettings.GetInstance();
+ _tSettings.IsManual = true;
+
+ InitData();
+ _viewCase = new View();
+ _viewSummary = new View {
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.05f),
+ BorderlineWidth = 2,
+ BackgroundColor = Color.White,
+ BorderlineColor = new Color("#D1D1D1"),
+ BoxShadow = new Shadow(5f, Color.DarkGray, new Vector2(2, 2), null),
+ };
+
+ Window.Instance.GetDefaultLayer().Add(_viewSummary);
+
+ _txtSummary = new TextLabel();
+ _txtSummary.PointSize = 15.0f;
+ _txtSummary.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.05f);
+ _txtSummary.ParentOrigin = Position.ParentOriginTopLeft;
+ _txtSummary.PivotPoint = PivotPoint.TopLeft;
+ _txtSummary.HorizontalAlignment = HorizontalAlignment.Center;
+ _txtSummary.VerticalAlignment = VerticalAlignment.Center;
+ _txtSummary.TextColor = Color.Black;
+ _viewSummary.Add(_txtSummary);
+ SetSummaryResult();
+
+ _viewInit = new View();
+ _viewInit.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.9f);
+ _viewInit.Position = new Position(0.0f, (int)(Window.Instance.Size.Height * 0.05f), 0.0f);
+ _viewInit.ParentOrigin = Position.ParentOriginTopLeft;
+ _viewInit.PivotPoint = PivotPoint.TopLeft;
+ InitializeFirstPage();
+ _viewInit.Show();
+ Window.Instance.GetDefaultLayer().Add(_viewInit);
+
+ _viewDetail = new View();
+ _viewDetail.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height*0.9f);
+ _viewDetail.Position = new Position(0.0f, (int)(Window.Instance.Size.Height * 0.05f), 0.0f);
+ _viewDetail.ParentOrigin = Position.ParentOriginTopLeft;
+ _viewDetail.PivotPoint = PivotPoint.TopLeft;
+ DetailView();
+ _viewDetail.Hide();
+ Window.Instance.GetDefaultLayer().Add(_viewDetail);
+ // Set viewPageMainTest
+ _viewPageMainTest = new View();
+ CreateTestPageView();
+ _viewPageMainTest.Hide();
+ Window.Instance.GetDefaultLayer().Add(_viewPageMainTest);
+ //FocusManager.Instance.SetCurrentFocusView(_btnInitRun);
+ }
+
+ public void LockUIButton()
+ {
+ _btnDetailRun.IsEnabled = false;
+ }
+
+ public void UnlockUIButton()
+ {
+ _btnDetailRun.IsEnabled = true;
+ }
+
+ void SetCommonButtonStyle(Button button, string text)
+ {
+ if (!button) return;
+ button.Text = text;
+ button.Feedback = false;
+ button.PointSize = _pointSize+1;
+ float buttonWidth = ManualTest.IsMobile() ? Window.Instance.Size.Width * 0.18f : Window.Instance.Size.Width * 0.06f;
+ if (ManualTest.IsEmulator())
+ {
+ buttonWidth = Window.Instance.Size.Width * 0.16f;
+ }
+ button.Size = new Size(buttonWidth, Window.Instance.Size.Height * 0.046f);
+
+ button.TextColorSelector = new ColorSelector
+ {
+ Normal = Color.White,
+ Pressed = Color.White,
+ Selected = Color.White,
+ Disabled = Color.White,
+ };
+
+ }
+
+ void InitializeFirstPage()
+ {
+ _btnDone = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnDone, "Done");
+ _btnDone.Clicked += (obj, ee) =>
+ {
+ TSettings.GetInstance().SubmitManualResult();
+ };
+
+ _btnInitRun = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnInitRun, "Run");
+ _btnInitRun.Clicked += (obj, ee) =>
+ {
+ _currentTCNum = 0;
+ _viewInit.Hide();
+ _viewCase.Hide();
+ UpdateDetailPage();
+ _viewDetail.Show();
+ //FocusManager.Instance.SetCurrentFocusView(_btnDetailRun);
+ };
+ //_btnDone.RightFocusableView = _btnInitRun;
+ //_btnInitRun.LeftFocusableView = _btnDone;
+
+ _flvInit = new FlexibleView {
+
+ };
+ _flvInit.Position = new Position(0, Window.Instance.Size.Height * 0.1f);
+ _flvInit.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.75f);
+ _viewAdapter = new ViewAdapter(_listTcsName, _listItem);
+ _flvInit.SetAdapter(_viewAdapter);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
+ _flvInit.SetLayoutManager(layoutManager);
+ _flvInit.FocusedItemIndex = 0;
+ _flvInit.Focusable = true;
+ _flvInit.ItemClicked += (obj, e) =>
+ {
+ Button button = e.ClickedView.ItemView as Button;
+ if (button)
+ {
+ _currentTCNum = int.Parse(button.Name);
+ _viewInit.Hide();
+ UpdateDetailPage();
+ _viewCase.Hide();
+ _viewDetail.Show();
+ //FocusManager.Instance.SetCurrentFocusView(_btnDetailRun);
+ }
+ };
+ _flvInit.FocusGained += (obj, e) =>
+ {
+ FlexibleViewViewHolder holder = _flvInit?.FindViewHolderForAdapterPosition(0);
+ if (holder != null && holder.ItemView != null)
+ {
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);
+ _currentTCNum = 0;
+ }
+ };
+ _flvInit.FocusLost += (obj, e) =>
+ {
+ _currentTCNum = 0;
+ };
+ _flvInit.KeyEvent += (obj, e) =>
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Up")
+ {
+ if (_currentTCNum == 0)
+ {
+ //FocusManager.Instance.SetCurrentFocusView(_btnInitRun);
+ }
+ else
+ {
+ FlexibleViewViewHolder holder = _flvInit?.FindViewHolderForAdapterPosition(_currentTCNum - 1);
+ if (holder != null && holder.ItemView != null)
+ {
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);
+ _currentTCNum--;
+ }
+ }
+ }
+ else if (e.Key.KeyPressedName == "Down")
+ {
+ if (_currentTCNum == _flvInit.ChildCount - 1)
+ {
+ _currentTCNum = 0;
+ }
+ else
+ {
+ _currentTCNum++;
+ }
+ FlexibleViewViewHolder holder = _flvInit?.FindViewHolderForAdapterPosition(_currentTCNum);
+ if (holder != null && holder.ItemView != null)
+ {
+ FocusManager.Instance.SetCurrentFocusView(holder.ItemView);
+ }
+ }
+ else if (e.Key.KeyPressedName == "Return")
+ {
+ _viewInit.Hide();
+ UpdateDetailPage();
+ _viewCase.Hide();
+ _viewDetail.Show();
+ //FocusManager.Instance.SetCurrentFocusView(_btnDetailRun);
+ }
+ }
+ return true;
+ };
+
+ _tableViewInit = new TableView
+ {
+ Rows = 2,
+ Columns = 5,
+ ParentOrigin = new Position(0, _viewSummary.Size.Height)
+
+ };
+ _viewInitButton = new View();
+ var layoutViewInitButton = new FlexLayout()
+ {
+ Direction = FlexLayout.FlexDirection.Row,
+ Justification = FlexLayout.FlexJustification.SpaceBetween,
+ WrapType = FlexLayout.FlexWrapType.Wrap,
+ };
+ _viewInitButton.Layout = layoutViewInitButton;
+ _viewInitButton.PivotPoint = PivotPoint.Center;
+ _viewInitButton.Position = new Position(Window.Instance.Size.Width * 0.25f, Window.Instance.Size.Height * 0.015f, 0);
+ _viewInitButton.Size = new Size(Window.Instance.Size.Width*0.5f, Window.Instance.Size.Height * 0.05f);
+ _viewInitButton.Focusable = true;
+
+ _viewInitButton.Add(_btnInitRun);
+ _viewInitButton.Add(_btnDone);
+ _btnInitRun.DownFocusableView = _flvInit;
+ _btnDone.DownFocusableView = _flvInit;
+ _viewInit.Add(_viewInitButton);
+ _viewInit.Add(_flvInit);
+ }
+
+ void UpdateDetailPage()
+ {
+ UpdateCurrentTCInfo();
+ CreateTestCase();
+ }
+
+ void DetailView()
+ {
+ _scrollableBase = new ScrollableBase
+ {
+ Size = new Size(Window.Instance.Size.Width * 0.9739f, Window.Instance.Size.Height * 0.6629f),
+ ScrollingDirection = ScrollableBase.Direction.Vertical,
+ BorderlineWidth = 2,
+ };
+ _tableViewDetail = new TableView(23, 1);
+ _tableViewDetail.Focusable = true;
+ _tableViewDetail.Size = new Size(Window.Instance.Size.Width * 0.9739f, Window.Instance.Size.Height * 0.9f);
+ _tableViewDetail.ParentOrigin = Position.ParentOriginTopLeft;
+ _tableViewDetail.PivotPoint = PivotPoint.TopLeft;
+ _tableViewDetail.Position = new Position(0.0f, 0.0f, 0.0f);
+ CreateDetailList();
+ _scrollableBase.Add(_tableViewDetail);
+ _scrollableBase.BorderlineWidth = 1;
+ _scrollableBase.BorderlineColor = new Color("#edeff0");
+ _scrollableBase.ParentOrigin = new Position(0f,0f);
+ _viewDetail.Add(_scrollableBase);
+
+
+ _viewContainerButton1 = new View {
+ BorderlineWidth = 2,
+ BorderlineColor = new Color("#edeff0"),
+ };
+ _viewContainerButton1.PivotPoint = PivotPoint.TopLeft;
+ _viewContainerButton1.ParentOrigin = Position.ParentOriginTopLeft;
+ _viewContainerButton1.Position = new Position(0, Window.Instance.Size.Height * 0.76f, 0);
+ _viewContainerButton1.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.2f);
+ _viewContainerButton1.Focusable = true;
+
+ _viewContainerButton2 = new View();
+ _viewContainerButton2.PivotPoint = PivotPoint.TopLeft;
+ _viewContainerButton2.ParentOrigin = Position.ParentOriginTopLeft;
+ _viewContainerButton2.Position = new Position(0, Window.Instance.Size.Height * 0.84f, 0);
+ _viewContainerButton2.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.1f);
+ _viewContainerButton2.Focusable = true;
+
+ var flexlayout = new FlexLayout() {
+ Direction = FlexLayout.FlexDirection.Row,
+ Justification = FlexLayout.FlexJustification.SpaceBetween,
+ WrapType = FlexLayout.FlexWrapType.Wrap,
+ };
+ _viewContainerButton1.Layout = flexlayout;
+ var flexlayout2 = new FlexLayout();
+ flexlayout2.Direction = FlexLayout.FlexDirection.Row;
+ flexlayout2.Justification = FlexLayout.FlexJustification.SpaceBetween;
+ _viewContainerButton2.Layout = flexlayout2;
+ CreateButtons();
+ _viewDetail.Add(_viewCase);
+ _viewDetail.Add(_viewContainerButton1);
+ _viewDetail.Add(_viewContainerButton2);
+ }
+
+ void CreateTestCase()
+ {
+ if (_tableViewDetail != null && _scrollableBase != null)
+ {
+ _viewDetail.Remove(_scrollableBase);
+ _scrollableBase.Remove(_tableViewDetail);
+ _tableViewDetail.Dispose();
+ _tableViewDetail = null;
+ _scrollableBase.Dispose();
+ _scrollableBase = null;
+ }
+ _scrollableBase = new ScrollableBase
+ {
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.6629f),
+ ScrollingDirection = ScrollableBase.Direction.Vertical,
+ BorderlineWidth = 5,
+ BorderlineColor = new Color("#edeff0"),
+ BackgroundColor = new Color("#F4F5F7"),
+ };
+ _tableViewDetail = new TableView(10, 1);
+ _tableViewDetail.Focusable = true;
+ _tableViewDetail.Size = new Size(Window.Instance.Size.Width * 0.9739f, Window.Instance.Size.Height * 0.9f);
+ _tableViewDetail.ParentOrigin = Position.ParentOriginTopLeft;
+ _tableViewDetail.PivotPoint = PivotPoint.TopLeft;
+ _tableViewDetail.Position = new Position(0.0f, 0.0f, 0.0f);
+ CreateDetailList();
+ _scrollableBase.Add(_tableViewDetail);
+ _scrollableBase.ParentOrigin = new Position(0f, 0f);
+ _viewDetail.Add(_scrollableBase);
+ if (_txtNotRun)
+ {
+ _txtNotRun.Text = _listItem[_currentTCNum].Result;
+ }
+ }
+
+ void CreateButtons()
+ {
+ _txtNotRun = new TextLabel
+ {
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ PointSize = _pointSize,
+ Text = "Not Run",
+ Margin = new Extents((ushort)Math.Round(Window.Instance.Size.Width * 0.05),
+ (ushort)Math.Round(Window.Instance.Size.Width * 0.05), 10, 10),
+ };
+ //_txtNotRun.ParentOrigin = new Position(0.12f, 0);
+
+ float txtWidth = ManualTest.IsMobile() ? Window.Instance.Size.Width * 0.18f : Window.Instance.Size.Width * 0.06f;
+ if (ManualTest.IsEmulator())
+ {
+ txtWidth = Window.Instance.Size.Width * 0.16f;
+ }
+ _txtNotRun.Size = new Size(txtWidth, Window.Instance.Size.Height * 0.046f);
+
+ _btnPass = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnPass, "Pass");
+ _btnPass.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.PASS;
+ ManualTest.Confirm();
+ }
+ Tizen.Log.Fatal("TBT", "Pass Button clicked!");
+ };
+
+ _btnFail = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnFail, "Fail");
+ _btnFail.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.FAIL;
+ ManualTest.Confirm();
+ }
+ Tizen.Log.Fatal("TBT", "Fail Button clicked!");
+ };
+
+ _btnBlock = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnBlock, "Block");
+ _btnBlock.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.BLOCK;
+ ManualTest.Confirm();
+ }
+ };
+
+ _btnDetailRun = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnDetailRun, "Run");
+ _btnDetailRun.Clicked += (obj, ee) =>
+ {
+ LockUIButton();
+ ClearView();
+ _tSettings.Testcase_ID = _listTcsName[_currentTCNum];
+ _tSettings.TCResult = "";
+ _tRunner.Execute();
+ };
+
+ _btnHome = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnHome, "Home");
+ _btnHome.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ _viewDetail.Hide();
+ _viewInit.Show();
+ //FocusManager.Instance.SetCurrentFocusView(_btnInitRun);
+ }
+ };
+
+ _btnPrevious = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnPrevious, "<<");
+ _btnPrevious.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ if (_currentTCNum != 0)
+ {
+ _currentTCNum--;
+ _txtNotRun.Text = _listItem[_currentTCNum].Result;
+ ManualTest.Confirm();
+ UpdateDetailPage();
+ }
+ else if (_currentTCNum == 0)
+ {
+ _toastMessage.Message = "This is first testcase";
+ _toastMessage.Post();
+ }
+ }
+ };
+
+ _btnNext = new Button(ButtonStyleStandard);
+ SetCommonButtonStyle(_btnNext, ">>");
+ _btnNext.Clicked += (obj, ee) =>
+ {
+ ClearView();
+ if (!ManualTest.IsConfirmed())
+ {
+ _tSettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ if (_currentTCNum + 1 != ResultNumber.Total)
+ {
+ Tizen.Log.Fatal("NUI", "Print the [not run] CurrentTCNum::" + _currentTCNum);
+ _currentTCNum++;
+ _txtNotRun.Text = _listItem[_currentTCNum].Result;
+ _txtNotRun.TextColor = _listItem[_currentTCNum].ResultColor;
+ UpdateDetailPage();
+ }
+ else if (_currentTCNum + 1 == ResultNumber.Total)
+ {
+ _toastMessage.Message = "This is last testcase";
+ _toastMessage.Post();
+ }
+ };
+
+ _btnPass.RightFocusableView = _btnFail;
+ _btnPass.DownFocusableView = _btnHome;
+ _btnFail.LeftFocusableView = _btnPass;
+ _btnFail.RightFocusableView = _btnBlock;
+ _btnBlock.LeftFocusableView = _btnFail;
+ _btnBlock.RightFocusableView = _btnDetailRun;
+ _btnBlock.DownFocusableView = _btnPrevious;
+ _btnDetailRun.LeftFocusableView = _btnBlock;
+ _btnDetailRun.DownFocusableView = _btnNext;
+ _btnHome.UpFocusableView = _btnPass;
+ _btnHome.RightFocusableView = _btnPrevious;
+ _btnPrevious.UpFocusableView = _btnBlock;
+ _btnPrevious.LeftFocusableView = _btnHome;
+ _btnPrevious.RightFocusableView = _btnNext;
+ _btnNext.UpFocusableView = _btnDetailRun;
+ _btnNext.LeftFocusableView = _btnPrevious;
+
+ _viewContainerButton1.Add(_btnPass);
+ _viewContainerButton1.Add(_btnFail);
+ _viewContainerButton1.Add(_btnBlock);
+ _viewContainerButton1.Add(_btnDetailRun);
+ _viewContainerButton2.Add(_btnHome);
+ _viewContainerButton2.Add(_txtNotRun);
+ _viewContainerButton2.Add(_btnPrevious);
+ _viewContainerButton2.Add(_btnNext);
+
+ }
+
+ private bool OnKeyPressed(object source, View.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Down")
+ {
+ FocusManager.Instance.SetCurrentFocusView(_btnPass);
+ }
+ }
+ return false;
+ }
+
+ private bool OnRunnerKeyPressed(object source, View.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Up")
+ {
+ FocusManager.Instance.SetCurrentFocusView(_btnDone);
+ }
+ }
+ return false;
+ }
+
+ private bool OnDownButtonKeyPressed(object source, View.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Down")
+ {
+ FocusManager.Instance.SetCurrentFocusView(_btnInitRun);
+ }
+ }
+ return false;
+ }
+
+ private void ClearView()
+ {
+ if (_viewCase.IsOnWindow == true)
+ {
+ _viewDetail.Remove(_viewCase);
+ }
+ }
+
+ public void ClearTestCase(View view)
+ {
+ //FocusManager.Instance.SetCurrentFocusView(_btnDetailRun);
+ _viewDetail.Remove(view);
+ }
+
+ private void SetSummaryResult()
+ {
+ ResultNumber.NotRun = ResultNumber.Total - ResultNumber.Pass - ResultNumber.Fail - ResultNumber.Block;
+ _txtSummary.Text = "Total : " + ResultNumber.Total + ", Pass : " + ResultNumber.Pass + ", Fail : " + ResultNumber.Fail + ", Block : " + ResultNumber.Block + ", Not Run : " + ResultNumber.NotRun;
+ }
+
+ private void CreateDetailList()
+ {
+ int senNum = _currentTCInfo.Count;
+ for (int index = 0; index < senNum; index++)
+ {
+ TextLabel description = new TextLabel();
+ description.Size2D = new Size2D((int)(Window.Instance.Size.Width * 0.9895), (int)(Window.Instance.Size.Height * 0.0462));
+ description.PointSize = _pointSize;
+ description.Text = _currentTCInfo[(int)index];
+ description.MultiLine = true;
+ _tableViewDetail.AddChild(description, new TableView.CellPosition((uint)index, 0));
+ _tableViewDetail.SetCellAlignment(new TableView.CellPosition((uint)index, 0), (HorizontalAlignmentType) HorizontalAlignment.Begin, (VerticalAlignmentType) VerticalAlignment.Center);
+ _tableViewDetail.SetFixedHeight((uint)index, Window.Instance.Size.Height * 0.0462f);
+ _tableViewDetail.ParentOrigin = new Position(0.02f, 0.01f);
+
+
+ }
+ }
+
+ void InitData()
+ {
+ ResultNumber.Total = _listTcsName.Count;
+ ResultNumber.Pass = 0;
+ ResultNumber.Fail = 0;
+ ResultNumber.Block = 0;
+ _listTcsInfo = new List<TestcaseInfo>();
+ foreach (var testcaseItem in _listItem)
+ {
+ foreach (KeyValuePair<string, ITest> pair in _tRunner.GetTestList())
+ {
+ if (testcaseItem.TCName.Equals(pair.Key))
+ {
+ IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
+ List<string> preconditions = new List<string>();
+ preconditions.Add("Preconditions:");
+ List<string> steps = new List<string>();
+ steps.Add("Steps:");
+ List<string> postconditions = new List<string>();
+ postconditions.Add("Postconditions:\n");
+
+ while (customAttributes.MoveNext())
+ {
+ if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
+ {
+ steps.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
+ {
+ preconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
+ {
+ postconditions.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ }
+
+ _listTcsInfo.Add(new TestcaseInfo
+ {
+ TestcaseName = pair.Key,
+ Preconditions = preconditions,
+ Steps = steps,
+ Postconditions = postconditions,
+ });
+ break;
+ }
+ }
+ }
+ UpdateCurrentTCInfo();
+ }
+
+ void UpdateCurrentTCInfo()
+ {
+ _currentTCInfo = new List<string>();
+ _currentTCInfo.Add("DESCRIPTION:#" + (_currentTCNum + 1));
+ string[] str = _listTcsInfo[_currentTCNum].TestcaseName.Split('.');
+ _currentTCInfo.Add("CLASS:" + str[str.Length - 2]);
+ _currentTCInfo.Add("METHOD:" + str[str.Length - 1]);
+ for (int index = 0; index < _listTcsInfo[_currentTCNum].Preconditions.Count; index++)
+ {
+ _currentTCInfo.Add(_listTcsInfo[_currentTCNum].Preconditions[index]);
+ }
+ for (int index = 0; index < _listTcsInfo[_currentTCNum].Steps.Count; index++)
+ {
+ _currentTCInfo.Add(_listTcsInfo[_currentTCNum].Steps[index]);
+ }
+ for (int index = 0; index < _listTcsInfo[_currentTCNum].Postconditions.Count; index++)
+ {
+ _currentTCInfo.Add(_listTcsInfo[_currentTCNum].Postconditions[index]);
+ }
+ }
+
+ private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e)
+ {
+ if (_listItem[_currentTCNum].Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail = ResultNumber.Fail - 1;
+ }
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass = ResultNumber.Pass - 1;
+ }
+ else if (_listItem[_currentTCNum].Result.Contains(StrResult.BLOCK))
+ ResultNumber.Block = ResultNumber.Block - 1;
+
+ _listItem[_currentTCNum].Result = e.Result;
+ if (e.Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass += 1;
+ }
+ else if (e.Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail += 1;
+ }
+ else if (e.Result.Contains(StrResult.BLOCK))
+ {
+ ResultNumber.Block += 1;
+ }
+
+ FlexibleViewViewHolder holder = _flvInit?.FindViewHolderForAdapterPosition(_currentTCNum);
+ if (holder != null)
+ {
+ string testcaseName = "#" + (_currentTCNum + 1).ToString() + ". " + _listTcsName[_currentTCNum];
+ string resultText = " " + "[" + _listItem[(int)_currentTCNum].Result + "]";
+ string text = testcaseName + resultText;
+ Button btn = holder.ItemView as Button;
+ btn.Text = text;
+ _viewAdapter?.UpdateItemData(_currentTCNum, _listItem);
+ }
+ SetSummaryResult();
+ _txtNotRun.Text = _listItem[_currentTCNum].Result;
+ _txtNotRun.TextColor = _listItem[_currentTCNum].ResultColor;
+ }
+ private void CreateTestPageView()
+ {
+ _viewPageMainTest = new View()
+ {
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height),
+ ParentOrigin = NUI.Position.ParentOriginTopLeft,
+ PivotPoint = PivotPoint.TopLeft,
+ BackgroundColor = new Color("#eeeee4")
+ };
+ //
+ _btnBackViewTest = new Button();
+ SetCommonButtonStyle(_btnBackViewTest, "Back");
+ _btnBackViewTest.Clicked += (obj, e) =>
+ {
+ _viewDetail.Show();
+ _viewPageMainTest.Hide();
+ };
+ //
+ _btnBackViewTest.Position = new Position(_btnBackViewTest.SizeHeight * 0.1f, _btnBackViewTest.SizeHeight * 0.1f, 0.0f);
+ _btnBackViewTest.PointSize = _btnBackViewTest.PointSize * 1.4f;
+ _viewPageMainTest.Add(_btnBackViewTest);
+ //
+ _viewContentTest = new View()
+ {
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height),
+ Position = new Position(0.0f, _btnBackViewTest.SizeHeight * 1.2f, 0.0f),
+ ParentOrigin = Position.ParentOriginTopLeft,
+ PivotPoint = PivotPoint.TopLeft
+ };
+ _viewPageMainTest.Add(_viewContentTest);
+ }
+ private void addViewContent(View subView)
+ {
+ _viewPageMainTest.Remove(_viewContentTest);
+ _viewContentTest = new View()
+ {
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height),
+ Position = new Position(0.0f, _btnBackViewTest.SizeHeight * 1.2f, 0.0f),
+ ParentOrigin = Position.ParentOriginTopLeft,
+ PivotPoint = PivotPoint.TopLeft
+ };
+ _viewContentTest.Add(subView);
+ _viewPageMainTest.Add(_viewContentTest);
+ }
+ public static void DisplayLabel(String msg)
+ {
+ var manualTemplate = GetInstance();
+ var mLabel = new TextLabel()
+ {
+ Text = msg + " is not support on this profile. So, you can not test this TC. please mark as PASS",
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ PointSize = ManualTest.GetPointSize(),
+ TextColor = new Color("#0000b3"),
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.09f),
+ Focusable = true
+ };
+ mLabel.MultiLine = true;
+ mLabel.ParentOrigin = ParentOrigin.TopLeft;
+ mLabel.BorderlineColor = Color.DodgerBlue;
+ mLabel.BorderlineWidth = 1;
+ mLabel.BackgroundColor = Color.LightGray;
+ View view = new View();
+ view.Add(mLabel);
+ view.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal };
+ manualTemplate.ExecuteTC(view);
+ }
+ public static void DisplayCustomLabel(String msg)
+ {
+ var manualTemplate = GetInstance();
+ var mLabel = new TextLabel()
+ {
+ Text = msg,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ PointSize = ManualTest.GetPointSize(),
+ TextColor = new Color("#0000b3"),
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.09f),
+ Focusable = true
+ };
+ mLabel.MultiLine = true;
+ mLabel.ParentOrigin = ParentOrigin.TopLeft;
+ View view = new View();
+ view.Add(mLabel);
+ view.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal };
+ manualTemplate.ExecuteTC(view);
+ }
+ public void ExecuteTC(View view)
+ {
+ _viewCase = new View
+ {
+ PivotPoint = PivotPoint.TopLeft,
+ ParentOrigin = Position.ParentOriginTopLeft,
+ Position = new Position(0, Window.Instance.Size.Height * 0.68f, 0),
+ Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.09f),
+ Focusable = true
+ };
+ _viewCase.Add(view);
+ _viewDetail.Add(_viewCase);
+ _viewCase.Show();
+ FocusManager.Instance.SetCurrentFocusView(_viewCase);
+ }
+
+ public void ExecuteTCView(View view)
+ {
+ addViewContent(view);
+ _viewPageMainTest.Show();
+ FocusManager.Instance.SetCurrentFocusView(view);
+ _viewDetail.Hide();
+ }
+ private ButtonStyle ButtonStyleStandard = new ButtonStyle
+ {
+ BackgroundColor = new ColorSelector
+ {
+ Normal = new Color("#02bcfa"),
+ Pressed = new Color("#029dd1"),
+ Selected = new Color("#029dd1"),
+ Disabled = new Color("#029dd1"),
+ },
+ Focusable = true,
+ CornerRadius = 8,
+ PivotPoint = PivotPoint.TopLeft,
+ Margin = new Extents((ushort)Math.Round(Window.Instance.Size.Width*0.05),
+ (ushort)Math.Round(Window.Instance.Size.Width * 0.05), 12, 12),
+ };
+ }
+}
+
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <TargetFramework>net6.0-tizen8.0</TargetFramework>
+ <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <Import Project="..\..\Common\dependencies.props" />
+
+ <!-- Include Nuget Package for Xamarin building -->
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)" />
+ <PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)" />
+ <PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\nunit.framework\nunit.framework.csproj" />
+ <ProjectReference Include="..\..\nunitlite\nunitlite.csproj" />
+ </ItemGroup>
+</Project>
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace Tizen.Manual.NewTemplate
+{
+ public class ResultNumber
+ {
+ public static int Total { get; set; }
+ public static int Pass { get; set; }
+ public static int Fail { get; set; }
+ public static int NotRun { get; set; }
+ public static int Block { get; set; }
+ }
+
+ public class TestcaseInfo
+ {
+ private string _tescaseName;
+ public string TestcaseName
+ {
+ get
+ {
+ return _tescaseName;
+ }
+ set
+ {
+ _tescaseName = value;
+ }
+ }
+
+ private List<string> _preconditions;
+ public List<string> Preconditions
+ {
+ get
+ {
+ return _preconditions;
+ }
+ set
+ {
+ _preconditions = value;
+ }
+ }
+
+ private List<string> _steps;
+ public List<string> Steps
+ {
+ get
+ {
+ return _steps;
+ }
+ set
+ {
+ _steps = value;
+ }
+ }
+
+ private List<string> _postconditions;
+ public List<string> Postconditions
+ {
+ get
+ {
+ return _postconditions;
+ }
+ set
+ {
+ _postconditions = value;
+ }
+ }
+ }
+ public class ItemData : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void OnPropertyChanged(object sender, string propertyName)
+ {
+ if (this.PropertyChanged != null)
+ {
+ PropertyChanged(sender, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ public int No { get; set; }
+
+ public string TCName { get; set; }
+
+ private string _result;
+ public string Result
+ {
+ get
+ {
+ return _result;
+ }
+ set
+ {
+ _result = value;
+ if (_result.Equals(StrResult.PASS))
+ {
+ ResultColor = Color.DarkGreen;
+ }
+ else if (_result.Equals(StrResult.FAIL))
+ {
+ ResultColor = Color.Red;
+ }
+ else if (_result.Equals(StrResult.BLOCK))
+ {
+ ResultColor = Color.Orange;
+ }
+ else
+ {
+ ResultColor = Color.Black;
+ }
+ OnPropertyChanged(this, "Result");
+ }
+ }
+
+ private Color _resultColor;
+ public Color ResultColor
+ {
+ get { return _resultColor; }
+ set
+ {
+ _resultColor = value;
+ OnPropertyChanged(this, "ResultColor");
+ }
+ }
+
+ }
+
+ public class StrResult
+ {
+ public static string PASS = "PASS";
+ public static string FAIL = "FAIL";
+ public static string NOTRUN = "NOT RUN";
+ public static string BLOCK = "BLOCK";
+ }
+
+ public class RunType
+ {
+ public static string AUTO = "AUTO";
+ public static string MANUAL = "MANUAL";
+
+ public static string Value { get; set; }
+ }
+
+ public class ManualTest
+ {
+ private static bool Confirmed = true;
+
+ public static async Task WaitForConfirm()
+ {
+ Confirmed = false;
+ while (true)
+ {
+ await Task.Delay(200);
+ if (Confirmed)
+ break;
+ }
+ ManualTemplate.GetInstance().UnlockUIButton();
+ }
+
+ public static bool IsConfirmed()
+ {
+ return Confirmed;
+ }
+
+ public static void Confirm()
+ {
+ Confirmed = true;
+ }
+
+ public static bool IsMobile()
+ {
+ string value;
+ var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
+ if (result && value.Equals("mobile"))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static bool IsWearable()
+ {
+ string value;
+ var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
+ if (result && value.Equals("wearable"))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static bool IsEmulator()
+ {
+ string value;
+ var result = Tizen.System.Information.TryGetValue("tizen.org/system/model_name", out value);
+ if (result && value.Equals("Emulator"))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static float GetPointSize()
+ {
+ float retValue = 10.0f; //default
+ string value;
+ Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
+ switch (value)
+ {
+ case "wearable":
+ retValue = 4.0f;
+ break;
+ case "mobile":
+ retValue = 5.0f;
+ break;
+ case "tv":
+ retValue = 20.0f;
+ break;
+ }
+ if (ManualTest.IsEmulator())
+ {
+ retValue = 4.5f;
+ }
+ return retValue;
+ }
+
+ public static TextLabel CreateLabel(string information)
+ {
+ TextLabel mLabel = new TextLabel();
+ mLabel.TextColor = Color.White;
+ mLabel.PointSize = 4.0f;
+ mLabel.VerticalAlignment = VerticalAlignment.Center;
+ mLabel.HorizontalAlignment = HorizontalAlignment.Begin;
+ mLabel.MultiLine = true;
+ mLabel.Text = information;
+ mLabel.Size2D = new Size2D(300, 50);
+ return mLabel;
+ }
+ }
+
+ enum NavigationButton
+ {
+ Next,
+ Previous,
+ Home,
+ NA
+ }
+}
--- /dev/null
+/*
+* Copyright (c) 2017 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+using System.Collections.Generic;
+using Tizen.NUI.Components;
+using Tizen.NUI;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.Manual.NewTemplate
+{
+ public class ViewAdapter : FlexibleViewAdapter
+ {
+ private List<string> _listDatas;
+ private List<ItemData> _listItems;
+ private TextLabel _textResult;
+ public ViewAdapter(List<string> datas, List<ItemData> item)
+ {
+ _listDatas = datas;
+ _listItems = item;
+ }
+ public void UpdateItemData(int position, List<ItemData> item)
+ {
+ _listItems = item;
+ }
+ public override FlexibleViewViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleViewViewHolder viewHolder = new FlexibleViewViewHolder(new Button());
+ return viewHolder;
+ }
+ public override void OnBindViewHolder(FlexibleViewViewHolder holder, int position)
+ {
+ string testcaseName = "#" + (position + 1).ToString() + ". " + _listDatas[position];
+ string resultText = " " + "[" + _listItems[(int)position].Result + "]";
+ string text = testcaseName + resultText;
+ Button btnItem = holder.ItemView as Button;
+ if (btnItem)
+ {
+ btnItem.Focusable = true;
+ btnItem.Text = text;
+ btnItem.Feedback = false;
+ btnItem.Name = position.ToString();
+ btnItem.PointSize = ManualTest.GetPointSize();
+ btnItem.Size = new Size(Window.Instance.Size.Width, Window.Instance.Size.Height * 0.046f);
+ btnItem.TextColor = new Color(0, 0, 0, 1);
+ btnItem.ItemAlignment = LinearLayout.Alignment.Begin;
+ btnItem.ParentOrigin = Position.ParentOriginTopLeft;
+ btnItem.PivotPoint = PivotPoint.TopLeft;
+ btnItem.TextAlignment = HorizontalAlignment.Begin;
+ btnItem.CellIndex = new Vector2(position, 0);
+ btnItem.CornerRadius = 2;
+ btnItem.BackgroundColor = Color.White;
+ btnItem.BorderlineColor = Color.LightSkyBlue;
+ btnItem.BorderlineWidth = 1;
+ }
+ }
+ public override void OnDestroyViewHolder(FlexibleViewViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return _listDatas.Count;
+ }
+ }
+}
+
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License\r
- */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using NUnitLite.TUnit;\r
-using NUnit.Framework.TUnit;\r
-using NUnit.Framework.Interfaces;\r
-using System.Reflection;\r
-using ManualTemplate;\r
-using Xamarin.Forms;\r
-using Tizen.Applications;\r
-\r
-namespace NUnit.Framework\r
-{\r
- public class TestPage\r
- {\r
- private static TestPage instance;\r
- private static Object lockObject = new object();\r
-\r
- private NavigationPage _navigationPage;\r
- private ContentPage _tcContentPage;\r
- private Page _tcUIPage;\r
- private Label _summaryLabel, _tcResultText, _descriptionTitle;\r
- private ListView _tcDescriptions;\r
- private Button _runBtn, _passBtn, _failBtn, _blockBtn;\r
- private Button _mainBtn, _prevBtn, _nextBtn;\r
- private StackLayout _mainLayout, _tcUILayout;\r
-\r
- private int _tcIndex = 0;\r
- private List<string> _tcIDList;\r
- private List<ItemData> _listItem;\r
- private List<TestcaseInfo> _tcInfoList;\r
- private List<TestcaseDescription> _currentTCInfo;\r
- private TRunner _tunitRunner;\r
- private TSettings _tsettings;\r
- private NavigationButton _pressButton = NavigationButton.NA;\r
- private ToastMessage _toastMessage;\r
-\r
- private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute";\r
- private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";\r
- private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";\r
-\r
- public event EventHandler<string> TestcaseDone;\r
-\r
- private void OnTestcaseDone(string e)\r
- {\r
- EventHandler<string> handler = TestcaseDone;\r
- if (handler != null)\r
- {\r
- handler(this, e);\r
- }\r
- }\r
-\r
- public NavigationPage getNavigationPage()\r
- {\r
- return _navigationPage;\r
- }\r
-\r
- public static TestPage GetInstance()\r
- {\r
- lock (lockObject)\r
- {\r
- if (instance == null)\r
- {\r
- instance = new TestPage();\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TestPage()\r
- {\r
- }\r
-\r
- public void Initialize(TRunner tunitRunner, List<string> testcaseIDList, List<ItemData> listItem)\r
- {\r
- _toastMessage = new ToastMessage();\r
- RunType.Value = RunType.MANUAL;\r
- _tunitRunner = tunitRunner;\r
- _tunitRunner.SingleTestDone += OnSingleTestDone;\r
- _tcInfoList = new List<TestcaseInfo>();\r
- _tcIDList = testcaseIDList;\r
- _tsettings = TSettings.GetInstance();\r
- _tsettings.IsManual = true;\r
- _listItem = listItem;\r
- MakeTCInfoList();\r
- _summaryLabel = new Label()\r
- {\r
- Text = "",\r
- HorizontalOptions = LayoutOptions.CenterAndExpand,\r
- MinimumHeightRequest = 60,\r
- TextColor = Color.White\r
- };\r
- SetResultNumber(0, 0, 0);\r
- MakeTestPage();\r
- }\r
-\r
- private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e)\r
- {\r
- // check old result\r
- if (_listItem[_tcIndex].Result.Contains(StrResult.FAIL))\r
- {\r
- ResultNumber.Fail = ResultNumber.Fail - 1;\r
- }\r
- else if (_listItem[_tcIndex].Result.Contains(StrResult.PASS))\r
- {\r
- ResultNumber.Pass = ResultNumber.Pass - 1;\r
- }\r
- else if (_listItem[_tcIndex].Result.Contains(StrResult.BLOCK))\r
- ResultNumber.Block = ResultNumber.Block - 1;\r
-\r
- // Update new result\r
- _listItem[_tcIndex].Result = e.Result;\r
- if (e.Result.Contains(StrResult.PASS))\r
- {\r
- ResultNumber.Pass += 1;\r
- }\r
- else if (e.Result.Contains(StrResult.FAIL))\r
- {\r
- ResultNumber.Fail += 1;\r
- }\r
- else if (e.Result.Contains(StrResult.BLOCK))\r
- {\r
- ResultNumber.Block += 1;\r
- }\r
-\r
- UpdateLayout();\r
- }\r
-\r
- private void UpdateLayout()\r
- {\r
- SetResultNumber(ResultNumber.Pass, ResultNumber.Fail, ResultNumber.Block);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- if (_tcUILayout != null)\r
- {\r
- _tcUILayout.Children.Clear();\r
- }\r
- if (_pressButton == NavigationButton.Next)\r
- {\r
- Next();\r
- }\r
- else if (_pressButton == NavigationButton.Previous)\r
- {\r
- Previous();\r
- }\r
- else if (_pressButton == NavigationButton.Home)\r
- {\r
- _navigationPage.PopAsync();\r
- }\r
- OnTestcaseDone(null);\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- _runBtn.IsEnabled = true;\r
- _mainBtn.IsEnabled = true;\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
-\r
- private void SetResultNumber(int pass, int fail, int block)\r
- {\r
- ResultNumber.NotRun = ResultNumber.Total - pass - fail - block;\r
- _summaryLabel.Text = "Total : " + ResultNumber.Total + ", Pass : " + pass + ", Fail : " + fail + ", Block : " + block + ", Not Run : " + ResultNumber.NotRun;\r
- }\r
-\r
- private void MakeTestPage()\r
- {\r
- _mainLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Vertical,\r
- IsVisible = true,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- VerticalOptions = LayoutOptions.FillAndExpand,\r
- Spacing = 10,\r
- Padding = new Thickness(10),\r
- };\r
- _descriptionTitle = new Label()\r
- {\r
- Text = "DESCRIPTION:",\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- VerticalOptions = LayoutOptions.Start,\r
- HeightRequest = 50,\r
- TextColor = Color.White\r
- };\r
- // layout\r
- StackLayout functionLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Horizontal,\r
- IsVisible = true,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- Spacing = 10,\r
- VerticalOptions = LayoutOptions.End,\r
- };\r
-\r
- _mainBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "Home",\r
- HeightRequest = 80,\r
- };\r
-\r
- _mainBtn.Clicked += (sender, e) =>\r
- {\r
- _pressButton = NavigationButton.Home;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- _navigationPage.PopAsync();\r
- }\r
- };\r
-\r
- _prevBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "<<",\r
- HeightRequest = 80,\r
- };\r
-\r
- _prevBtn.Clicked += (sender, e) =>\r
- {\r
- PreviousTestcase();\r
- };\r
-\r
- _nextBtn = new Button()\r
- {\r
- Text = ">>",\r
- HorizontalOptions = LayoutOptions.Start,\r
- HeightRequest = 80,\r
- };\r
-\r
- _nextBtn.Clicked += (sender, e) =>\r
- {\r
- NextTestcase();\r
- };\r
-\r
- _tcResultText = new Label()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- VerticalOptions = LayoutOptions.FillAndExpand,\r
- HorizontalTextAlignment = TextAlignment.Center,\r
- VerticalTextAlignment = TextAlignment.Center,\r
- HeightRequest = 80,\r
- };\r
- functionLayout.Children.Add(_mainBtn);\r
- functionLayout.Children.Add(_tcResultText);\r
- functionLayout.Children.Add(_prevBtn);\r
- functionLayout.Children.Add(_nextBtn);\r
- // Show description\r
- ShowDescription();\r
-\r
- var navigationLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Horizontal,\r
- IsVisible = true,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- Spacing = 10,\r
- VerticalOptions = LayoutOptions.End,\r
- };\r
-\r
- _passBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "Pass",\r
- HeightRequest = 80,\r
- IsEnabled = false,\r
- };\r
-\r
- _passBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.PASS;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _failBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "Fail",\r
- HeightRequest = 80,\r
- IsEnabled = false,\r
- };\r
-\r
- _failBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.FAIL;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _blockBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "Block",\r
- HeightRequest = 80,\r
- IsEnabled = false,\r
- };\r
-\r
- _blockBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.BLOCK;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _runBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "Run",\r
- HeightRequest = 80,\r
- };\r
-\r
- _runBtn.Clicked += (sender, e) =>\r
- {\r
- LockUIButton();\r
- _pressButton = NavigationButton.NA;\r
- _tsettings.Testcase_ID = _tcIDList[_tcIndex];\r
- _tsettings.TCResult = "";\r
- _tunitRunner.Execute();\r
- };\r
-\r
- navigationLayout.Children.Add(_passBtn);\r
- navigationLayout.Children.Add(_failBtn);\r
- navigationLayout.Children.Add(_blockBtn);\r
- navigationLayout.Children.Add(_runBtn);\r
-\r
- _tcUILayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Vertical,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- HeightRequest = 200\r
- };\r
-\r
- _mainLayout.Children.Add(_summaryLabel);\r
- _mainLayout.Children.Add(_descriptionTitle);\r
- _mainLayout.Children.Add(_tcDescriptions);\r
- _mainLayout.Children.Add(_tcUILayout);\r
- _mainLayout.Children.Add(navigationLayout);\r
- _mainLayout.Children.Add(functionLayout);\r
- _tcContentPage = new ContentPage()\r
- {\r
- Content = _mainLayout\r
- };\r
- NavigationPage.SetHasNavigationBar(_tcContentPage, false);\r
- }\r
-\r
- public void LockUIButton()\r
- {\r
- if (ManualTest.IsWearable())\r
- {\r
- WearableTemplate.TestPage.GetInstance().LockUIButton();\r
- }\r
- else\r
- {\r
- _runBtn.IsEnabled = false;\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- _mainBtn.IsEnabled = false;\r
- _prevBtn.IsEnabled = false;\r
- _nextBtn.IsEnabled = false;\r
- }\r
- }\r
-\r
- public void UnlockUIButton()\r
- {\r
- if (ManualTest.IsWearable())\r
- {\r
- WearableTemplate.TestPage.GetInstance().UnlockUIButton();\r
- }\r
- else\r
- {\r
- _passBtn.IsEnabled = true;\r
- _failBtn.IsEnabled = true;\r
- _blockBtn.IsEnabled = true;\r
- _mainBtn.IsEnabled = true;\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
- }\r
-\r
- public void Show(NavigationPage navigationPage, int testcaseIndex)\r
- {\r
- _navigationPage = navigationPage;\r
- _tcIndex = testcaseIndex - 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + testcaseIndex;\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- navigationPage.PushAsync(_tcContentPage);\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- }\r
-\r
- private void NextTestcase()\r
- {\r
- _pressButton = NavigationButton.Next;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- Next();\r
- }\r
- }\r
-\r
- private void Next()\r
- {\r
- if (_tcIndex < _tcIDList.Count - 1)\r
- {\r
- _tcIndex = _tcIndex + 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- }\r
- else if (_tcIndex == _tcIDList.Count - 1)\r
- {\r
- _toastMessage.Message = "This is last testcase";\r
- _toastMessage.Post();\r
- }\r
- }\r
-\r
- private void PreviousTestcase()\r
- {\r
- _pressButton = NavigationButton.Previous;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- Previous();\r
- }\r
- }\r
-\r
- private void Previous()\r
- {\r
- if (_tcIndex > 0)\r
- {\r
- _tcIndex = _tcIndex - 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- }\r
- else if (_tcIndex == 0)\r
- {\r
- _toastMessage.Message = "This is first testcase";\r
- _toastMessage.Post();\r
- }\r
- }\r
-\r
- private void SetColor(string result)\r
- {\r
- if (result.Equals(StrResult.PASS))\r
- {\r
- _tcResultText.TextColor = Color.Green;\r
- }\r
- else if (result.Equals(StrResult.FAIL))\r
- {\r
- _tcResultText.TextColor = Color.Red;\r
- }\r
- else if (result.Equals(StrResult.BLOCK))\r
- {\r
- _tcResultText.TextColor = Color.Orange;\r
- }\r
- else\r
- {\r
- _tcResultText.TextColor = Color.White;\r
- }\r
- }\r
-\r
- private int FindMaxLineDescription()\r
- {\r
- int maxLine = 0;\r
- for (int i = 0; i < _tcInfoList.Count; i++)\r
- {\r
- int len = _tcInfoList[i].Steps.Count + _tcInfoList[i].Preconditions.Count + _tcInfoList[i].Postconditions.Count;\r
- maxLine = maxLine < len ? len : maxLine;\r
- }\r
- return maxLine;\r
- }\r
-\r
- private void ShowDescription()\r
- {\r
- int lenght = FindMaxLineDescription() + 3;\r
- var template = new DataTemplate(() =>\r
- {\r
- var grid = new Grid();\r
-\r
- var descriptionLabel = new Label\r
- {\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- LineBreakMode = LineBreakMode.CharacterWrap\r
- };\r
-\r
- descriptionLabel.SetBinding(Label.TextProperty, new Binding("Description"));\r
-\r
- grid.Children.Add(descriptionLabel);\r
-\r
- return new ViewCell\r
- {\r
- View = grid,\r
- };\r
- });\r
-\r
- _tcDescriptions = new ListView()\r
- {\r
- ItemTemplate = template,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- RowHeight = 150,\r
- Margin = new Thickness(10),\r
- };\r
- _currentTCInfo = new List<TestcaseDescription>();\r
-\r
- for (int i = 0; i < lenght; i++)\r
- {\r
- _currentTCInfo.Add(new TestcaseDescription(""));\r
- }\r
- UpdateDescriptions();\r
- _tcDescriptions.ItemsSource = _currentTCInfo;\r
- }\r
-\r
- private void UpdateDescriptions()\r
- {\r
- _prevBtn.IsEnabled = false;\r
- _nextBtn.IsEnabled = false;\r
- int lenght = FindMaxLineDescription() + 3;\r
- for (int i = 0; i < lenght; i++)\r
- {\r
- _currentTCInfo[i].Description = "";\r
- }\r
- int index = 0;\r
- if (_tcInfoList.Count == 0)\r
- {\r
- _toastMessage.Message = "Some testing class wrong, plz recheck";\r
- _toastMessage.Post();\r
- return;\r
- }\r
-\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Collections.Generic;
+using NUnitLite.TUnit;
+using NUnit.Framework.TUnit;
+using NUnit.Framework.Interfaces;
+using System.Reflection;
+using ManualTemplate;
+using Xamarin.Forms;
+using Tizen.Applications;
+
+namespace NUnit.Framework
+{
+ public class TestPage
+ {
+ private static TestPage instance;
+ private static Object lockObject = new object();
+
+ private NavigationPage _navigationPage;
+ private ContentPage _tcContentPage;
+ private Page _tcUIPage;
+ private Label _summaryLabel, _tcResultText, _descriptionTitle;
+ private ListView _tcDescriptions;
+ private Button _runBtn, _passBtn, _failBtn, _blockBtn;
+ private Button _mainBtn, _prevBtn, _nextBtn;
+ private StackLayout _mainLayout, _tcUILayout;
+
+ private int _tcIndex = 0;
+ private List<string> _tcIDList;
+ private List<ItemData> _listItem;
+ private List<TestcaseInfo> _tcInfoList;
+ private List<TestcaseDescription> _currentTCInfo;
+ private TRunner _tunitRunner;
+ private TSettings _tsettings;
+ private NavigationButton _pressButton = NavigationButton.NA;
+ private ToastMessage _toastMessage;
+
+ private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute";
+ private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";
+ private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";
+
+ public event EventHandler<string> TestcaseDone;
+
+ private void OnTestcaseDone(string e)
+ {
+ EventHandler<string> handler = TestcaseDone;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+
+ public NavigationPage getNavigationPage()
+ {
+ return _navigationPage;
+ }
+
+ public static TestPage GetInstance()
+ {
+ lock (lockObject)
+ {
+ if (instance == null)
+ {
+ instance = new TestPage();
+ }
+ }
+ return instance;
+ }
+
+ private TestPage()
+ {
+ }
+
+ public void Initialize(TRunner tunitRunner, List<string> testcaseIDList, List<ItemData> listItem)
+ {
+ _toastMessage = new ToastMessage();
+ RunType.Value = RunType.MANUAL;
+ _tunitRunner = tunitRunner;
+ _tunitRunner.SingleTestDone += OnSingleTestDone;
+ _tcInfoList = new List<TestcaseInfo>();
+ _tcIDList = testcaseIDList;
+ _tsettings = TSettings.GetInstance();
+ _tsettings.IsManual = true;
+ _listItem = listItem;
+ MakeTCInfoList();
+ _summaryLabel = new Label()
+ {
+ Text = "",
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ MinimumHeightRequest = 60,
+ TextColor = Color.White
+ };
+ SetResultNumber(0, 0, 0);
+ MakeTestPage();
+ }
+
+ private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e)
+ {
+ // check old result
+ if (_listItem[_tcIndex].Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail = ResultNumber.Fail - 1;
+ }
+ else if (_listItem[_tcIndex].Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass = ResultNumber.Pass - 1;
+ }
+ else if (_listItem[_tcIndex].Result.Contains(StrResult.BLOCK))
+ ResultNumber.Block = ResultNumber.Block - 1;
+
+ // Update new result
+ _listItem[_tcIndex].Result = e.Result;
+ if (e.Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass += 1;
+ }
+ else if (e.Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail += 1;
+ }
+ else if (e.Result.Contains(StrResult.BLOCK))
+ {
+ ResultNumber.Block += 1;
+ }
+
+ UpdateLayout();
+ }
+
+ private void UpdateLayout()
+ {
+ SetResultNumber(ResultNumber.Pass, ResultNumber.Fail, ResultNumber.Block);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ if (_tcUILayout != null)
+ {
+ _tcUILayout.Children.Clear();
+ }
+ if (_pressButton == NavigationButton.Next)
+ {
+ Next();
+ }
+ else if (_pressButton == NavigationButton.Previous)
+ {
+ Previous();
+ }
+ else if (_pressButton == NavigationButton.Home)
+ {
+ _navigationPage.PopAsync();
+ }
+ OnTestcaseDone(null);
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ _runBtn.IsEnabled = true;
+ _mainBtn.IsEnabled = true;
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+
+ private void SetResultNumber(int pass, int fail, int block)
+ {
+ ResultNumber.NotRun = ResultNumber.Total - pass - fail - block;
+ _summaryLabel.Text = "Total : " + ResultNumber.Total + ", Pass : " + pass + ", Fail : " + fail + ", Block : " + block + ", Not Run : " + ResultNumber.NotRun;
+ }
+
+ private void MakeTestPage()
+ {
+ _mainLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Vertical,
+ IsVisible = true,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ Spacing = 10,
+ Padding = new Thickness(10),
+ };
+ _descriptionTitle = new Label()
+ {
+ Text = "DESCRIPTION:",
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ HeightRequest = 50,
+ TextColor = Color.White
+ };
+ // layout
+ StackLayout functionLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Horizontal,
+ IsVisible = true,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Spacing = 10,
+ VerticalOptions = LayoutOptions.End,
+ };
+
+ _mainBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "Home",
+ HeightRequest = 80,
+ };
+
+ _mainBtn.Clicked += (sender, e) =>
+ {
+ _pressButton = NavigationButton.Home;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ _navigationPage.PopAsync();
+ }
+ };
+
+ _prevBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "<<",
+ HeightRequest = 80,
+ };
+
+ _prevBtn.Clicked += (sender, e) =>
+ {
+ PreviousTestcase();
+ };
+
+ _nextBtn = new Button()
+ {
+ Text = ">>",
+ HorizontalOptions = LayoutOptions.Start,
+ HeightRequest = 80,
+ };
+
+ _nextBtn.Clicked += (sender, e) =>
+ {
+ NextTestcase();
+ };
+
+ _tcResultText = new Label()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalTextAlignment = TextAlignment.Center,
+ VerticalTextAlignment = TextAlignment.Center,
+ HeightRequest = 80,
+ };
+ functionLayout.Children.Add(_mainBtn);
+ functionLayout.Children.Add(_tcResultText);
+ functionLayout.Children.Add(_prevBtn);
+ functionLayout.Children.Add(_nextBtn);
+ // Show description
+ ShowDescription();
+
+ var navigationLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Horizontal,
+ IsVisible = true,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Spacing = 10,
+ VerticalOptions = LayoutOptions.End,
+ };
+
+ _passBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "Pass",
+ HeightRequest = 80,
+ IsEnabled = false,
+ };
+
+ _passBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.PASS;
+ ManualTest.Confirm();
+ }
+ };
+
+ _failBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "Fail",
+ HeightRequest = 80,
+ IsEnabled = false,
+ };
+
+ _failBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.FAIL;
+ ManualTest.Confirm();
+ }
+ };
+
+ _blockBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "Block",
+ HeightRequest = 80,
+ IsEnabled = false,
+ };
+
+ _blockBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.BLOCK;
+ ManualTest.Confirm();
+ }
+ };
+
+ _runBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "Run",
+ HeightRequest = 80,
+ };
+
+ _runBtn.Clicked += (sender, e) =>
+ {
+ LockUIButton();
+ _pressButton = NavigationButton.NA;
+ _tsettings.Testcase_ID = _tcIDList[_tcIndex];
+ _tsettings.TCResult = "";
+ _tunitRunner.Execute();
+ };
+
+ navigationLayout.Children.Add(_passBtn);
+ navigationLayout.Children.Add(_failBtn);
+ navigationLayout.Children.Add(_blockBtn);
+ navigationLayout.Children.Add(_runBtn);
+
+ _tcUILayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Vertical,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ HeightRequest = 200
+ };
+
+ _mainLayout.Children.Add(_summaryLabel);
+ _mainLayout.Children.Add(_descriptionTitle);
+ _mainLayout.Children.Add(_tcDescriptions);
+ _mainLayout.Children.Add(_tcUILayout);
+ _mainLayout.Children.Add(navigationLayout);
+ _mainLayout.Children.Add(functionLayout);
+ _tcContentPage = new ContentPage()
+ {
+ Content = _mainLayout
+ };
+ NavigationPage.SetHasNavigationBar(_tcContentPage, false);
+ }
+
+ public void LockUIButton()
+ {
+ if (ManualTest.IsWearable())
+ {
+ WearableTemplate.TestPage.GetInstance().LockUIButton();
+ }
+ else
+ {
+ _runBtn.IsEnabled = false;
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ _mainBtn.IsEnabled = false;
+ _prevBtn.IsEnabled = false;
+ _nextBtn.IsEnabled = false;
+ }
+ }
+
+ public void UnlockUIButton()
+ {
+ if (ManualTest.IsWearable())
+ {
+ WearableTemplate.TestPage.GetInstance().UnlockUIButton();
+ }
+ else
+ {
+ _passBtn.IsEnabled = true;
+ _failBtn.IsEnabled = true;
+ _blockBtn.IsEnabled = true;
+ _mainBtn.IsEnabled = true;
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+ }
+
+ public void Show(NavigationPage navigationPage, int testcaseIndex)
+ {
+ _navigationPage = navigationPage;
+ _tcIndex = testcaseIndex - 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + testcaseIndex;
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ navigationPage.PushAsync(_tcContentPage);
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ }
+
+ private void NextTestcase()
+ {
+ _pressButton = NavigationButton.Next;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ Next();
+ }
+ }
+
+ private void Next()
+ {
+ if (_tcIndex < _tcIDList.Count - 1)
+ {
+ _tcIndex = _tcIndex + 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ }
+ else if (_tcIndex == _tcIDList.Count - 1)
+ {
+ _toastMessage.Message = "This is last testcase";
+ _toastMessage.Post();
+ }
+ }
+
+ private void PreviousTestcase()
+ {
+ _pressButton = NavigationButton.Previous;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ Previous();
+ }
+ }
+
+ private void Previous()
+ {
+ if (_tcIndex > 0)
+ {
+ _tcIndex = _tcIndex - 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ }
+ else if (_tcIndex == 0)
+ {
+ _toastMessage.Message = "This is first testcase";
+ _toastMessage.Post();
+ }
+ }
+
+ private void SetColor(string result)
+ {
+ if (result.Equals(StrResult.PASS))
+ {
+ _tcResultText.TextColor = Color.Green;
+ }
+ else if (result.Equals(StrResult.FAIL))
+ {
+ _tcResultText.TextColor = Color.Red;
+ }
+ else if (result.Equals(StrResult.BLOCK))
+ {
+ _tcResultText.TextColor = Color.Orange;
+ }
+ else
+ {
+ _tcResultText.TextColor = Color.White;
+ }
+ }
+
+ private int FindMaxLineDescription()
+ {
+ int maxLine = 0;
+ for (int i = 0; i < _tcInfoList.Count; i++)
+ {
+ int len = _tcInfoList[i].Steps.Count + _tcInfoList[i].Preconditions.Count + _tcInfoList[i].Postconditions.Count;
+ maxLine = maxLine < len ? len : maxLine;
+ }
+ return maxLine;
+ }
+
+ private void ShowDescription()
+ {
+ int lenght = FindMaxLineDescription() + 3;
+ var template = new DataTemplate(() =>
+ {
+ var grid = new Grid();
+
+ var descriptionLabel = new Label
+ {
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ LineBreakMode = LineBreakMode.CharacterWrap
+ };
+
+ descriptionLabel.SetBinding(Label.TextProperty, new Binding("Description"));
+
+ grid.Children.Add(descriptionLabel);
+
+ return new ViewCell
+ {
+ View = grid,
+ };
+ });
+
+ _tcDescriptions = new ListView()
+ {
+ ItemTemplate = template,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ RowHeight = 150,
+ Margin = new Thickness(10),
+ };
+ _currentTCInfo = new List<TestcaseDescription>();
+
+ for (int i = 0; i < lenght; i++)
+ {
+ _currentTCInfo.Add(new TestcaseDescription(""));
+ }
+ UpdateDescriptions();
+ _tcDescriptions.ItemsSource = _currentTCInfo;
+ }
+
+ private void UpdateDescriptions()
+ {
+ _prevBtn.IsEnabled = false;
+ _nextBtn.IsEnabled = false;
+ int lenght = FindMaxLineDescription() + 3;
+ for (int i = 0; i < lenght; i++)
+ {
+ _currentTCInfo[i].Description = "";
+ }
+ int index = 0;
+ if (_tcInfoList.Count == 0)
+ {
+ _toastMessage.Message = "Some testing class wrong, plz recheck";
+ _toastMessage.Post();
+ return;
+ }
+
_currentTCInfo[index].Description = "TC : " + _tcInfoList[_tcIndex].TestcaseName;
- TLogger.Write("############### TC Name:" + _tcInfoList[_tcIndex].TestcaseName);\r
- foreach (string precondition in _tcInfoList[_tcIndex].Preconditions.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = precondition;\r
- }\r
- foreach (string step in _tcInfoList[_tcIndex].Steps.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = step;\r
- }\r
- foreach (string postcondition in _tcInfoList[_tcIndex].Postconditions.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = postcondition;\r
- }\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
-\r
- private void MakeTCInfoList()\r
- {\r
- foreach (var testcaseItem in _listItem)\r
- {\r
- foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())\r
- {\r
- if (testcaseItem.TCName.Equals(pair.Key))\r
- {\r
- IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();\r
- List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");\r
- List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");\r
- List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");\r
-\r
- while (customAttributes.MoveNext())\r
- {\r
- if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))\r
- {\r
- _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))\r
- {\r
- _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))\r
- {\r
- _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- }\r
-\r
- _tcInfoList.Add(new TestcaseInfo\r
- {\r
- TestcaseName = pair.Key,\r
- Preconditions = _preconditonsStr,\r
- Steps = _stepsStr,\r
- Postconditions = _postconditionsStr,\r
- });\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- public void ExecuteTC(Layout layout)\r
- {\r
- if (ManualTest.IsWearable())\r
- {\r
- WearableTemplate.TestPage.GetInstance().ExecuteTC(layout);\r
- }\r
- else\r
- {\r
- _tcUILayout.Children.Add(layout);\r
- }\r
- }\r
-\r
- public void ExecuteTC(Page page)\r
- {\r
- if (ManualTest.IsWearable())\r
- {\r
- if (String.IsNullOrEmpty(page.Title))\r
- {\r
- NavigationPage.SetHasNavigationBar(page, false);\r
- }\r
- WearableTemplate.TestPage.GetInstance().ExecuteTC(page);\r
- }\r
- else\r
- {\r
- _tcUIPage = page;\r
- _navigationPage.PushAsync(page);\r
- }\r
- }\r
- }\r
-}\r
+ TLogger.Write("############### TC Name:" + _tcInfoList[_tcIndex].TestcaseName);
+ foreach (string precondition in _tcInfoList[_tcIndex].Preconditions.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = precondition;
+ }
+ foreach (string step in _tcInfoList[_tcIndex].Steps.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = step;
+ }
+ foreach (string postcondition in _tcInfoList[_tcIndex].Postconditions.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = postcondition;
+ }
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+
+ private void MakeTCInfoList()
+ {
+ foreach (var testcaseItem in _listItem)
+ {
+ foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())
+ {
+ if (testcaseItem.TCName.Equals(pair.Key))
+ {
+ IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
+ List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");
+ List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");
+ List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");
+
+ while (customAttributes.MoveNext())
+ {
+ if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
+ {
+ _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
+ {
+ _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
+ {
+ _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ }
+
+ _tcInfoList.Add(new TestcaseInfo
+ {
+ TestcaseName = pair.Key,
+ Preconditions = _preconditonsStr,
+ Steps = _stepsStr,
+ Postconditions = _postconditionsStr,
+ });
+ break;
+ }
+ }
+ }
+ }
+
+ public void ExecuteTC(Layout layout)
+ {
+ if (ManualTest.IsWearable())
+ {
+ WearableTemplate.TestPage.GetInstance().ExecuteTC(layout);
+ }
+ else
+ {
+ _tcUILayout.Children.Add(layout);
+ }
+ }
+
+ public void ExecuteTC(Page page)
+ {
+ if (ManualTest.IsWearable())
+ {
+ if (String.IsNullOrEmpty(page.Title))
+ {
+ NavigationPage.SetHasNavigationBar(page, false);
+ }
+ WearableTemplate.TestPage.GetInstance().ExecuteTC(page);
+ }
+ else
+ {
+ _tcUIPage = page;
+ _navigationPage.PushAsync(page);
+ }
+ }
+ }
+}
_listNotPass = TSettings.GetInstance().GetNotPassListManual();
int count = 0;
- if (_listNotPass.Count == 0)\r
- {\r
- foreach (KeyValuePair<string, ITest> pair in _tunitrunner.GetTestList())\r
- {\r
- count++;\r
- _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN });\r
- _tcIDList.Add(pair.Key);\r
- }\r
- }\r
- else\r
- {\r
- foreach (var tc in _listNotPass)\r
- {\r
- count++;\r
- _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN });\r
- _tcIDList.Add(tc);\r
- }\r
+ if (_listNotPass.Count == 0)
+ {
+ foreach (KeyValuePair<string, ITest> pair in _tunitrunner.GetTestList())
+ {
+ count++;
+ _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN });
+ _tcIDList.Add(pair.Key);
+ }
+ }
+ else
+ {
+ foreach (var tc in _listNotPass)
+ {
+ count++;
+ _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN });
+ _tcIDList.Add(tc);
+ }
}
ResultNumber.Total = ResultNumber.NotRun = _tcIDList.Count;
-<Project Sdk="Microsoft.NET.Sdk">\r
-\r
- <PropertyGroup>\r
- <OutputType>Library</OutputType>\r
- <TargetFramework>net6.0-tizen8.0</TargetFramework>\r
- <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>\r
- <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>\r
- </PropertyGroup>\r
-\r
- <Import Project="..\..\Common\dependencies.props" />\r
-\r
- <!-- Include Nuget Package for Xamarin building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)" />\r
- <PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)" />\r
- <PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\nunit.framework\nunit.framework.csproj" />\r
- <ProjectReference Include="..\..\nunitlite\nunitlite.csproj" />\r
- </ItemGroup>\r
-</Project>\r
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <TargetFramework>net6.0-tizen8.0</TargetFramework>
+ <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <Import Project="..\..\Common\dependencies.props" />
+
+ <!-- Include Nuget Package for Xamarin building -->
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)" />
+ <PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)" />
+ <PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\nunit.framework\nunit.framework.csproj" />
+ <ProjectReference Include="..\..\nunitlite\nunitlite.csproj" />
+ </ItemGroup>
+</Project>
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License\r
- */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using NUnitLite.TUnit;\r
-using NUnit.Framework.TUnit;\r
-using NUnit.Framework.Interfaces;\r
-using System.Reflection;\r
-using Xamarin.Forms;\r
-using Tizen.Applications;\r
-\r
-namespace WearableTemplate\r
-{\r
- public class TestPage\r
- {\r
- private static TestPage instance;\r
- private static Object lockObject = new object();\r
-\r
- private NavigationPage _navigationPage;\r
- private ContentPage _tcContentPage;\r
- private Page _tcUIPage;\r
- private Label _summaryLabel1, _summaryLabel2, _tcResultText, _descriptionTitle;\r
- private ListView _tcDescriptions;\r
- private Button _runBtn, _passBtn, _failBtn, _blockBtn;\r
- private Button _mainBtn, _prevBtn, _nextBtn;\r
- private StackLayout _mainLayout, _tcUILayout;\r
-\r
- private int _tcIndex = 0;\r
- private List<string> _tcIDList;\r
- private List<ItemData> _listItem;\r
- private List<TestcaseInfo> _tcInfoList;\r
- private List<TestcaseDescription> _currentTCInfo;\r
- private TRunner _tunitRunner;\r
- private TSettings _tsettings;\r
- private NavigationButton _pressButton = NavigationButton.NA;\r
- private ToastMessage _toastMessage;\r
-\r
- private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute";\r
- private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";\r
- private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";\r
-\r
- public event EventHandler<string> TestcaseDone;\r
-\r
- private void OnTestcaseDone(string e)\r
- {\r
- EventHandler<string> handler = TestcaseDone;\r
- if (handler != null)\r
- {\r
- handler(this, e);\r
- }\r
- }\r
-\r
- public NavigationPage getNavigationPage()\r
- {\r
- return _navigationPage;\r
- }\r
-\r
- public static TestPage GetInstance()\r
- {\r
-\r
- lock (lockObject)\r
- {\r
- if (instance == null)\r
- {\r
- instance = new TestPage();\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TestPage()\r
- {\r
- }\r
-\r
- public void Initialize(TRunner tunitRunner, List<string> testcaseIDList, List<ItemData> listItem)\r
- {\r
- _toastMessage = new ToastMessage();\r
- RunType.Value = RunType.MANUAL;\r
- _tunitRunner = tunitRunner;\r
- _tunitRunner.SingleTestDone += OnSingleTestDone;\r
- _tcInfoList = new List<TestcaseInfo>();\r
- _tcIDList = testcaseIDList;\r
- _tsettings = TSettings.GetInstance();\r
- _tsettings.IsManual = true;\r
- _listItem = listItem;\r
- MakeTCInfoList();\r
-\r
- _summaryLabel1 = new Label()\r
- {\r
- Text = "",\r
- HeightRequest = 25,\r
- HorizontalOptions = LayoutOptions.Center,\r
- VerticalOptions = LayoutOptions.Center,\r
- TextColor = Color.White,\r
- FontSize = 5,\r
- };\r
- _summaryLabel2 = new Label()\r
- {\r
- Text = "",\r
- HeightRequest = 25,\r
- HorizontalOptions = LayoutOptions.Center,\r
- VerticalOptions = LayoutOptions.Center,\r
- TextColor = Color.White,\r
- FontSize = 5,\r
- };\r
- SetResultNumber(0, 0, 0);\r
- MakeTestPage();\r
- }\r
-\r
- private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e)\r
- {\r
- // check old result\r
- if (_listItem[_tcIndex].Result.Contains(StrResult.FAIL))\r
- {\r
- ResultNumber.Fail = ResultNumber.Fail - 1;\r
- }\r
- else if (_listItem[_tcIndex].Result.Contains(StrResult.PASS))\r
- {\r
- ResultNumber.Pass = ResultNumber.Pass - 1;\r
- }\r
- else if (_listItem[_tcIndex].Result.Contains(StrResult.BLOCK))\r
- ResultNumber.Block = ResultNumber.Block - 1;\r
-\r
- // Update new result\r
- _listItem[_tcIndex].Result = e.Result;\r
- if (e.Result.Contains(StrResult.PASS))\r
- {\r
- ResultNumber.Pass += 1;\r
- }\r
- else if (e.Result.Contains(StrResult.FAIL))\r
- {\r
- ResultNumber.Fail += 1;\r
- }\r
- else if (e.Result.Contains(StrResult.BLOCK))\r
- {\r
- ResultNumber.Block += 1;\r
- }\r
-\r
- UpdateLayout();\r
- }\r
-\r
- private void UpdateLayout()\r
- {\r
- SetResultNumber(ResultNumber.Pass, ResultNumber.Fail, ResultNumber.Block);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- if (_tcUILayout != null)\r
- {\r
- _tcUILayout.Children.Clear();\r
- }\r
- if (_pressButton == NavigationButton.Next)\r
- {\r
- Next();\r
- }\r
- else if (_pressButton == NavigationButton.Previous)\r
- {\r
- Previous();\r
- }\r
- else if (_pressButton == NavigationButton.Home)\r
- {\r
- _navigationPage.PopAsync();\r
- }\r
- OnTestcaseDone(null);\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- _runBtn.IsEnabled = true;\r
- _mainBtn.IsEnabled = true;\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
-\r
- private void SetResultNumber(int pass, int fail, int block)\r
- {\r
- ResultNumber.NotRun = ResultNumber.Total - pass - fail - block;\r
- _summaryLabel1.Text = "T : " + ResultNumber.Total + ", P : " + pass;\r
- _summaryLabel2.Text = "F : " + fail + ", B : " + block + ", NR : " + ResultNumber.NotRun;\r
- }\r
-\r
- private void MakeTestPage()\r
- {\r
- _mainLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Vertical,\r
- IsVisible = true,\r
- HorizontalOptions = LayoutOptions.CenterAndExpand,\r
- VerticalOptions = LayoutOptions.CenterAndExpand,\r
- Spacing = 5,\r
- Padding = new Thickness(10),\r
- };\r
- _descriptionTitle = new Label()\r
- {\r
- Text = "DESCRIPTION:",\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- VerticalOptions = LayoutOptions.Start,\r
- HeightRequest = 23,\r
- Margin = new Thickness(40, 0, 0, 0),\r
- FontSize = 5,\r
- TextColor = Color.White,\r
- };\r
-\r
- StackLayout functionLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Horizontal,\r
- IsVisible = true,\r
- HeightRequest = 30,\r
- HorizontalOptions = LayoutOptions.CenterAndExpand,\r
- VerticalOptions = LayoutOptions.Start,\r
- Spacing = 2,\r
- Margin = new Thickness(0, 0, 0, 15)\r
- };\r
-\r
- _mainBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "H",\r
- HeightRequest = 30,\r
- WidthRequest = 55,\r
- FontSize = 5\r
- };\r
-\r
- _mainBtn.Clicked += (sender, e) =>\r
- {\r
- _pressButton = NavigationButton.Home;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- _navigationPage.PopAsync();\r
- }\r
- };\r
-\r
- _prevBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "<<",\r
- HeightRequest = 30,\r
- WidthRequest = 55,\r
- FontSize = 4\r
- };\r
-\r
- _prevBtn.Clicked += (sender, e) =>\r
- {\r
- PreviousTestcase();\r
- };\r
-\r
- _nextBtn = new Button()\r
- {\r
- Text = ">>",\r
- HorizontalOptions = LayoutOptions.Start,\r
- HeightRequest = 30,\r
- WidthRequest = 55,\r
- FontSize = 4\r
- };\r
-\r
- _nextBtn.Clicked += (sender, e) =>\r
- {\r
- NextTestcase();\r
- };\r
-\r
- _tcResultText = new Label()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- VerticalOptions = LayoutOptions.FillAndExpand,\r
- HorizontalTextAlignment = TextAlignment.Center,\r
- VerticalTextAlignment = TextAlignment.Center,\r
- HeightRequest = 30,\r
- FontSize = 3\r
- };\r
- functionLayout.Children.Add(_mainBtn);\r
- functionLayout.Children.Add(_tcResultText);\r
- functionLayout.Children.Add(_prevBtn);\r
- functionLayout.Children.Add(_nextBtn);\r
- // Show description\r
- ShowDescription();\r
-\r
- var navigationLayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Horizontal,\r
- IsVisible = true,\r
- HeightRequest = 30,\r
- HorizontalOptions = LayoutOptions.CenterAndExpand,\r
- VerticalOptions = LayoutOptions.Start,\r
- Spacing = 5,\r
- };\r
-\r
- _passBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "P",\r
- HeightRequest = 30,\r
- IsEnabled = false,\r
- FontSize = 5,\r
- WidthRequest = 60\r
- };\r
-\r
- _passBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.PASS;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _failBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "F",\r
- HeightRequest = 30,\r
- IsEnabled = false,\r
- FontSize = 5,\r
- WidthRequest = 60\r
- };\r
-\r
- _failBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.FAIL;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _blockBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "B",\r
- HeightRequest = 30,\r
- IsEnabled = false,\r
- FontSize = 5,\r
- WidthRequest = 60\r
- };\r
-\r
- _blockBtn.Clicked += (sender, e) =>\r
- {\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.BLOCK;\r
- ManualTest.Confirm();\r
- }\r
- };\r
-\r
- _runBtn = new Button()\r
- {\r
- HorizontalOptions = LayoutOptions.Start,\r
- Text = "R",\r
- HeightRequest = 30,\r
- FontSize = 5,\r
- WidthRequest = 60\r
- };\r
-\r
- _runBtn.Clicked += (sender, e) =>\r
- {\r
- LockUIButton();\r
- _pressButton = NavigationButton.NA;\r
- _tsettings.Testcase_ID = _tcIDList[_tcIndex];\r
- _tsettings.TCResult = "";\r
- _tunitRunner.Execute();\r
- };\r
-\r
- navigationLayout.Children.Add(_passBtn);\r
- navigationLayout.Children.Add(_failBtn);\r
- navigationLayout.Children.Add(_blockBtn);\r
- navigationLayout.Children.Add(_runBtn);\r
-\r
- _tcUILayout = new StackLayout()\r
- {\r
- Orientation = StackOrientation.Vertical,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- VerticalOptions = LayoutOptions.Start,\r
- HeightRequest = 40,\r
- WidthRequest = 280,\r
- Margin = new Thickness(10, 0, 10, 0)\r
- };\r
-\r
- _mainLayout.Children.Add(_summaryLabel1);\r
- _mainLayout.Children.Add(_summaryLabel2);\r
- _mainLayout.Children.Add(_descriptionTitle);\r
- _mainLayout.Children.Add(_tcDescriptions);\r
- _mainLayout.Children.Add(_tcUILayout);\r
- _mainLayout.Children.Add(navigationLayout);\r
- _mainLayout.Children.Add(functionLayout);\r
- _tcContentPage = new ContentPage()\r
- {\r
- Content = _mainLayout\r
- };\r
- NavigationPage.SetHasNavigationBar(_tcContentPage, false);\r
- }\r
-\r
- public void LockUIButton()\r
- {\r
- _runBtn.IsEnabled = false;\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- _mainBtn.IsEnabled = false;\r
- _prevBtn.IsEnabled = false;\r
- _nextBtn.IsEnabled = false;\r
-\r
- }\r
-\r
- public void UnlockUIButton()\r
- {\r
- _passBtn.IsEnabled = true;\r
- _failBtn.IsEnabled = true;\r
- _blockBtn.IsEnabled = true;\r
- _mainBtn.IsEnabled = true;\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
-\r
- public void Show(NavigationPage navigationPage, int testcaseIndex)\r
- {\r
- _navigationPage = navigationPage;\r
- _tcIndex = testcaseIndex - 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + testcaseIndex;\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- navigationPage.PushAsync(_tcContentPage);\r
- _passBtn.IsEnabled = false;\r
- _failBtn.IsEnabled = false;\r
- _blockBtn.IsEnabled = false;\r
- }\r
-\r
- private void NextTestcase()\r
- {\r
- _pressButton = NavigationButton.Next;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- Next();\r
- }\r
- }\r
-\r
- private void Next()\r
- {\r
- if (_tcIndex < _tcIDList.Count - 1)\r
- {\r
- _tcIndex = _tcIndex + 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- }\r
- else if (_tcIndex == _tcIDList.Count - 1)\r
- {\r
- _toastMessage.Message = "This is last testcase";\r
- _toastMessage.Post();\r
- }\r
- }\r
-\r
- private void PreviousTestcase()\r
- {\r
- _pressButton = NavigationButton.Previous;\r
- if (!ManualTest.IsConfirmed())\r
- {\r
- _tsettings.TCResult = StrResult.NOTRUN;\r
- ManualTest.Confirm();\r
- }\r
- else\r
- {\r
- Previous();\r
- }\r
- }\r
-\r
- private void Previous()\r
- {\r
- if (_tcIndex > 0)\r
- {\r
- _tcIndex = _tcIndex - 1;\r
- _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);\r
- _tcResultText.Text = _listItem[_tcIndex].Result;\r
- SetColor(_tcResultText.Text);\r
- UpdateDescriptions();\r
- }\r
- else if (_tcIndex == 0)\r
- {\r
- _toastMessage.Message = "This is first testcase";\r
- _toastMessage.Post();\r
- }\r
- }\r
-\r
- private void SetColor(string result)\r
- {\r
- if (result.Equals(StrResult.PASS))\r
- {\r
- _tcResultText.TextColor = Color.Green;\r
- }\r
- else if (result.Equals(StrResult.FAIL))\r
- {\r
- _tcResultText.TextColor = Color.Red;\r
- }\r
- else if (result.Equals(StrResult.BLOCK))\r
- {\r
- _tcResultText.TextColor = Color.Orange;\r
- }\r
- else\r
- {\r
- _tcResultText.TextColor = Color.White;\r
- }\r
- }\r
-\r
- private int FindMaxLineDescription()\r
- {\r
- int maxLine = 0;\r
- for (int i = 0; i < _tcInfoList.Count; i++)\r
- {\r
- int len = _tcInfoList[i].Steps.Count + _tcInfoList[i].Preconditions.Count + _tcInfoList[i].Postconditions.Count;\r
- maxLine = maxLine < len ? len : maxLine;\r
- }\r
- return maxLine;\r
- }\r
-\r
- private void ShowDescription()\r
- {\r
- int lenght = FindMaxLineDescription() + 3;\r
- var template = new DataTemplate(() =>\r
- {\r
- var grid = new Grid();\r
-\r
- var descriptionLabel = new Label\r
- {\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- LineBreakMode = LineBreakMode.CharacterWrap,\r
- FontSize = 6\r
- };\r
-\r
- descriptionLabel.SetBinding(Label.TextProperty, new Binding("Description"));\r
-\r
- grid.Children.Add(descriptionLabel);\r
-\r
- return new ViewCell\r
- {\r
- View = grid,\r
- };\r
- });\r
-\r
- _tcDescriptions = new ListView()\r
- {\r
- ItemTemplate = template,\r
- HorizontalOptions = LayoutOptions.FillAndExpand,\r
- RowHeight = 110,\r
- Margin = new Thickness(10, 0, 10, 0),\r
- };\r
- _currentTCInfo = new List<TestcaseDescription>();\r
- for (int i = 0; i < lenght; i++)\r
- {\r
- _currentTCInfo.Add(new TestcaseDescription(""));\r
- }\r
- UpdateDescriptions();\r
- _tcDescriptions.ItemsSource = _currentTCInfo;\r
- }\r
-\r
- private void UpdateDescriptions()\r
- {\r
- _prevBtn.IsEnabled = false;\r
- _nextBtn.IsEnabled = false;\r
- int lenght = FindMaxLineDescription() + 3;\r
- for (int i = 0; i < lenght; i++)\r
- {\r
- _currentTCInfo[i].Description = "";\r
- }\r
- int index = 0;\r
- if (_tcInfoList.Count == 0)\r
- {\r
- _toastMessage.Message = "Some testing class wrong, plz recheck";\r
- _toastMessage.Post();\r
- return;\r
- }\r
-\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Collections.Generic;
+using NUnitLite.TUnit;
+using NUnit.Framework.TUnit;
+using NUnit.Framework.Interfaces;
+using System.Reflection;
+using Xamarin.Forms;
+using Tizen.Applications;
+
+namespace WearableTemplate
+{
+ public class TestPage
+ {
+ private static TestPage instance;
+ private static Object lockObject = new object();
+
+ private NavigationPage _navigationPage;
+ private ContentPage _tcContentPage;
+ private Page _tcUIPage;
+ private Label _summaryLabel1, _summaryLabel2, _tcResultText, _descriptionTitle;
+ private ListView _tcDescriptions;
+ private Button _runBtn, _passBtn, _failBtn, _blockBtn;
+ private Button _mainBtn, _prevBtn, _nextBtn;
+ private StackLayout _mainLayout, _tcUILayout;
+
+ private int _tcIndex = 0;
+ private List<string> _tcIDList;
+ private List<ItemData> _listItem;
+ private List<TestcaseInfo> _tcInfoList;
+ private List<TestcaseDescription> _currentTCInfo;
+ private TRunner _tunitRunner;
+ private TSettings _tsettings;
+ private NavigationButton _pressButton = NavigationButton.NA;
+ private ToastMessage _toastMessage;
+
+ private const string STEP_ATTRIBUTE_NAME = "NUnit.Framework.StepAttribute";
+ private const string PRECONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PreconditionAttribute";
+ private const string POSTCONDITION_ATTRIBUTE_NAME = "NUnit.Framework.PostconditionAttribute";
+
+ public event EventHandler<string> TestcaseDone;
+
+ private void OnTestcaseDone(string e)
+ {
+ EventHandler<string> handler = TestcaseDone;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+
+ public NavigationPage getNavigationPage()
+ {
+ return _navigationPage;
+ }
+
+ public static TestPage GetInstance()
+ {
+
+ lock (lockObject)
+ {
+ if (instance == null)
+ {
+ instance = new TestPage();
+ }
+ }
+ return instance;
+ }
+
+ private TestPage()
+ {
+ }
+
+ public void Initialize(TRunner tunitRunner, List<string> testcaseIDList, List<ItemData> listItem)
+ {
+ _toastMessage = new ToastMessage();
+ RunType.Value = RunType.MANUAL;
+ _tunitRunner = tunitRunner;
+ _tunitRunner.SingleTestDone += OnSingleTestDone;
+ _tcInfoList = new List<TestcaseInfo>();
+ _tcIDList = testcaseIDList;
+ _tsettings = TSettings.GetInstance();
+ _tsettings.IsManual = true;
+ _listItem = listItem;
+ MakeTCInfoList();
+
+ _summaryLabel1 = new Label()
+ {
+ Text = "",
+ HeightRequest = 25,
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.Center,
+ TextColor = Color.White,
+ FontSize = 5,
+ };
+ _summaryLabel2 = new Label()
+ {
+ Text = "",
+ HeightRequest = 25,
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.Center,
+ TextColor = Color.White,
+ FontSize = 5,
+ };
+ SetResultNumber(0, 0, 0);
+ MakeTestPage();
+ }
+
+ private void OnSingleTestDone(object sender, SingleTestDoneEventArgs e)
+ {
+ // check old result
+ if (_listItem[_tcIndex].Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail = ResultNumber.Fail - 1;
+ }
+ else if (_listItem[_tcIndex].Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass = ResultNumber.Pass - 1;
+ }
+ else if (_listItem[_tcIndex].Result.Contains(StrResult.BLOCK))
+ ResultNumber.Block = ResultNumber.Block - 1;
+
+ // Update new result
+ _listItem[_tcIndex].Result = e.Result;
+ if (e.Result.Contains(StrResult.PASS))
+ {
+ ResultNumber.Pass += 1;
+ }
+ else if (e.Result.Contains(StrResult.FAIL))
+ {
+ ResultNumber.Fail += 1;
+ }
+ else if (e.Result.Contains(StrResult.BLOCK))
+ {
+ ResultNumber.Block += 1;
+ }
+
+ UpdateLayout();
+ }
+
+ private void UpdateLayout()
+ {
+ SetResultNumber(ResultNumber.Pass, ResultNumber.Fail, ResultNumber.Block);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ if (_tcUILayout != null)
+ {
+ _tcUILayout.Children.Clear();
+ }
+ if (_pressButton == NavigationButton.Next)
+ {
+ Next();
+ }
+ else if (_pressButton == NavigationButton.Previous)
+ {
+ Previous();
+ }
+ else if (_pressButton == NavigationButton.Home)
+ {
+ _navigationPage.PopAsync();
+ }
+ OnTestcaseDone(null);
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ _runBtn.IsEnabled = true;
+ _mainBtn.IsEnabled = true;
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+
+ private void SetResultNumber(int pass, int fail, int block)
+ {
+ ResultNumber.NotRun = ResultNumber.Total - pass - fail - block;
+ _summaryLabel1.Text = "T : " + ResultNumber.Total + ", P : " + pass;
+ _summaryLabel2.Text = "F : " + fail + ", B : " + block + ", NR : " + ResultNumber.NotRun;
+ }
+
+ private void MakeTestPage()
+ {
+ _mainLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Vertical,
+ IsVisible = true,
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ VerticalOptions = LayoutOptions.CenterAndExpand,
+ Spacing = 5,
+ Padding = new Thickness(10),
+ };
+ _descriptionTitle = new Label()
+ {
+ Text = "DESCRIPTION:",
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ HeightRequest = 23,
+ Margin = new Thickness(40, 0, 0, 0),
+ FontSize = 5,
+ TextColor = Color.White,
+ };
+
+ StackLayout functionLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Horizontal,
+ IsVisible = true,
+ HeightRequest = 30,
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ Spacing = 2,
+ Margin = new Thickness(0, 0, 0, 15)
+ };
+
+ _mainBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "H",
+ HeightRequest = 30,
+ WidthRequest = 55,
+ FontSize = 5
+ };
+
+ _mainBtn.Clicked += (sender, e) =>
+ {
+ _pressButton = NavigationButton.Home;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ _navigationPage.PopAsync();
+ }
+ };
+
+ _prevBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "<<",
+ HeightRequest = 30,
+ WidthRequest = 55,
+ FontSize = 4
+ };
+
+ _prevBtn.Clicked += (sender, e) =>
+ {
+ PreviousTestcase();
+ };
+
+ _nextBtn = new Button()
+ {
+ Text = ">>",
+ HorizontalOptions = LayoutOptions.Start,
+ HeightRequest = 30,
+ WidthRequest = 55,
+ FontSize = 4
+ };
+
+ _nextBtn.Clicked += (sender, e) =>
+ {
+ NextTestcase();
+ };
+
+ _tcResultText = new Label()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalTextAlignment = TextAlignment.Center,
+ VerticalTextAlignment = TextAlignment.Center,
+ HeightRequest = 30,
+ FontSize = 3
+ };
+ functionLayout.Children.Add(_mainBtn);
+ functionLayout.Children.Add(_tcResultText);
+ functionLayout.Children.Add(_prevBtn);
+ functionLayout.Children.Add(_nextBtn);
+ // Show description
+ ShowDescription();
+
+ var navigationLayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Horizontal,
+ IsVisible = true,
+ HeightRequest = 30,
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ Spacing = 5,
+ };
+
+ _passBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "P",
+ HeightRequest = 30,
+ IsEnabled = false,
+ FontSize = 5,
+ WidthRequest = 60
+ };
+
+ _passBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.PASS;
+ ManualTest.Confirm();
+ }
+ };
+
+ _failBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "F",
+ HeightRequest = 30,
+ IsEnabled = false,
+ FontSize = 5,
+ WidthRequest = 60
+ };
+
+ _failBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.FAIL;
+ ManualTest.Confirm();
+ }
+ };
+
+ _blockBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "B",
+ HeightRequest = 30,
+ IsEnabled = false,
+ FontSize = 5,
+ WidthRequest = 60
+ };
+
+ _blockBtn.Clicked += (sender, e) =>
+ {
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.BLOCK;
+ ManualTest.Confirm();
+ }
+ };
+
+ _runBtn = new Button()
+ {
+ HorizontalOptions = LayoutOptions.Start,
+ Text = "R",
+ HeightRequest = 30,
+ FontSize = 5,
+ WidthRequest = 60
+ };
+
+ _runBtn.Clicked += (sender, e) =>
+ {
+ LockUIButton();
+ _pressButton = NavigationButton.NA;
+ _tsettings.Testcase_ID = _tcIDList[_tcIndex];
+ _tsettings.TCResult = "";
+ _tunitRunner.Execute();
+ };
+
+ navigationLayout.Children.Add(_passBtn);
+ navigationLayout.Children.Add(_failBtn);
+ navigationLayout.Children.Add(_blockBtn);
+ navigationLayout.Children.Add(_runBtn);
+
+ _tcUILayout = new StackLayout()
+ {
+ Orientation = StackOrientation.Vertical,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.Start,
+ HeightRequest = 40,
+ WidthRequest = 280,
+ Margin = new Thickness(10, 0, 10, 0)
+ };
+
+ _mainLayout.Children.Add(_summaryLabel1);
+ _mainLayout.Children.Add(_summaryLabel2);
+ _mainLayout.Children.Add(_descriptionTitle);
+ _mainLayout.Children.Add(_tcDescriptions);
+ _mainLayout.Children.Add(_tcUILayout);
+ _mainLayout.Children.Add(navigationLayout);
+ _mainLayout.Children.Add(functionLayout);
+ _tcContentPage = new ContentPage()
+ {
+ Content = _mainLayout
+ };
+ NavigationPage.SetHasNavigationBar(_tcContentPage, false);
+ }
+
+ public void LockUIButton()
+ {
+ _runBtn.IsEnabled = false;
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ _mainBtn.IsEnabled = false;
+ _prevBtn.IsEnabled = false;
+ _nextBtn.IsEnabled = false;
+
+ }
+
+ public void UnlockUIButton()
+ {
+ _passBtn.IsEnabled = true;
+ _failBtn.IsEnabled = true;
+ _blockBtn.IsEnabled = true;
+ _mainBtn.IsEnabled = true;
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+
+ public void Show(NavigationPage navigationPage, int testcaseIndex)
+ {
+ _navigationPage = navigationPage;
+ _tcIndex = testcaseIndex - 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + testcaseIndex;
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ navigationPage.PushAsync(_tcContentPage);
+ _passBtn.IsEnabled = false;
+ _failBtn.IsEnabled = false;
+ _blockBtn.IsEnabled = false;
+ }
+
+ private void NextTestcase()
+ {
+ _pressButton = NavigationButton.Next;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ Next();
+ }
+ }
+
+ private void Next()
+ {
+ if (_tcIndex < _tcIDList.Count - 1)
+ {
+ _tcIndex = _tcIndex + 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ }
+ else if (_tcIndex == _tcIDList.Count - 1)
+ {
+ _toastMessage.Message = "This is last testcase";
+ _toastMessage.Post();
+ }
+ }
+
+ private void PreviousTestcase()
+ {
+ _pressButton = NavigationButton.Previous;
+ if (!ManualTest.IsConfirmed())
+ {
+ _tsettings.TCResult = StrResult.NOTRUN;
+ ManualTest.Confirm();
+ }
+ else
+ {
+ Previous();
+ }
+ }
+
+ private void Previous()
+ {
+ if (_tcIndex > 0)
+ {
+ _tcIndex = _tcIndex - 1;
+ _descriptionTitle.Text = "DESCRIPTION : #" + (_tcIndex + 1);
+ _tcResultText.Text = _listItem[_tcIndex].Result;
+ SetColor(_tcResultText.Text);
+ UpdateDescriptions();
+ }
+ else if (_tcIndex == 0)
+ {
+ _toastMessage.Message = "This is first testcase";
+ _toastMessage.Post();
+ }
+ }
+
+ private void SetColor(string result)
+ {
+ if (result.Equals(StrResult.PASS))
+ {
+ _tcResultText.TextColor = Color.Green;
+ }
+ else if (result.Equals(StrResult.FAIL))
+ {
+ _tcResultText.TextColor = Color.Red;
+ }
+ else if (result.Equals(StrResult.BLOCK))
+ {
+ _tcResultText.TextColor = Color.Orange;
+ }
+ else
+ {
+ _tcResultText.TextColor = Color.White;
+ }
+ }
+
+ private int FindMaxLineDescription()
+ {
+ int maxLine = 0;
+ for (int i = 0; i < _tcInfoList.Count; i++)
+ {
+ int len = _tcInfoList[i].Steps.Count + _tcInfoList[i].Preconditions.Count + _tcInfoList[i].Postconditions.Count;
+ maxLine = maxLine < len ? len : maxLine;
+ }
+ return maxLine;
+ }
+
+ private void ShowDescription()
+ {
+ int lenght = FindMaxLineDescription() + 3;
+ var template = new DataTemplate(() =>
+ {
+ var grid = new Grid();
+
+ var descriptionLabel = new Label
+ {
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ LineBreakMode = LineBreakMode.CharacterWrap,
+ FontSize = 6
+ };
+
+ descriptionLabel.SetBinding(Label.TextProperty, new Binding("Description"));
+
+ grid.Children.Add(descriptionLabel);
+
+ return new ViewCell
+ {
+ View = grid,
+ };
+ });
+
+ _tcDescriptions = new ListView()
+ {
+ ItemTemplate = template,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ RowHeight = 110,
+ Margin = new Thickness(10, 0, 10, 0),
+ };
+ _currentTCInfo = new List<TestcaseDescription>();
+ for (int i = 0; i < lenght; i++)
+ {
+ _currentTCInfo.Add(new TestcaseDescription(""));
+ }
+ UpdateDescriptions();
+ _tcDescriptions.ItemsSource = _currentTCInfo;
+ }
+
+ private void UpdateDescriptions()
+ {
+ _prevBtn.IsEnabled = false;
+ _nextBtn.IsEnabled = false;
+ int lenght = FindMaxLineDescription() + 3;
+ for (int i = 0; i < lenght; i++)
+ {
+ _currentTCInfo[i].Description = "";
+ }
+ int index = 0;
+ if (_tcInfoList.Count == 0)
+ {
+ _toastMessage.Message = "Some testing class wrong, plz recheck";
+ _toastMessage.Post();
+ return;
+ }
+
_currentTCInfo[index].Description = "TC : " + _tcInfoList[_tcIndex].TestcaseName;
- TLogger.Write("############### TC Name:" + _tcInfoList[_tcIndex].TestcaseName);\r
- foreach (string precondition in _tcInfoList[_tcIndex].Preconditions.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = precondition;\r
- }\r
- foreach (string step in _tcInfoList[_tcIndex].Steps.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = step;\r
- }\r
- foreach (string postcondition in _tcInfoList[_tcIndex].Postconditions.ToArray())\r
- {\r
- index++;\r
- _currentTCInfo[index].Description = postcondition;\r
- }\r
- _prevBtn.IsEnabled = true;\r
- _nextBtn.IsEnabled = true;\r
- }\r
-\r
- private void MakeTCInfoList()\r
- {\r
- foreach (var testcaseItem in _listItem)\r
- {\r
- foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())\r
- {\r
- if (testcaseItem.TCName.Equals(pair.Key))\r
- {\r
- IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();\r
- List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");\r
- List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");\r
- List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");\r
-\r
- while (customAttributes.MoveNext())\r
- {\r
- if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))\r
- {\r
- _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))\r
- {\r
- _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))\r
- {\r
- _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
- }\r
- }\r
-\r
- _tcInfoList.Add(new TestcaseInfo\r
- {\r
- TestcaseName = pair.Key,\r
- Preconditions = _preconditonsStr,\r
- Steps = _stepsStr,\r
- Postconditions = _postconditionsStr,\r
- });\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- public void ExecuteTC(Layout layout)\r
- {\r
- _tcUILayout.Children.Add(layout);\r
- }\r
-\r
- public void ExecuteTC(Page page)\r
- {\r
- _tcUIPage = page;\r
- _navigationPage.PushAsync(page);\r
- }\r
- }\r
-}\r
+ TLogger.Write("############### TC Name:" + _tcInfoList[_tcIndex].TestcaseName);
+ foreach (string precondition in _tcInfoList[_tcIndex].Preconditions.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = precondition;
+ }
+ foreach (string step in _tcInfoList[_tcIndex].Steps.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = step;
+ }
+ foreach (string postcondition in _tcInfoList[_tcIndex].Postconditions.ToArray())
+ {
+ index++;
+ _currentTCInfo[index].Description = postcondition;
+ }
+ _prevBtn.IsEnabled = true;
+ _nextBtn.IsEnabled = true;
+ }
+
+ private void MakeTCInfoList()
+ {
+ foreach (var testcaseItem in _listItem)
+ {
+ foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())
+ {
+ if (testcaseItem.TCName.Equals(pair.Key))
+ {
+ IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
+ List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");
+ List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");
+ List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");
+
+ while (customAttributes.MoveNext())
+ {
+ if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
+ {
+ _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
+ {
+ _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
+ {
+ _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+ }
+ }
+
+ _tcInfoList.Add(new TestcaseInfo
+ {
+ TestcaseName = pair.Key,
+ Preconditions = _preconditonsStr,
+ Steps = _stepsStr,
+ Postconditions = _postconditionsStr,
+ });
+ break;
+ }
+ }
+ }
+ }
+
+ public void ExecuteTC(Layout layout)
+ {
+ _tcUILayout.Children.Add(layout);
+ }
+
+ public void ExecuteTC(Page page)
+ {
+ _tcUIPage = page;
+ _navigationPage.PushAsync(page);
+ }
+ }
+}
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * See the License for the specific language governing permissions and
* limitations under the License
*/
using System;
-using NUnitLite.TUnit;
-using AutoTemplate;
+using Tizen.Auto.Template;
-namespace XamarinForTizen.Tizen
+namespace Tizen.Applications.Tests
{
- class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ public class Program
{
- private static App _app;
- protected override void OnCreate()
- {
- base.OnCreate();
-
- Console.WriteLine("TCT : OnCreate()");
- _app = new App();
- LoadApplication(_app);
-
- TRunner t = new TRunner();
- t.LoadTestsuite();
- t.Execute();
- }
-
- public static App getApp()
- {
- return _app;
- }
static void Main(string[] args)
{
- Console.WriteLine("TCT : Main()");
- var app = new Program();
- global::Xamarin.Forms.Forms.Init(app);
+ Console.WriteLine("TCT CSharp: Main()");
+ var app = new App();
app.Run(args);
}
}
* limitations under the License
*/
+
+
using System;
-using NUnit.Framework;
-using Xamarin.Forms;
+using NUnitLite.TUnit;
+using Tizen.NUI;
+using Tizen.Manual.Template;
-namespace XamarinApplication.Tizen
+namespace Tizen.Applications.AttachPanel.Manual.Tests
{
- class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ public class Program : NUIApplication
{
- private Application _app;
+
protected override void OnCreate()
{
Console.WriteLine("TCT : OnCreate()");
base.OnCreate();
- if (ManualTest.IsWearable())
- {
- _app = new WearableTemplate.MainPage();
- }
- else
- {
- _app = new ManualTemplate.MainPage();
- }
- LoadApplication(_app);
+ ManualTemplate.GetInstance();
}
static void Main(string[] args)
{
Console.WriteLine("TCT : Main()");
var app = new Program();
- global::Xamarin.Forms.Forms.Init(app);
app.Run(args);
}
}