Question

I realize this may be trivial issue for some but i've spent the better part of the last week trying to figure out why the tests I am running with the robot test framework do not pass. I continue to get the "No Keyword with name" and "Test Case contains no keywords" errors

I am new to the Robot framework and am trying to write a testRobot.txt that completes the tutorial tests for the Robot framework. I know that the tests pass as the tutorial comes with an html version of the tests and I have successfully ran the using the provided html file. However, I cannot duplicate these results when I try writing the same tests in a tabular form. If someone could help me out with a complete example of what the tabular form solution for the tutorial that would be of great help. the tutorial can be downloaded from http://code.google.com/p/robotframework/downloads/list

Thanks for all your help. You guys are truly a fantastic resource.

Was it helpful?

Solution

Here is the first cases from the Quick Start guide in a tabular form. You should be able to do the rest by yourself if you get to run and understand this part.

*** Settings ***
Library  OperatingSystem
Library  testlibs/LoginLibrary.py

*** test cases ***  
User can create an account and log in   
  Create Valid User fred    P4ssw0rd
  Attempt to Login with Credentials fred    P4ssw0rd
  Status Should Be  Logged In   
User cannot log in with bad password    
  Create Valid User betty   P4ssw0rd
  Attempt to Login with Credentials betty   wrong
  Status Should Be  Access Denied   

*** Keywords ***
Clear login database    
  Remove file   ${DATABASE FILE}    

Create valid user   
  [Arguments]   ${username} ${password}
  Create user   ${username} ${password}
  Status should be  SUCCESS 

Creating user with invalid password should fail   
  [Arguments]   ${password} ${error}
  Create user   example ${password}
  Status should be  Creating user failed: ${error}  

Login   
  [Arguments]   ${username} ${password}
  Attempt to login with credentials ${username} ${password}
  Status should be  Logged In   

# Used by BDD test cases (this is a comment)            
Given a user has a valid account    
  Create valid user ${USERNAME} ${PASSWORD}

When she changes her password   
  Change password   ${USERNAME} ${PASSWORD}
  ...   ${NEW PASSWORD} 
  Status should be  SUCCESS 

Then she can log in with the new password   
  Login ${USERNAME} ${NEW PASSWORD}

And she cannot use the old password anymore 
  Attempt to login with credentials ${USERNAME} ${PASSWORD}
  Status should be  Access Denied     

If you save this file as quick.txt and have the testlibs folder next to it, you can run it successfully this way:

$ pybot quick.txt
==============================================================================
Quick
==============================================================================
User can create an account and log in                                 | PASS |
------------------------------------------------------------------------------
User cannot log in with bad password                                  | PASS |
------------------------------------------------------------------------------
Quick                                                                 | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output:  output.xml
Log:     log.html
Report:  report.html 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top