1 / 30

FitNesse

FitNesse. Authors: Nghia Pham. Agenda. FitNesse Fit and Slim How to write Test Cases Connect DataBase with Fit SSH with Slim. FitNesse – A brief intro. FitNesse – A brief intro. What is FitNesse ? A web server A wiki A tool for enhancing collaboration in software development

shad-roach
Download Presentation

FitNesse

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FitNesse Authors: Nghia Pham

  2. Agenda • FitNesse • Fit and Slim • How to write Test Cases • Connect DataBase with Fit • SSH with Slim

  3. FitNesse – A brief intro

  4. 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

  5. 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

  6. FitNesse – A brief intro Table-based approach for acceptance testing • 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. Fit and Slim Slim Fit No, we’re not talking about this kind of Fit and Slim

  8. 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

  9. Fit and Slim Fit Slim Developed later as an alternative to Fit • Born with Fitnesse • 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. Fit and Slim Fit Slim All the features are on the FitNesse server, so test tables remain consistent regardless of the platform of the SUT • Fixture code is run on the system under test (SUT), so it depends on the system • 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. How to… • How to… It’s demo time

  12. How to install Fitnesse Software requirement: • Oracle JDK for your platform from http://www.oracle.com/technetwork/java/javase/downloads/index.html • Eclipse for Java EE from http://www.eclipse.org/downloads/ • Latest fitnesse.jar from http://www.fitnesse.org/FrontPage.FitNesseDevelopment.DownLoad

  13. 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/

  14. How to create a page • Every Fitnesse page must has a name inCamel-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

  15. 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

  16. 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

  17. How to create a Slim fixture

  18. 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

  19. 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

  20. 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}

  21. 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

  22. 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}| *****!

  23. 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. 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| *****!

  25. 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

  26. 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

  27. 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| **********!

  28. SSH with Slim • Step 4: Run the test case

  29. Thank You

More Related