Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.

Similar presentations


Presentation on theme: "© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1."— Presentation transcript:

1 © 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1

2 © 2012 LogiGear Corporation. All Rights Reserved Agenda  FitNesse  Fit and Slim  How to write Test Cases  Connect DataBase with Fit  SSH with Slim 2

3 © 2012 LogiGear Corporation. All Rights Reserved FitNesse – A brief intro 3

4 © 2012 LogiGear Corporation. All Rights Reserved FitNesse – A brief intro What is FitNesse?  A web server  A wiki  A tool for enhancing collaboration in software development  A software testing tool Define Acceptance Tests (simple tables(input, output)) It supports Java (native),.Net, C++ … It provides a simple way to run tests (tables) and suits 4

5 © 2012 LogiGear Corporation. All Rights Reserved FitNesse – A brief intro  Fitnesse is not  An automation tool with interface capturing ability  An automation tool with web browser driving ability  But there’re such tools that work with Fitnesse 5

6 © 2012 LogiGear Corporation. All Rights Reserved FitNesse – A brief intro Table-based approach for acceptance testing 6 Starting from a user story, the customer enters in a table (spreadsheet) the expectations of the program’s behavior. At this point tables can be used as oracle. The customer can manually insert inputs in the System and compare outputs with expected results.

7 © 2012 LogiGear Corporation. All Rights Reserved Fit and Slim Fit 7 Slim

8 © 2012 LogiGear Corporation. All Rights Reserved Fit and Slim Fit (Framework for Integrated Test) and Slim (Simple List Invocation Method) are two different ways (test engines) to do automation testing with FitNesse 8

9 © 2012 LogiGear Corporation. All Rights Reserved Fit and Slim Fit  Born with Fitnesse Slim  Developed later as an alternative to Fit 9  Developers write “fixtures” to link the test cases with the actual system itself  Developers write “fixtures” to link the test cases with the Slim Executor  Fit compares these test cases with actual values returned by the system, and highlights the results with colors and annotations  All the HTML processing, comparisons, and colorizing are run on Fitnesse server

10 © 2012 LogiGear Corporation. All Rights Reserved Fit and Slim Fit  Fixture code is run on the system under test (SUT), so it depends on the system Slim  All the features are on the FitNesse server, so test tables remain consistent regardless of the platform of the SUT 10  Lots of differences between implementations in Java,.NET, Python  No need to import fixture class, common syntax, common fixture types  Fit has not been developed for a while  Slim is in active development

11 © 2012 LogiGear Corporation. All Rights Reserved How to…  How to… 11

12 © 2012 LogiGear Corporation. All Rights Reserved How to install Fitnesse Software requirement:  Oracle JDK for your platform from http://www.oracle.com/technetwork/jav a/javase/downloads/index.html http://www.oracle.com/technetwork/jav a/javase/downloads/index.html  Eclipse for Java EE from http://www.eclipse.org/downloads/ http://www.eclipse.org/downloads/  Latest fitnesse.jar from http://www.fitnesse.org/FrontPage.FitNe sseDevelopment.DownLoad http://www.fitnesse.org/FrontPage.FitNe sseDevelopment.DownLoad 12

13 © 2012 LogiGear Corporation. All Rights Reserved How to run Fitnesse  Create a “StartFitnesse.bat” in the same folder with “fitnesse.jar”  Create its content using the syntax: java -jar [path]\fitnesse.jar -p port_number Ex: java -jar d:\fitnesse.jar -p 9999  Double click the bat file to start Fitnesse server  Open a web browser and navigate to http://localhost:9999/ 13

14 © 2012 LogiGear Corporation. All Rights Reserved How to create a page  Every Fitnesse page must has a name in Camel-Case format. Ex: TestPage, OneMorePage, LastOneHere  Create a root page (no parent):  Put the page name in an existing page where you want to create a link to it, prefix the name with a dot “.”  Click the [?] next to the page name to create content for the page. The page name above will become a link  Create a child page:  Click [add child] link next to the parent page title and enter the child page name  Create a link for the page or it will become a lost page 14

15 © 2012 LogiGear Corporation. All Rights Reserved How to create a table Create a table in Fitnesse  The first cell contains the table name  Design the table in a spreadsheet  Open Edit mode of a page  Copy and paste the table here  Click “Spreadsheet to Fitnesse” button  Save changes 15

16 © 2012 LogiGear Corporation. All Rights Reserved How to create a Slim fixture Create Slim fixture for Decision table  Open Eclipse, create a new Java project  Add a new package, give it any name you like  Add a new class in the package. Its name must be the same as the table you want to link to  Add methods for input and output columns Output method has the same name as its column. It returns the expected result. Input method has prefix “set” before its column name. It takes in the value of the column.  Set path to the “bin” folder of the project in the test page and import the package above 16

17 © 2012 LogiGear Corporation. All Rights Reserved How to create a Slim fixture 17

18 © 2012 LogiGear Corporation. All Rights Reserved How to use external library  To use an external library  Add the library to the Java project (fixture code). Import its classes and use however you like  Set the path to the external library in the test pages that require this library  It’s as simple as that  Demo Keyword-driven test with Selenium Web-Driver library 18

19 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  To use an external library  Step 1: Create DataBase in FitFitNesseDemo page  Step 2: Edit content in DataBase page >MySql >SetUp >SuiteSetUp >TearDown >InterFaces 19

20 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  To use an external library  Step 4: Create a new page in Interfaces  Step 5: Declare some variables in DatabaseVariables !define host {localhost} !define schema {automation} !define user {root} !define pass {root} 20

21 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  To use an external library  Step 6: Create a new page “ConnectionDataBase” in MySql  Step 7: Change properties in ConnectionDataBase page from Default to Test type 21

22 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  Step 8: Edit ConnectDataBase !*****> Import Interfaces in the SimpleSelect !include.FitFitNesseDemo.AdminPortal.InterFaces.GlobalVariables !include.FitFitNesseDemo.AdminPortal.InterFaces.LogInPage !include.FitFitNesseDemo.DataBase.InterFaces.DatabaseVariables *****! !*****> Define to call multiple fixtures: |''add''|!-dbfit.MySqlTest-!|''as''|database| |''add''|!-fitlibrary.spider.SpiderFixture!|''as''|spider| *****! !*****> Connect to database !|Connect|${host}|${user}|${pass}|${schema}| *****! 22

23 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  Step 8: Edit ConnectDataBase !*****> Query to get username and password in database |''select''|database| !3 Simple Select |query| SELECT username FROM user WHERE role='${roleName}'| |username?| |>>account| |query| SELECT password from person where id =(SELECT person_id FROM `user` WHERE role='${roleName}')| |password?| |>>password| *****! !*****> Set username and password |set|username|get symbol named|account| |set|password|get symbol named|password| *****! 23

24 © 2012 LogiGear Corporation. All Rights Reserved Connect Database with Fit  Step 8: Edit ConnectDataBase !*****> Query to get username and password in database |''select''|database| !3 Simple Select |query| SELECT username FROM user WHERE role='${roleName}'| |username?| |>>account| |query| SELECT password from person where id =(SELECT person_id FROM `user` WHERE role='${roleName}')| |password?| |>>password| *****! !*****> Set username and password |set|username|get symbol named|account| |set|password|get symbol named|password| *****! 24

25 © 2012 LogiGear Corporation. All Rights Reserved SSH with Slim  To use an external library  Step 1: Add “jsch.jar” and “remote- api.jar” library to our lib folder.  Step 2: Create SlimFitNesseDemo page 25

26 © 2012 LogiGear Corporation. All Rights Reserved SSH with Slim  Step 3: Config in SlimFitNesseDemo page >Ssh !path lib/*.jar !define TEST_SYSTEM {slim} !define COLLAPSE_SETUP {true} !define COLLAPSE_TEARDOWN {true}  Step 4: Create SlimFitNesseDemo page 26

27 © 2012 LogiGear Corporation. All Rights Reserved SSH with Slim  Step 3: Config in SlimFitNesseDemo page |import| |com.cisco.tcbu.automation.ssh| !*****> Execute a command by ssh |Script|Ssh On Fitnesse|192.168.170.228| |check|connect|root |true| |check|exec|ls -la|0| |check|exec|cd folder|1| |check|exec|ls -a --color=never|0| |$check=|exec|tail -30../var/log/messages.log| |check|disconnect|false| **********! 27

28 © 2012 LogiGear Corporation. All Rights Reserved SSH with Slim  Step 4: Run the test case 28

29 © 2012 LogiGear Corporation. All Rights Reserved 29

30 © 2012 LogiGear Corporation. All Rights Reserved THANK YOU 30


Download ppt "© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1."

Similar presentations


Ads by Google