SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Automated	
  Tes,ng	
  for	
  Mobile	
  Applica,ons	
  
      An	
  experimental	
  technique	
  
                 Eing	
  Ong,	
  Intuit	
  Inc.	
  
              Louis	
  daRosa,	
  Intuit	
  Inc.	
  
Session	
  outline	
  

•  	
  Introduc,on	
  
•  	
  Simulator	
  basics	
  
•  	
  Simulator	
  library	
  	
  
•  	
  Building	
  your	
  mobile	
  app	
  library	
  
•  	
  Wri,ng	
  reusable	
  test	
  cases	
  
•  	
  Mobile	
  test	
  automa,on	
  framework	
  	
  
•  	
  Advantages	
  and	
  limita,ons	
  
•  	
  Q	
  &	
  A	
  


2
Introduc,on	
  

What	
  are	
  we	
  solving	
  for	
  ?	
  
      • 	
  Various	
  BB	
  OS	
  and	
  devices	
  
      • 	
  End-­‐to-­‐end	
  mobile	
  tests	
  
      • 	
  Low	
  cost	
  solu,on	
  
      • 	
  Mul,ple	
  mobile	
  plaLorms	
  




3
Simulator	
  Basics	
  

BlackBerry®	
  JDE	
  tool	
  kit	
  
     •  Mobile	
  data	
  service	
  (MDS)	
  
     •  Simulators	
  suite	
  
     •  App	
  installa,on	
  
     •  Image	
  capture	
  




4
Simulator	
  Basics	
  

BlackBerry®	
  simulator	
  
    •  Star<ng	
  simulator	
  
    	
  	
  	
  	
  	
  	
  fledge.exe	
  	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  /app=jvm.dll	
  	
  	
  	
  	
  	
  	
  	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  /session=<model>	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  /app-­‐param=	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  JvmAlxConfigFile:<model>.xml	
  	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  /handheld=<model>	
  
    •  Communica<ng	
  with	
  simulator	
  
    	
  	
  	
  	
  	
  	
  fledgecontroller.exe	
  	
  
    	
  	
  	
  	
  	
  	
  	
  	
  	
  /session=<model>	
  




5
Simulator	
  Basics	
  

Ac<ons	
                 Steps	
  
Start	
  9630	
  Tour	
   fledge.exe	
  /app=jvm.dll	
  	
  
simulator	
               	
  	
  	
  	
  /session=9630	
  /handheld=9630	
  
                         	
  	
  	
  	
  /app-­‐param=JvmAlxConfigFile:
                                        9630.xml	
  	
  
Install	
                1.	
  Copy	
  app.jar,	
  app.jad,	
  app.cod	
  to	
  
applica,on	
                            Javaloader	
  directory	
  
                         2.	
  JavaLoader.exe	
  	
  –u	
  load	
  app.jad	
  
                         3.	
  Delete	
  app.jar,	
  app.jad,	
  app.cod	
  
Save	
  screenshot	
   1.	
  JavaLoader.exe	
  	
  –u	
  screenshot	
  
as	
  test.png	
  in	
       test.png	
  
$TEST_OUTPUT	
  
                         2.	
  mv	
  test.png	
  $TEST_OUTPUT	
  


6
Simulator	
  Basics	
  

Ac<ons	
                 Steps	
                                                   bblib.py	
  
Start	
  9630	
  Tour	
   fledge.exe	
  /app=jvm.dll	
  	
                          fledgeStart()	
  
simulator	
               	
  	
  	
  	
  /session=9630	
  /handheld=9630	
  
                         	
  	
  	
  	
  /app-­‐param=JvmAlxConfigFile:
                                        9630.xml	
  	
  
Install	
                1.	
  Copy	
  app.jar,	
  app.jad,	
  app.cod	
  to	
     install()	
  
applica,on	
                            Javaloader	
  directory	
  
                         2.	
  JavaLoader.exe	
  	
  –u	
  load	
  app.jad	
  
                         3.	
  Delete	
  app.jar,	
  app.jad,	
  app.cod	
  
Save	
  screenshot	
   1.	
  JavaLoader.exe	
  	
  –u	
  screenshot	
              getScreenShot(‘test’)	
  
as	
  test.png	
  in	
       test.png	
  
$TEST_OUTPUT	
  
                         2.	
  mv	
  test.png	
  $TEST_OUTPUT	
  


7
Simulator	
  commands	
  

Ac<on	
               Steps	
  
Enter	
  'Hello	
     StringInjec,on(Hello)	
  
World'	
              KeyPress(SPACE)	
  
                      KeyRelease(SPACE)	
  
                      StringInjec,on(World)	
  
Backspace	
  2	
      KeyPress(BACKSPACE)	
  
,mes	
                KeyRelease(BACKSPACE)	
  
                      KeyPress(BACKSPACE)	
  
                     KeyRelease(BACKSPACE)	
  
Thumbwheel	
  up	
   ThumbWheelRoll(-­‐1)	
  
twice	
              ThumbWheelRoll(-­‐1)	
  


8
Simulator	
  commands	
  

Ac<on	
               Steps	
                     bblib.py	
  
Enter	
  'Hello	
     StringInjec,on(Hello)	
     enter(‘Hello	
  World')	
  
World'	
              KeyPress(SPACE)	
  
                      KeyRelease(SPACE)	
  
                      StringInjec,on(World)	
  
Backspace	
  2	
      KeyPress(BACKSPACE)	
       backspaces(2)	
  
,mes	
                KeyRelease(BACKSPACE)	
  
                      KeyPress(BACKSPACE)	
  
                     KeyRelease(BACKSPACE)	
  
Thumbwheel	
  up	
   ThumbWheelRoll(-­‐1)	
       thumbwheel	
  ('up',	
  	
  	
  	
  	
  
twice	
              ThumbWheelRoll(-­‐1)	
       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  2)	
  


9
Simulator	
  commands	
  

Ac<on	
               Steps	
                                      bblib.py	
  
Touch	
  screen	
  at	
   TouchScreenPress(10,	
  100,	
  0)	
     touch(10,	
  100)	
  
(10,	
  100)	
            TouchScreenClick()	
  
                      TouchScreenUnclick()	
  
                      TouchScreenUnpress(0)	
  




10
bblib.py	
  

Setup	
  
    •  fledgeStart()	
  
     •  javaloaderStart()	
  
     •  mdsStart()	
  

Basic	
  key	
  events	
  
    •  backspaces(count)	
  
     •  enter()	
  
     •  enter(string)	
  
     •  menu()	
  	
  
     •  escape()	
  	
  
     •  pause(seconds)	
  
11
bblib.py	
  

Naviga<on	
  
    •  thumbwheel('up',	
  count)	
  
     •  thumbwheel(‘down',	
  count)	
  
     •  trackball('up’,	
  count)	
  
     •  trackball(‘down’,	
  count)	
  
     •  trackball(‘lek’,	
  count)	
  
     •  trackball(‘right’,	
  count)	
  
     •  touch(x,y)	
  




12
Case	
  study	
  –	
  Address	
  Book	
  Demo	
  

 •  Devices	
  
      –  Pearl	
  
      –  Storm	
  
 •  Simulator	
  library	
  
 •  Address	
  book	
  
      –  Add	
  contact	
  
      –  Find	
  contact	
  
      –  Delete	
  contact	
  
 •  Automated	
  tests	
  


 13
Test	
  Automa,on	
  Overview	
  

1.  Define	
  applica<on	
  interface	
  
      This	
  interface	
  is	
  device-­‐agnos,c.	
  
2.  Implement	
  the	
  interface	
  
     Implement	
  interface	
  in	
  BlackBerry®	
  	
  
     U,lize	
  Python™	
  mobile	
  libraries	
  e.g.	
  bblib.py.	
  
3.  Write	
  your	
  tests	
  
     Tests	
  are	
  device	
  independent	
  and	
  reusable.	
  
4.  Run	
  



14
Step	
  1	
  :	
  Define	
  applica,on	
  interface	
  

 class	
  AppInterface:	
  
 	
  	
  	
  	
  """Applica,on	
  Interface"""	
  
 	
  	
  	
  	
  def	
  	
  launch(self):	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  """Launch	
  app"""	
  
 	
  	
  	
  	
  def	
  add(self,	
  contact):	
  
 	
  	
  	
  	
  	
  	
  	
  	
  """Add	
  a	
  contact"""	
  
 	
  	
  	
  	
  def	
  find(self,	
  contact):	
  
 	
  	
  	
  	
  	
  	
  	
  	
  """Find	
  contact"""	
  
 	
  	
  	
  	
  def	
  delete(self):	
  
 	
  	
  	
  	
  	
  	
  	
  	
  """Delete	
  current	
  contact"""	
  
 	
  
 15
Test	
  Automa,on	
  Overview	
  

1.  Define	
  applica<on	
  interface	
  
      This	
  interface	
  is	
  device-­‐agnos,c.	
  
2.  Implement	
  the	
  interface	
  
     Implement	
  interface	
  in	
  BlackBerry®	
  	
  
     U,lize	
  Python™	
  mobile	
  libraries	
  e.g.	
  bblib.py.	
  
3.  Write	
  your	
  tests	
  
     Tests	
  are	
  device	
  independent	
  and	
  reusable.	
  
4.  Run	
  



16
Step	
  2	
  (Storm):	
  Implement	
  the	
  interface	
  

 def	
  StormImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            touch(100,	
  50)	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            touch(50,	
  300)	
  



  17	
  
Step	
  2	
  (Storm):	
  Implement	
  the	
  interface	
  

 def	
  StormImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            touch(100,	
  50)	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            touch(50,	
  300)	
  



  18	
  
Step	
  2	
  (Storm):	
  Implement	
  the	
  interface	
  

 def	
  StormImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            touch(100,	
  50)	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            touch(50,	
  300)	
  



  19	
  
Step	
  2	
  (Pearl):	
  Implement	
  the	
  interface	
  

 def	
  PearlImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            enter()	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            enter()



  20	
  
Step	
  2	
  (Pearl):	
  Implement	
  the	
  interface	
  

 def	
  PearlImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            enter()	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            enter()



  21	
  
Step	
  2	
  (Pearl):	
  Implement	
  the	
  interface	
  

 def	
  PearlImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
  
                                            enter()	
  
                                            enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            enter()



  22	
  
Step	
  2	
  Recap:	
  Implement	
  the	
  interface	
  

 def	
  StormImpl(appbase.AppInterface):	
   	
  	
  	
  def	
  PearlImpl(appbase.AppInterface):	
  
                      def	
  add(self,	
  contact):	
  	
                                                               def	
  add(self,	
  contact):	
  	
  
                                            touch(100,	
  50)	
                                                                               enter()	
  
                                            enter(contact.getFirstname()	
                                                                    enter(contact.getFirstname()	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  thumbwheel('down',	
  1)	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  enter(contact.getLastname())	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
                       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #	
  save	
  
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
                          	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  menu()	
  
                                            touch(50,	
  300)	
                                                                               enter()	
  
                                                                                                   	
  

  23	
  
Test	
  Automa,on	
  Overview	
  

1.  Define	
  applica<on	
  interface	
  
      This	
  interface	
  is	
  device-­‐agnos,c.	
  
2.  Implement	
  the	
  interface	
  
     Implement	
  interface	
  in	
  BlackBerry®	
  	
  
     U,lize	
  Python™	
  mobile	
  libraries	
  e.g.	
  bblib.py.	
  
3.  Write	
  your	
  tests	
  
     Tests	
  are	
  device	
  independent	
  and	
  reusable.	
  
4.  Run	
  



24
Step	
  3	
  :	
  Wri,ng	
  tests	
  

 class	
  AddContactTest(uniqest.TestCase):	
  
      	
  
      device	
  =	
  testenv.getDeviceClass()	
  
      	
  
          def	
  addContactWithOnlyFirstnameTest(self):	
  
          	
  	
  	
  	
  self.contact.setFirstname(firstname)	
  
          	
  	
  	
  	
  self.device.add(self.contact)	
  
          	
  
          def	
  addContactWithOnlyLastnameTest(self):	
  
          	
  	
  	
  	
  self.contact.setLastname(firstname)	
  
          	
  	
  	
  	
  self.device.add(self.contact)	
  
          	
  
 	
  25
Step	
  3	
  :	
  Run,me	
  device	
  binding	
  

 def getDeviceClass(self):
        """ Returns the device to test """

          mobileDevice = self.getMobileDevice()

         if mobileDevice ==        'pearl':
              import pearl
              deviceClass =        pearl.PearlImpl()
          elif mobileDevice        == 'storm':
              import storm
              deviceClass =        storm.StormImpl()
          else:
              import bb
              deviceClass =        bb.BlackBerry()

           return deviceClass


 26
More	
  device-­‐independent	
  tests	
  

 Addi<onal	
  tests	
  are	
  easy	
  to	
  write	
  
 	
  


        def	
  addContactWithEmailTest(self):	
  
        def	
  addContactWithAddressesTest(self):	
  
        def	
  addContactWithAllDetailsTest(self):	
  
        def	
  addContactWithLongDetailsTest(self):	
  
        def	
  addContactAddressWithStateZip(self):	
  
        def	
  addContactAddressWithCityStateZip(self):	
  
        def	
  addContactAddressWithNoDataNega,veTest(self):	
  
 	
  
 	
  
 27
Step	
  4	
  :	
  Run	
  

  •  Basic	
  run	
  command	
  
         –  python	
  <test.py>	
  
  	
  
  •  Python™	
  test	
  frameworks	
  
         –  uniqest	
  
         –  PyUnit	
  	
  
         –  python-­‐nose	
  
  	
  
  	
  


  28
Test	
  Verifica,on	
  

 •  Server	
  hosted	
  apps	
  
      –  API	
  asser,ons	
  
      –  Database	
  asser,ons	
  
 •  Image	
  asser,ons	
  
      	
  
      self.assertTrue(imagelib.compare(self.device,	
  testname,	
  '100%x90%‘))	
  
      	
  
      imagelib.py	
  :	
  
            def	
  compare(device,	
  imageName,	
  crop=None,	
  tolerance=500)	
  




 29
Logging	
  

 •  Ini,aliza,on	
  
      self.log	
  =	
  self.device.initLogger(self._testMethodName,	
  	
  
      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  self.__class__.__name__)	
  
 •  Usage	
  
      self.log.info('Star,ng	
  test:	
  '	
  +	
  self._testMethodName)	
  
      self.log.debug(self.contact)	
  
      self.log.error(‘Missing	
  image	
  to	
  compare’)	
  
 •  Logs	
  
      AddressTest.log	
  :	
  	
  
      2010-­‐06-­‐10	
  15:19:46,773	
  -­‐	
  testCreateAddressMethod	
  -­‐	
  INFO	
  -­‐	
  
                         	
  [Address1]	
  200	
  Villa	
  St	
  Mountain	
  View	
  CA	
  94040	
  BUSINESS	
  ADDRESS	
  


 30
Login	
  example	
  on	
  BlackBerry®	
  Pearl	
  
      Interface

                   def	
  login(username,	
  passwd)
                                                   	
  
        Test (logintest.py)

                    login(‘user100’,’helloworld’)
                                                	
  



           enter(username)	
  
                                                     def	
  enter(str)	
  
           scroll(‘down’)	
  
                                                     def	
  scroll(ac<on)	
  
           enter(password)	
  
                                                     def	
  enter()	
  
           enter()	
  

              pearlapp.py                            bblib.py
 31
Login	
  example	
  on	
  BlackBerry®	
  Storm	
  	
  	
  
       Interface

                      def	
  login(username,	
  passwd)
                                                      	
  
        Test (logintest.py)

                       login(‘user100’,’helloworld’)
                                                   	
  


             touch(100,100)	
  
             enter(username)	
  
                                                             def	
  enter()	
  
             touch(100,200)	
  
                                                             def	
  touch(x,y)	
  
             enter(password)	
  
             touch(150,	
  300)	
  
               stormapp.py                                   bblib.py
 32
Mobile	
  Tes,ng	
  Framework	
  


                      Mobile	
  Applica<on	
  Interface	
  

 Python™ Test Framework


                         Device	
  Independent	
  Tests
                                                      	
  
                             Runtime device binding
 Simulator libraries


          BB	
  	
  app	
  library	
           Mobile	
  app	
  library	
  

         BB	
  device	
  library	
                Device	
  library	
  
 33
Advantages	
  

•  Zero	
  cost	
  to	
  use	
  	
  
•  No	
  device	
  sharing/scheduling	
  
•  Bigger	
  device	
  pool	
  
•  Reduce	
  manual	
  tes,ng	
  ,me	
  
•  Run	
  on	
  developers	
  machines	
  
•  Debugging	
  capabili,es	
  




 34
Limita,ons	
  

 •  Requires	
  ethernet	
  or	
  internet	
  connec,vity	
  
 •  Does	
  not	
  simulate	
  network	
  performance	
  
 •  Does	
  not	
  support	
  hardware	
  controls	
  tes,ng	
  
 •  Dependent	
  on	
  simulator	
  reliability	
  
 •  Limited	
  peer-­‐to-­‐peer	
  applica,ons	
  tes,ng	
  




 35
Resources	
  

 BlackBerry	
  ®	
  JDE	
  Downloads	
  
 hqp://na.blackberry.com/eng/developers/javaappdev/javadevenv.jsp	
  

 Documenta<on	
  
 Fledge	
  controller	
  
 hqp://docs.blackberry.com/en/developers/deliverables/15476/Test_B	
  
 BSmrtphnSmltr_events_using_script_607587_11.jsp	
  
 BlackBerry	
  ®	
  Simulator	
  Tes,ng	
  
 hqp://docs.blackberry.com/en/developers/deliverables/6338/Tes,ng_apps_using_the	
  
 _BBSmrtphnSmltr_607559_11.jsp	
  
 Python	
  ™	
  
 hqp://docs.python.org/	
  
 	
  
 BlackBerry	
  ® Developers	
  Forum	
  
 hqp://supporLorums.blackberry.com/	
  

 36
Acknowledgments	
  

 •  Desiree	
  Gosby,	
  Mobile	
  Architect	
  

 •  Paul	
  Hau,	
  QA	
  Manager	
  

 •  Jaron	
  Jones,	
  QA	
  Manager	
  

 •  Jason	
  Pugh,	
  Architect	
  (definitely	
  not	
  least)	
  




 37
Q	
  &	
  A	
  




  38
Thanks	
  and	
  enjoy	
  the	
  rest	
  of	
  DevCon	
  2010!	
  
        For	
  more	
  details	
  on	
  the	
  presenta,on,	
  contact	
  
                          devcon@intuit.com	
  



39

Weitere ähnliche Inhalte

Was ist angesagt?

Animating angular applications
Animating angular applicationsAnimating angular applications
Animating angular applicationsTomek Sułkowski
 
Pruebas unitarias con django
Pruebas unitarias con djangoPruebas unitarias con django
Pruebas unitarias con djangoTomás Henríquez
 
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCsStandford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs彼得潘 Pan
 
Re-Design with Elixir/OTP
Re-Design with Elixir/OTPRe-Design with Elixir/OTP
Re-Design with Elixir/OTPMustafa TURAN
 
The Death of a Mouse
The Death of a MouseThe Death of a Mouse
The Death of a MouseGeert Bevin
 

Was ist angesagt? (7)

Animating angular applications
Animating angular applicationsAnimating angular applications
Animating angular applications
 
Pruebas unitarias con django
Pruebas unitarias con djangoPruebas unitarias con django
Pruebas unitarias con django
 
as3
as3as3
as3
 
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCsStandford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
 
Re-Design with Elixir/OTP
Re-Design with Elixir/OTPRe-Design with Elixir/OTP
Re-Design with Elixir/OTP
 
The Death of a Mouse
The Death of a MouseThe Death of a Mouse
The Death of a Mouse
 

Ähnlich wie 2010 bb dev con

QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...
QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...
QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...QAFest
 
Spin Up Desktop Apps with Electron.js
Spin Up Desktop Apps with Electron.jsSpin Up Desktop Apps with Electron.js
Spin Up Desktop Apps with Electron.jsSteve Godin
 
Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)Howard Lewis Ship
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
 
Appium troubleshooting
Appium troubleshootingAppium troubleshooting
Appium troubleshootingadi ben aroya
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insTonny Madsen
 
The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210Mahmoud Samir Fayed
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidEmanuele Di Saverio
 
Creating applets.60
Creating applets.60Creating applets.60
Creating applets.60myrajendra
 
iOS overview
iOS overviewiOS overview
iOS overviewgupta25
 
Ruby motion勉強会 2012年7月
Ruby motion勉強会 2012年7月Ruby motion勉強会 2012年7月
Ruby motion勉強会 2012年7月Eihiro Saishu
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Codemotion
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Codejonmarimba
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 MinigamesSusan Gold
 
There's more than web
There's more than webThere's more than web
There's more than webMatt Evans
 
README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia Richard Radics
 

Ähnlich wie 2010 bb dev con (20)

Of class1
Of class1Of class1
Of class1
 
QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...
QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...
QA Fest 2019. Алексей Альтер-Песоцкий. Snapshot testing with native mobile fr...
 
Spin Up Desktop Apps with Electron.js
Spin Up Desktop Apps with Electron.jsSpin Up Desktop Apps with Electron.js
Spin Up Desktop Apps with Electron.js
 
Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)Clojure: Functional Concurrency for the JVM (presented at OSCON)
Clojure: Functional Concurrency for the JVM (presented at OSCON)
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
 
Appium troubleshooting
Appium troubleshootingAppium troubleshooting
Appium troubleshooting
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210The Ring programming language version 1.9 book - Part 56 of 210
The Ring programming language version 1.9 book - Part 56 of 210
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
 
JavaFX Pitfalls
JavaFX PitfallsJavaFX Pitfalls
JavaFX Pitfalls
 
Creating applets.60
Creating applets.60Creating applets.60
Creating applets.60
 
iOS overview
iOS overviewiOS overview
iOS overview
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
 
Ruby motion勉強会 2012年7月
Ruby motion勉強会 2012年7月Ruby motion勉強会 2012年7月
Ruby motion勉強会 2012年7月
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016
 
14709302.ppt
14709302.ppt14709302.ppt
14709302.ppt
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
There's more than web
There's more than webThere's more than web
There's more than web
 
README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia README.MD for building the first purely digital mobile bank in Indonesia
README.MD for building the first purely digital mobile bank in Indonesia
 

2010 bb dev con

  • 1. Automated  Tes,ng  for  Mobile  Applica,ons   An  experimental  technique   Eing  Ong,  Intuit  Inc.   Louis  daRosa,  Intuit  Inc.  
  • 2. Session  outline   •   Introduc,on   •   Simulator  basics   •   Simulator  library     •   Building  your  mobile  app  library   •   Wri,ng  reusable  test  cases   •   Mobile  test  automa,on  framework     •   Advantages  and  limita,ons   •   Q  &  A   2
  • 3. Introduc,on   What  are  we  solving  for  ?   •   Various  BB  OS  and  devices   •   End-­‐to-­‐end  mobile  tests   •   Low  cost  solu,on   •   Mul,ple  mobile  plaLorms   3
  • 4. Simulator  Basics   BlackBerry®  JDE  tool  kit   •  Mobile  data  service  (MDS)   •  Simulators  suite   •  App  installa,on   •  Image  capture   4
  • 5. Simulator  Basics   BlackBerry®  simulator   •  Star<ng  simulator              fledge.exe                      /app=jvm.dll                                  /session=<model>                    /app-­‐param=                            JvmAlxConfigFile:<model>.xml                      /handheld=<model>   •  Communica<ng  with  simulator              fledgecontroller.exe                      /session=<model>   5
  • 6. Simulator  Basics   Ac<ons   Steps   Start  9630  Tour   fledge.exe  /app=jvm.dll     simulator          /session=9630  /handheld=9630          /app-­‐param=JvmAlxConfigFile: 9630.xml     Install   1.  Copy  app.jar,  app.jad,  app.cod  to   applica,on   Javaloader  directory   2.  JavaLoader.exe    –u  load  app.jad   3.  Delete  app.jar,  app.jad,  app.cod   Save  screenshot   1.  JavaLoader.exe    –u  screenshot   as  test.png  in   test.png   $TEST_OUTPUT   2.  mv  test.png  $TEST_OUTPUT   6
  • 7. Simulator  Basics   Ac<ons   Steps   bblib.py   Start  9630  Tour   fledge.exe  /app=jvm.dll     fledgeStart()   simulator          /session=9630  /handheld=9630          /app-­‐param=JvmAlxConfigFile: 9630.xml     Install   1.  Copy  app.jar,  app.jad,  app.cod  to   install()   applica,on   Javaloader  directory   2.  JavaLoader.exe    –u  load  app.jad   3.  Delete  app.jar,  app.jad,  app.cod   Save  screenshot   1.  JavaLoader.exe    –u  screenshot   getScreenShot(‘test’)   as  test.png  in   test.png   $TEST_OUTPUT   2.  mv  test.png  $TEST_OUTPUT   7
  • 8. Simulator  commands   Ac<on   Steps   Enter  'Hello   StringInjec,on(Hello)   World'   KeyPress(SPACE)   KeyRelease(SPACE)   StringInjec,on(World)   Backspace  2   KeyPress(BACKSPACE)   ,mes   KeyRelease(BACKSPACE)   KeyPress(BACKSPACE)   KeyRelease(BACKSPACE)   Thumbwheel  up   ThumbWheelRoll(-­‐1)   twice   ThumbWheelRoll(-­‐1)   8
  • 9. Simulator  commands   Ac<on   Steps   bblib.py   Enter  'Hello   StringInjec,on(Hello)   enter(‘Hello  World')   World'   KeyPress(SPACE)   KeyRelease(SPACE)   StringInjec,on(World)   Backspace  2   KeyPress(BACKSPACE)   backspaces(2)   ,mes   KeyRelease(BACKSPACE)   KeyPress(BACKSPACE)   KeyRelease(BACKSPACE)   Thumbwheel  up   ThumbWheelRoll(-­‐1)   thumbwheel  ('up',           twice   ThumbWheelRoll(-­‐1)                                                        2)   9
  • 10. Simulator  commands   Ac<on   Steps   bblib.py   Touch  screen  at   TouchScreenPress(10,  100,  0)   touch(10,  100)   (10,  100)   TouchScreenClick()   TouchScreenUnclick()   TouchScreenUnpress(0)   10
  • 11. bblib.py   Setup   •  fledgeStart()   •  javaloaderStart()   •  mdsStart()   Basic  key  events   •  backspaces(count)   •  enter()   •  enter(string)   •  menu()     •  escape()     •  pause(seconds)   11
  • 12. bblib.py   Naviga<on   •  thumbwheel('up',  count)   •  thumbwheel(‘down',  count)   •  trackball('up’,  count)   •  trackball(‘down’,  count)   •  trackball(‘lek’,  count)   •  trackball(‘right’,  count)   •  touch(x,y)   12
  • 13. Case  study  –  Address  Book  Demo   •  Devices   –  Pearl   –  Storm   •  Simulator  library   •  Address  book   –  Add  contact   –  Find  contact   –  Delete  contact   •  Automated  tests   13
  • 14. Test  Automa,on  Overview   1.  Define  applica<on  interface   This  interface  is  device-­‐agnos,c.   2.  Implement  the  interface   Implement  interface  in  BlackBerry®     U,lize  Python™  mobile  libraries  e.g.  bblib.py.   3.  Write  your  tests   Tests  are  device  independent  and  reusable.   4.  Run   14
  • 15. Step  1  :  Define  applica,on  interface   class  AppInterface:          """Applica,on  Interface"""          def    launch(self):                    """Launch  app"""          def  add(self,  contact):                  """Add  a  contact"""          def  find(self,  contact):                  """Find  contact"""          def  delete(self):                  """Delete  current  contact"""     15
  • 16. Test  Automa,on  Overview   1.  Define  applica<on  interface   This  interface  is  device-­‐agnos,c.   2.  Implement  the  interface   Implement  interface  in  BlackBerry®     U,lize  Python™  mobile  libraries  e.g.  bblib.py.   3.  Write  your  tests   Tests  are  device  independent  and  reusable.   4.  Run   16
  • 17. Step  2  (Storm):  Implement  the  interface   def  StormImpl(appbase.AppInterface):   def  add(self,  contact):     touch(100,  50)   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   touch(50,  300)   17  
  • 18. Step  2  (Storm):  Implement  the  interface   def  StormImpl(appbase.AppInterface):   def  add(self,  contact):     touch(100,  50)   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   touch(50,  300)   18  
  • 19. Step  2  (Storm):  Implement  the  interface   def  StormImpl(appbase.AppInterface):   def  add(self,  contact):     touch(100,  50)   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   touch(50,  300)   19  
  • 20. Step  2  (Pearl):  Implement  the  interface   def  PearlImpl(appbase.AppInterface):   def  add(self,  contact):     enter()   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   enter() 20  
  • 21. Step  2  (Pearl):  Implement  the  interface   def  PearlImpl(appbase.AppInterface):   def  add(self,  contact):     enter()   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   enter() 21  
  • 22. Step  2  (Pearl):  Implement  the  interface   def  PearlImpl(appbase.AppInterface):   def  add(self,  contact):     enter()   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  #  save                                  menu()   enter() 22  
  • 23. Step  2  Recap:  Implement  the  interface   def  StormImpl(appbase.AppInterface):        def  PearlImpl(appbase.AppInterface):   def  add(self,  contact):     def  add(self,  contact):     touch(100,  50)   enter()   enter(contact.getFirstname()   enter(contact.getFirstname()                                  thumbwheel('down',  1)                                  thumbwheel('down',  1)                                  enter(contact.getLastname())                                  enter(contact.getLastname())                                  #  save                                  #  save                                  menu()                                  menu()   touch(50,  300)   enter()     23  
  • 24. Test  Automa,on  Overview   1.  Define  applica<on  interface   This  interface  is  device-­‐agnos,c.   2.  Implement  the  interface   Implement  interface  in  BlackBerry®     U,lize  Python™  mobile  libraries  e.g.  bblib.py.   3.  Write  your  tests   Tests  are  device  independent  and  reusable.   4.  Run   24
  • 25. Step  3  :  Wri,ng  tests   class  AddContactTest(uniqest.TestCase):     device  =  testenv.getDeviceClass()     def  addContactWithOnlyFirstnameTest(self):          self.contact.setFirstname(firstname)          self.device.add(self.contact)     def  addContactWithOnlyLastnameTest(self):          self.contact.setLastname(firstname)          self.device.add(self.contact)      25
  • 26. Step  3  :  Run,me  device  binding   def getDeviceClass(self): """ Returns the device to test """ mobileDevice = self.getMobileDevice() if mobileDevice == 'pearl': import pearl deviceClass = pearl.PearlImpl() elif mobileDevice == 'storm': import storm deviceClass = storm.StormImpl() else: import bb deviceClass = bb.BlackBerry() return deviceClass 26
  • 27. More  device-­‐independent  tests   Addi<onal  tests  are  easy  to  write     def  addContactWithEmailTest(self):   def  addContactWithAddressesTest(self):   def  addContactWithAllDetailsTest(self):   def  addContactWithLongDetailsTest(self):   def  addContactAddressWithStateZip(self):   def  addContactAddressWithCityStateZip(self):   def  addContactAddressWithNoDataNega,veTest(self):       27
  • 28. Step  4  :  Run   •  Basic  run  command   –  python  <test.py>     •  Python™  test  frameworks   –  uniqest   –  PyUnit     –  python-­‐nose       28
  • 29. Test  Verifica,on   •  Server  hosted  apps   –  API  asser,ons   –  Database  asser,ons   •  Image  asser,ons     self.assertTrue(imagelib.compare(self.device,  testname,  '100%x90%‘))     imagelib.py  :   def  compare(device,  imageName,  crop=None,  tolerance=500)   29
  • 30. Logging   •  Ini,aliza,on   self.log  =  self.device.initLogger(self._testMethodName,                                                                                                                      self.__class__.__name__)   •  Usage   self.log.info('Star,ng  test:  '  +  self._testMethodName)   self.log.debug(self.contact)   self.log.error(‘Missing  image  to  compare’)   •  Logs   AddressTest.log  :     2010-­‐06-­‐10  15:19:46,773  -­‐  testCreateAddressMethod  -­‐  INFO  -­‐    [Address1]  200  Villa  St  Mountain  View  CA  94040  BUSINESS  ADDRESS   30
  • 31. Login  example  on  BlackBerry®  Pearl   Interface def  login(username,  passwd)   Test (logintest.py) login(‘user100’,’helloworld’)   enter(username)   def  enter(str)   scroll(‘down’)   def  scroll(ac<on)   enter(password)   def  enter()   enter()   pearlapp.py bblib.py 31
  • 32. Login  example  on  BlackBerry®  Storm       Interface def  login(username,  passwd)   Test (logintest.py) login(‘user100’,’helloworld’)   touch(100,100)   enter(username)   def  enter()   touch(100,200)   def  touch(x,y)   enter(password)   touch(150,  300)   stormapp.py bblib.py 32
  • 33. Mobile  Tes,ng  Framework   Mobile  Applica<on  Interface   Python™ Test Framework Device  Independent  Tests   Runtime device binding Simulator libraries BB    app  library   Mobile  app  library   BB  device  library   Device  library   33
  • 34. Advantages   •  Zero  cost  to  use     •  No  device  sharing/scheduling   •  Bigger  device  pool   •  Reduce  manual  tes,ng  ,me   •  Run  on  developers  machines   •  Debugging  capabili,es   34
  • 35. Limita,ons   •  Requires  ethernet  or  internet  connec,vity   •  Does  not  simulate  network  performance   •  Does  not  support  hardware  controls  tes,ng   •  Dependent  on  simulator  reliability   •  Limited  peer-­‐to-­‐peer  applica,ons  tes,ng   35
  • 36. Resources   BlackBerry  ®  JDE  Downloads   hqp://na.blackberry.com/eng/developers/javaappdev/javadevenv.jsp   Documenta<on   Fledge  controller   hqp://docs.blackberry.com/en/developers/deliverables/15476/Test_B   BSmrtphnSmltr_events_using_script_607587_11.jsp   BlackBerry  ®  Simulator  Tes,ng   hqp://docs.blackberry.com/en/developers/deliverables/6338/Tes,ng_apps_using_the   _BBSmrtphnSmltr_607559_11.jsp   Python  ™   hqp://docs.python.org/     BlackBerry  ® Developers  Forum   hqp://supporLorums.blackberry.com/   36
  • 37. Acknowledgments   •  Desiree  Gosby,  Mobile  Architect   •  Paul  Hau,  QA  Manager   •  Jaron  Jones,  QA  Manager   •  Jason  Pugh,  Architect  (definitely  not  least)   37
  • 38. Q  &  A   38
  • 39. Thanks  and  enjoy  the  rest  of  DevCon  2010!   For  more  details  on  the  presenta,on,  contact   devcon@intuit.com   39