Loading ...
Sorry, an error occurred while loading the content.

Re: Java Returned Symbol -> Fixture can use it Fitnesse

Expand Messages
  • gfbrols
    Hi, you could use DBFIT for your queries in this case the code would be !|Query| select * As profile from schema.table t WHERE t.USERNAME =:id|
    Message 1 of 2 , Aug 3 12:05 AM
    • 0 Attachment
      Hi, you could use DBFIT for your queries

      in this case the code would be
      !|Query| select * As profile from schema.table t WHERE t.USERNAME =:id|
      |profile|



      --- In fitnesse@yahoogroups.com, "seb_briggs" <seb.briggs@...> wrote:
      >
      > Hi all,
      >
      > I'm struggling with how to work out how to create a symbol in a Java fixture, and then get it converted to a variable that I can use throughout a Fitnesse script to query a DB. The Java fixture is to create a username as is as follows:
      >
      > public class UtilityFixture extends fit.ColumnFixture{
      >
      > public String prefix ="";
      > public String generatedId ="";
      > public String email ="";
      >
      > /**
      > * Returns a UniqueUserId as a string.
      > * @return String UniqueUserId
      > */
      > public String UniqueUserId() {
      > String uniqueId = ""+System.currentTimeMillis();
      > generatedId = prefix + uniqueId.substring(5);
      > return generatedId;
      > }
      >
      > To pull this back in Fitnesse, I then use:
      >
      > !|.fitnesse.UtilityFixture|
      > |prefix|=UniqueUserId?||
      > |TEST|id||
      >
      > which pulls this value back as a symbol prefixed with 'TEST;. I'd like to use the value returned as a variable throughout further scripts to query the db - i.e
      >
      > !|Query| select * As profile from schema.table t WHERE t.USERNAME =
      > variable|
      > |profile?|
      >
      > Any ideas on how I can do this - do I need to adjust the fixture or is there a trick that I can use within Fit to reuse this value?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.