0

I try to test a case that has to random a string to input in field by using xebium with fitnesse.

I try to use below command but it doesn't work.

| $fname= | is | storeValue | on | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ'; var fname = ''; for (var i=0; i<6; i++)var rnum = Math.floor(Math.random()*chars.length); fname += chars.substring(rnum,rnum+1); |

Thank you for attention :)

marie
  • 1
  • 1
  • I don't quite get the question? Are you trying to generate a random string so you can enter that into an input field? For that purpose I created my own FitNesse 'symbol' (!randomString) that generates a random string at the wiki level, so that it can be passed to any test. See https://github.com/fhoeben/hsac-fitnesse-plugin – Fried Hoeben Nov 02 '14 at 09:33

1 Answers1

0

We are using special type parser and template strings for this purpose.

For example, function:

bool LastLogonTimeLessThan( DateTimeWrapper time)
{
   return time.Value < GetLastAccessTime();
}

Then you can add custom parser for this type, see tutorial here: https://github.com/imanushin/NetRunner/wiki/Parsing

Parser can be:

public static void DateTimeWrapper(string inputLine)
{
  if("{today}".Equals(inputLine)
         return new DateTimeWrapper(DateTime.Now)

   return new DateTimeWrapper(DateTime.Parse(inputLine))

}
Manushin Igor
  • 2,709
  • 18
  • 32