Include dynamic paths in FitNesse

2019-08-12 05:39发布

问题:

Is there a way to include dynamic paths in FitNesse ?

Assuming I have the following structure

Credentials
  - Local
    - Customer
    - Admin
  - Staging
    - Customer
    - Admin
TestLogin +

In my TestLogin page I would like to something like

!define PLATFORM (Local)
!include .Credentials.${PLATFORM}.Customer
.... 
My Test Tables

I've also (unsuccessfully) tried defining the path:

!define PATH (.Credentials.${PLATFORM}.Customer)
!include ${PATH}

Edit The accepted answer, strictly speaking, doesn't answer the question (seems it's not possible) but provides a good alternative.

回答1:

Could it be that your trying to achieve something like: the example of why one would want symbolic links in the user guide?

Would it be acceptable to switch the 'axes' of your reuse (i.e. create a single suite containing TestLogin and use a symbolic link to include this in the hierarchy for each environment where each hierarchy defines some variables (used in TestLogin) that are specific to that environment)?



回答2:

Have you tried

!define PLATFORM {!include -c <SampleRoot.Credentials.Local.Customer }
${PLATFORM}
.... 
My Test Tables

? (note the extra space at the end of the !define) Depending on the Fitnesse version this might or might not work :) I'm using v20150814.



标签: fitnesse