Pinscher Testing

“How can I best get up the mountain?” – Just climb upwards, and don’t think about it! Friedrich Nietzsche

Winium – Windows Phone Testing

Winium, as Appium, is an open source test automation tool, Selenium-based tool, for testing Windows Phone Apps on Emulators.
Winium is an alternative to Coded UI, test automation tool of Visual Studio Enterprise.

In the project that you want to test you just need to add the reference to Winium.StoreApps.InnerServer, run the following command in the Package Manager Console of Visual Studio:
Install-Package Winium.StoreApps.InnerServer

At the source code following add lines to be called on the UI thread after visual root is initialized:
AutomationServer.Instance.InitializeAndStart();

For each element that you want test need to add this instruction:
AutomationProperties.AutomationId = “loginpage” AutomationProperties.Name = “loginpage” (for example you want to scroll login page).

If you want to write tests in Python you need to install Python and Selenium Package:
pip install selenium (selenium-python-installation)

Download and Start Winium Server (Winium.StoreApps.Driver.exe):
Winium.StoreApps.Driver.zip

and run tests. (python test_register_form.py).

Test Register Form with Winium, example:


# coding: utf-8
import unittest
import os

from selenium.webdriver import Remote
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

class TestMainPage(unittest.TestCase):
desired_capabilities = {
"app": os.getenv('APPX', '') #we take appx from env and from a job on jenkins (see under test)
}

def setUp(self):
self.driver = Remote(command_executor="http://localhost:9999",
desired_capabilities=self.desired_capabilities)

def test_content(self):
driver = self.driver

#close keyboard
#name_login.send_keys(Keys.RETURN)
login_page = driver.find_element_by_id('loginPage')
login_page.click()

button_register = driver.find_element_by_id('RegisterBtn')
button_register.click()

#step 1
name = driver.find_element_by_id('name')
name.send_keys("nametest")
name = driver.find_element_by_id('surname')
name.send_keys("surnametest")
credential_page = driver.find_element_by_id('credentialPage')
credential_page.click()
button_next = driver.find_element_by_id('nextbutton')
button_next.click()

#step 2
phone = driver.find_element_by_id('phone')
phone.send_keys("0123456789")
email = driver.find_element_by_id('email')
email.send_keys("testemail@wind.it")
contact_page = driver.find_element_by_id('contactPage')
contact_page.click()
button_next = driver.find_element_by_id('nextbutton')
button_next.click()

#step 3
otp = driver.find_element_by_id('otp')
otp.send_keys("4444")
otp_page = driver.find_element_by_id('otpPage')
otp_page.click()
button_next = driver.find_element_by_id('nextbutton')
button_next.click()

#step 4
#switch on/off
privacy = driver.find_element_by_id('privacy')
privacy.click()
button_next = driver.find_element_by_id('nextbutton')
button_next.click()

#step 5
password = driver.find_element_by_id('password')
password.send_keys("passwordtest")
conferma_password = driver.find_element_by_id('confermapassword')
conferma_password.send_keys("passwordtest")
password_page = driver.find_element_by_id('passwordPage')
password_page.click()
button_next = driver.find_element_by_id('nextbutton')
button_next.click()

def tearDown(self):
self.driver.quit()

if __name__ == '__main__':
unittest.main()

 

Jenkins job to creation APPX (execute windows batch command):
nuget restore ExampleApp.sln
MSBuild /t:Clean,Build /p:Configuration=Release

Winium.StoreApps

Happy testing on Windows Phone Apps!;)

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Previous

The Test Tower

Next

STF – Smartphone Test Farm for Android

4 Comments

  1. We have developed a Win App on Windows 10 Phone, however we have already Appxbundle file that needs to be installed on the Win 10 phone such as Lumia 950. We have installed this App with Developer mode enabled. My requirement is that i need to install the Appxbundle or Appx package on the Win Phone device and test the basic functionality, by identifying the UI Ids. I read couple of blog and tried, but could not get ant break through. Please let me know the procedure for achieving above.

    Thanks,
    Abhijith

    • pinscher_testing

      Hi Abhijith,
      which step is not clear? Where do you found the problem?

      GC

  2. I must run the some tests on Windows 10 Phone ( Lumia 950 and 550). The application is still under Development, hence we are planning for Automation the App feature.
    My requirement –
    1. Need to deployment Appxbundle on the Win Phone Device
    2. As the App are under Development, the understanding of UI IDs is unclear ( how to use Inspector tool to get IDs or is there any other methods).

    Thanks,
    Abhi

    • pinscher_testing

      1. Through Visual Studio (then deploy the app directly on your device) or you can load the application on the store in Beta mode (thus indicating the email addresses of people who can download the app).

      2. The IDs must set them on the UI objects, then in .xaml application file (each ui object has its id or name).

      Thanks
      GC

Leave a Reply

*

Powered by WordPress & Theme by Anders Norén