FitNesse for Appian: Fixture issues with Scenario and Variables settings

Certified Associate Developer

Hi! I'm having problems with fixtures during testing FitNesse for Appian. 

I'm trying to elaborate some custom and complex Scenarios for my test case, using scenario variables. To do that, I'm setting up some variables in SuiteSetUp page using methods described in FitNesse For Appian guide (under UsingVariables). Here's the code I'm using, if there's something wrong, please let me know: 

MAIN TEST PAGE:

!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {java -Dlog4j.configuration=file:///${automated.testing.home}/log4j.properties -cp %p %m}
!path ${automated.testing.home}/**.jar


!*** Testing - Message

!| script |com.appiancorp.ps.automatedtest.fixture.SitesFixture|
|messageToManager|text |$manager |text |$message |

*!

!*** Log out and tear down

!| script |
|logout |
|tear down|

*!

 

SET UP INCLUDED PAGE:

!*** CONFIGURATION

!| script |com.appiancorp.ps.automatedtest.fixture.SitesFixture |
|configuration 1 |CHROME |locale |en_US|version |20.1|url |https:/suite/sites/appian-site |
|login with username |user@gmail.com |

*!

!*** TEST VARIABLES

|script  |
|set test variable|useCaseMessage  |with |{"manager": user@gmail.com, "message": default message} |
|$manager |get test variable  |tv!useCaseMessage.manager |
|$message |get test variable  |tv!useCaseMessage.message |

*!

SCENARIO LIBRARY:

!***  CONFIG SCENARIO

!|scenario |configuration1|browserType|locale|location|version|versionNum|url|appianUrl|
|setup with |@browserType |browser |
|set appian locale to |@location |
|set appian version to|@versionNum |
|set appian url to |@appianUrl |


*!

!*** Message to Manager

!|scenario |messageToManager |text |managerVar|text|messageVar|
|verify box |Contact Your Manager|is present |
|toggle box |Contact Your Manager|visibility |
|verify field |To |is present |
|verify field |Message |is present |
|populate field|To |with value|@managerVar |
|populate field|Message |with value|@messageVar |
|verify link |Go |is present |
|click on link |Go |

*!

These are the result errors:


I tried to use other Appian fixtures too (Tempo and Base fixtures), but I got the same errors. Is there some documentation I can read about fixture methods? I guess, indeed, that Cheat Sheet is not sufficient. Thanks for helping!

  Discussion posts and replies are publicly visible

Parents
  • Hello,

    I am currently learning as well fitnesse, so not 100% where you issue is, but I think this might be changed to "set" instead of "get".

    |script  |
    |set test variable|useCaseMessage  |with |{"manager": user@gmail.com, "message": default message} |
    |$manager |get test variable  |tv!useCaseMessage.manager |
    |$message |get test variable  |tv!useCaseMessage.message |

  • 0
    Certified Associate Developer
    in reply to ManuelHTG

    Hi Manuel, thanks for the reply! For "get test variable" I took instructions from localhost:8980/FitNesseForAppian.Documentation.Development.UsingVariables, so I supposed that it was the right way to define variables in a SLIM table. I tried your advice but, unfortunately, nothing's changed :(

  • What I have done to set-up my first test cases had been first run the example localhost:8980/FitNesseForAppian.Examples (including the installation in Appian) and then create a new suite and change the complete test case so it goes to my application. Renaming the test data to make it work.

    On the example, on the suite preparation it has something like

    !*** Set Suite Variables
    
    This table initializes multiple variables with default values which will be available to all tests in this test suite. These variables are accessible within the tests through the modifiers tv!title, tv!quantity, tv!price, and tv!start_date
    
    
    |script                                                         |
    |$title=          |get random string      |5                    |
    |$quantity=       |get random integer from|0   |to |9           |
    |$price=          |get random decimal from|1.0 |to |2.0 |with |4|
    |set test variable|title                  |with|$title          |
    |set test variable|quantity               |with|$quantity       |
    |set test variable|price                  |with|$price          |
    |set test variable|start_date             |with|2018-11-06 02:00|
    ***!
    
    
    

    and on the test it calls it like this

    !*** Fill out Automated Testing Data Input form
    !| script                                     |
    |login with terms with username|sales.alventus|
    |click on menu  |Actions                      |
    |click on action|Automated Testing Input      |
    |populate field |title     |with|tv!title     |
    |populate field |quantity  |with|tv!quantity  |
    |populate field |price     |with|tv!price     |
    |populate field |start date|with|tv!start_date|
    |click on button|Submit                       |
    ***!

    I think your code should be more of the type like below

    |script  |
    |set test variable|useCaseMessage  |with |{"manager": user@gmail.com, "message": default message} |
    |set test variable |manager| with  |$useCaseMessage.manager |
    

  • 0
    Certified Associate Developer
    in reply to ManuelHTG

    Ok, this method to define variables works fine, thank you very much! Any idea about the other issue, that is still happening?

    Because I think something's wrong with my definitions input in scenario's first row. Here:

    !| script |com.appiancorp.ps.automatedtest.fixture.SitesFixture|
    |messageToManager |text |$manager |text |$message |

    I'm not sure the definitions (text) are correct. What's the method to define custom scenario inputs? I only found, in the documentation, references about int type, decimal type, date-time type, text type. It still cannot find the method.

  • I think you have two problems

    1) naming convention, if you use camel cases for an scenario definition it might think that it is another wiki page. So I would start by adding spaces to the name of your scenario.

    2) Additionally and more important, you are calling a variable that you did not declare

    |populate field|Message |with value|@stringVar |

    !|scenario |Message To Manager|text |managerVar|text|messageVar|
    |verify box |Contact Your Manager|is present |
    |toggle box |Contact Your Manager|visibility |
    |verify field |To |is present |
    |verify field |Message |is present |
    |populate field|To |with value|@managerVar |
    |populate field|Message |with value|@messageVar |
    |verify link |Go |is present |
    |click on link |Go |

Reply
  • I think you have two problems

    1) naming convention, if you use camel cases for an scenario definition it might think that it is another wiki page. So I would start by adding spaces to the name of your scenario.

    2) Additionally and more important, you are calling a variable that you did not declare

    |populate field|Message |with value|@stringVar |

    !|scenario |Message To Manager|text |managerVar|text|messageVar|
    |verify box |Contact Your Manager|is present |
    |toggle box |Contact Your Manager|visibility |
    |verify field |To |is present |
    |verify field |Message |is present |
    |populate field|To |with value|@managerVar |
    |populate field|Message |with value|@messageVar |
    |verify link |Go |is present |
    |click on link |Go |

Children
  • 0
    Certified Associate Developer
    in reply to ManuelHTG

    Oh, I'm so sorry, I didn't see I've copied a wrong version of my code, I'm not using @stringVar, let me edit that.  

    I'm afraid, even with space and different naming convention, it's still not working. 

    New scenario version's error

  • That might be as a result of forcing the script directory, I think you should not have this in the test

    !| script |com.appiancorp.ps.automatedtest.fixture.SitesFixture|
    |messageToManager|text |$manager |text |$message |
    
    

    but rather

    !| script |
    |messageToManager|text |$manager |text |$message |
    
    

  • 0
    Certified Associate Developer
    in reply to ManuelHTG

    Thanks for sharing, I've already tried it, the error persists. I've also move set variables from SuiteSetUp page to Main Test page, as I read it in FitNesse For Appian documentation. He's still not find the method. Am I doing scenarios in the right way? That's my real doubt now.

  • Ok, I would really consider starting from scratch and be adding complexity little by little. Fitnesse is easy to use once you have a good base of examples that are working for your system. At that point you can use your base-knowledge to create many tests.

    My scenarios are made from test cases, meaning, first i wrote it in a test case, with hard-coded values, then i separate set ups, then i change to test variables and then i move some parts to the scenarios, that way on each step  i know what i am trying to do.

    Your current problem seems to be with the parameters, or at least that what your error is saying, now there, you have some strange things in the fitnesse documentation that if you follow, you should be able to fix. I would start by hard-coding the values inside the scenario, avoiding any parameters, and then being adding one by one to see if it works.

    Regarding the documentation, there is a thing i notice:

    http://localhost:8980/FitNesseForAppian.Documentation.Development.Scenarios

    Here they added some complexity by calling the fields the same way that its type, but see that it does not use the first "|" when defining the scenario.

    The call is done in a similar way, meaning the first data type is directly inside the name

    So if you feel like going directly with parameters, i would try the following

    !*** Message to Manager
    !|scenario |meesage to manager text |managerVar|text|messageVar|
    |verify box |Contact Your Manager|is present |
    |toggle box |Contact Your Manager|visibility |
    |verify field |To |is present |
    |verify field |Message |is present |
    |populate field|To |with value|@managerVar |
    |populate field|Message |with value|@messageVar |
    |verify link |Go |is present |
    |click on link |Go |
    *!

    And on the call, I would try this

    !| script |
    |message to manager text|$manager |text |$message |

    or this if you are with the test varibles

    !| script |
    |message to manager text| tv!manager |text |tv!message |

  • 0
    Certified Associate Developer
    in reply to ManuelHTG

    Manuel, I've finally found the solution to the problem. I was mixing keywords in the definitions input of the scenario. Indeed, using tv!variables convention instead of $ Slim symbols, it works! No more error. Your method, to add complexity little by little, was the key to the solution. Thank you very much! Here's the code:

    |script |
    |set test variable|useCaseMessage|with|{"manager": "manager@gmail.com "message": "message default", "date": "04/16/2019"}|
    |set test variable|manager |with|tv!useCaseMessage.manager |
    |set test variable|message |with|tv!useCaseMessage.message |
    |set test variable|date |with|tv!useCaseMessage.date |

    !|script |
    |message To Manager with text|tv!manager|text|tv!message|