Advertisement
ekostadinov

Sample SeeTest Login Testcase

Mar 7th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.32 KB | None | 0 0
  1.  
  2. namespace Experitest
  3. {
  4.  
  5. using System;
  6. using System.Management.Instrumentation;
  7. using System.Text;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using Microsoft.VisualStudio.TestTools.UnitTesting;
  11. using experitestClient;
  12.  
  13.     [TestClass]
  14.     public class LoginAll
  15.     {
  16.         //fields
  17.         #region
  18.         private string host = "localhost";
  19.         private int port = 8889;
  20.         private string projectBaseDirectory = "D:\\Projects\\Project\\ProjectTests\\ProjectSvnRepository\\ProjectSEETESTStudio";
  21.         protected Client client = null;
  22.         #endregion
  23.  
  24.         //properties
  25.         #region
  26.         public string LoginZone
  27.         {
  28.             get {return "Login_Zone";}
  29.         }
  30.  
  31.         public string ServicesLoginZone
  32.         {
  33.             get { return "ServicesLogin_Zone"; }
  34.         }
  35.         #endregion
  36.  
  37.         //methods
  38.         #region
  39.         [TestInitialize()]
  40.         public void SetupTest()
  41.         {
  42.             client = new Client(host, port);
  43.             client.SetProjectBaseDirectory( projectBaseDirectory);
  44.             client.SetReporter("xml", "reports", "LoginAll");
  45.         }
  46.  
  47.         [TestMethod]
  48.         public void TestLoginAll()
  49.         {
  50.             client.SetDevice("wp:Windows Phone 8S by HTC");
  51.             client.Sleep(1000);
  52.             client.VerifyElementFound(LoginZone, "Wellcome_label", 0);
  53.             client.VerifyElementFound(LoginZone, "Login_link", 0);
  54.             client.Click(LoginZone, "Login_link", 0, 1);
  55.             client.Sleep(1000);
  56.  
  57.             if (client.WaitForElement(ServicesLoginZone, "form_login", 0, 30000) == false)
  58.             {
  59.                 throw new InstanceNotFoundException("Not loaded ServicesLogin Zone");                  
  60.             }
  61.  
  62.             client.VerifyElementFound(ServicesLoginZone, "Services label", 0);
  63.             client.ElementSendText(ServicesLoginZone, "Number_Input", 0, "");
  64.             client.ElementSendText(ServicesLoginZone, "Number_Input", 0, "3211610");
  65.            
  66.             client.ElementSendText("NATIVE", "xpath=//*[@name='form_pin']", 0, "0593");
  67.             client.Click(ServicesLoginZone, "LoginViaPIN_Btn", 0, 1);
  68.         }
  69.  
  70.         [TestCleanup()]
  71.         public void TearDown()
  72.         {
  73.             client.GenerateReport();
  74.         }
  75.         #endregion
  76.  
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement