Python harness fundamental
Upcoming SlideShare
Loading in...5
×
 

Python harness fundamental

on

  • 592 views

 

Statistics

Views

Total Views
592
Views on SlideShare
592
Embed Views
0

Actions

Likes
0
Downloads
7
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • good!
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Python harness fundamental Python harness fundamental Presentation Transcript

  • © 2011 LogiGear Corporation. All Rights ReservedPython Harness inPython Harness inTestArchitectTestArchitectCreated by: Han Trung TruongCreated by: Han Trung Truong
  • © 2011 LogiGear Corporation. All Rights ReservedContentContentIntroduction of HarnessPython harness installationPython harness contentHarness working on TestArchitectExampleDebug Python functions via Eclipse
  • © 2011 LogiGear Corporation. All Rights ReservedIntroduction of harnessIntroduction of harness Interpretation of TestArchitect tests is a task of a "harness" A harness is a program or script that is able to interpret andexecute actions It can be implemented in a variety of scripting orprogramming languages, like Python, Java, C#, C++, etc TestArchitect comes with a pre-built harness called"taplayback.exe", but this is a binary that you cant modify
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installationThese are steps to setup/install Python harness:1.Install python-2.6.6.msi2.Install pywin32-214.win32-py2.6.exe3.Install pycrypto-2.1.0.win32-py2.6.exe4.Install MySQL-python-1.2.2.win32-py2.6.exe5.Add “C:Python26” to “Environment Variables” (Systemvariables)
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installation
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installation6. Launch “cmd.exe” window, change directory to “paramiko”folder, then install “paramiko” using python command
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installation7. Extract “harness_CiscoSport.zip” to a folder on your system(i.e.: C:harness_CiscoSport)8. Edit the harness directory in “run.bat” file in“C:harness_CiscoSport”
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installation9. Finally point TA automation tool to the “run.bat” file
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness installationPython harness installationNeeded items are located in:Item LocationEclipse 192.168.170.177Harness trainingeclipseHarness 192.168.170.177Harness trainingharness_CiscoSportPython installation 192.168.170.177Harness trainingPython Installation.zipTestArchitect 6.1.1.7 data-serverLogiGearVNTest Architect buildsTANG MainBuildsBuild 6.16.1.1.7Document 192.168.170.177Harness trainingDocument
  • © 2011 LogiGear Corporation. All Rights ReservedPython harness contentPython harness content Harness Folder contains two main items: “run.bat” file and“src” folder. “run.bat” file is an Automation Tools and specified on thefirst run or debugging test. “src” folder contains sub folders:• “Python” including main TA libraries and classes• “user” consisting of libraries, classes and modulescreated by users.
  • © 2011 LogiGear Corporation. All Rights ReservedHarness working on TestArchitectHarness working on TestArchitect When executing TMs, TA compiles and stores data in text files at: C:Documents and SettingsAll UsersApplication DataLogiGearTestArchitectDataSERVERS{TAproject ID}files{TM Name} on XP C:UsersPublic LogiGearTestArchitectDataSERVERS{TA project ID}files{TM Name} on Win 7and Vista Theses files contain all actions that we wrote in scripts. Harness have to start its execution from main.py file. After the execution, name of the executed text file will be displayedat “test file name” setting of run.dat file (which is located inC:Documents and SettingsAll UsersApplicationDataLogiGearTestArchitect)
  • © 2011 LogiGear Corporation. All Rights ReservedHarness working on TestArchitectHarness working on TestArchitect
  • © 2011 LogiGear Corporation. All Rights ReservedExampleExample The py file containing harness actions must have 2 main functions SetActions() andDivert(actionName). Below is an example of “mod_Actions.py” file.def SetActions():module = "actions"LIBRARY.SetActionScript("enter value", module, 1)LIBRARY.SetActionScript("check url", module, 1)def Divert(actionName):result = Trueif actionName == "enter value":action_entervalue()elif actionName == "check url":action_checkurl()else:result = FalseLIBRARY.ReportError("Dont know action: " + actionName)return result "actions" is name of the module; “enter value” and “check url” are the action nameused in TA action_entervalue() and action_checkurl() are two functions created within themodule. If any additional functions are created, their information must be set anddiverted in SetActions() and Divert() functions.
  • © 2011 LogiGear Corporation. All Rights Reserved To debug action via Eclipse we need to compile TM thatcontains the action in TA to create file text. Open Eclipse and find function that you want to debug, setbreakpoint. Open main.py file, right click and select debug as -> pythonrun When Harness run it will stop at the break point. Press F5 (go to next function) or F6 (step into function) todebug line by line and see value return in Eclipse.Debug Python functions via EclipseDebug Python functions via Eclipse
  • © 2011 LogiGear Corporation. All Rights ReservedThank you