<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -111,12 +111,17 @@ object Props {
   lazy val productionMode: Boolean = mode == RunModes.Production ||
   mode == RunModes.Pilot || mode == RunModes.Staging
 
-/**
+  /**
    * Is the system in production mode (apply full optimizations)
    */
   lazy val devMode: Boolean = mode == RunModes.Development
 
   /**
+   * Is the system running in test mode
+   */
+  lazy val testMode: Boolean = mode == RunModes.Test
+
+  /**
    * The resource path segment corresponding to the current mode.
    */
   lazy val modeName = mode match {</diff>
      <filename>lift-util/src/main/scala/net/liftweb/util/Props.scala</filename>
    </modified>
    <modified>
      <diff>@@ -135,6 +135,11 @@ trait SecurityHelpers { self: StringHelpers with IoHelpers =&gt;
     new String((new Base64) encode (MessageDigest.getInstance(&quot;SHA&quot;)).digest(in.getBytes(&quot;UTF-8&quot;)))
   }
 
+   /** create a SHA hash from a String */
+  def hashHex(in: String) : String = {
+    Helpers.hexEncode(MessageDigest.getInstance(&quot;SHA&quot;).digest(in.getBytes(&quot;UTF-8&quot;)))
+  }
+
   /** create a SHA-256 hash from a Byte array */
   def hash256(in : Array[Byte]) : Array[Byte] = {
     (MessageDigest.getInstance(&quot;SHA-256&quot;)).digest(in)</diff>
      <filename>lift-util/src/main/scala/net/liftweb/util/SecurityHelpers.scala</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,8 @@ import _root_.scala.xml.{NodeSeq, Elem, Text, UnprefixedAttribute, Null, MetaDat
                          Group, Node, HasKeyValue}
 import _root_.scala.collection.immutable.{ListMap, TreeMap}
 import _root_.net.liftweb.util.{Helpers, ThreadGlobal, LoanWrapper, Box, Empty, Full, Failure,
-                                Log, JSONParser, NamedPartialFunction, NamedPF, AttrHelper}
+                                Log, JSONParser, NamedPartialFunction, NamedPF,
+                                AttrHelper, Props}
 import Helpers._
 import js._
 import _root_.java.io.InputStream
@@ -1519,10 +1520,20 @@ object S extends HasParams {
   buildJsonFunc(Empty, Full(onError), f)
 
   private[http] object _formGroup extends RequestVar[Box[Int]](Empty)
-
-  def formFuncName: String = _formGroup.is match {
-    case Full(x) =&gt; Helpers.nextFuncName(x.toLong * 10000L)
-    case _ =&gt; Helpers.nextFuncName
+  private object formItemNumber extends RequestVar[Int](0)
+
+  def formFuncName: String = if (Props.testMode) {
+    val bump: Long = ((_formGroup.is openOr 0) + 1000L) * 10000L
+    val num: Int = formItemNumber.is
+    formItemNumber.set(num + 1)
+    import java.text._
+    val prefix: String = new DecimalFormat(&quot;00000000000000000&quot;).format(bump + num)
+    &quot;f&quot;+prefix+&quot;_&quot;+Helpers.hashHex((new Exception).getStackTrace.toList.take(10).map(_.toString).mkString(&quot;,&quot;))
+  } else {
+    _formGroup.is match {
+      case Full(x) =&gt; Helpers.nextFuncName(x.toLong * 10000L)
+      case _ =&gt; Helpers.nextFuncName
+    }
   }
 
   def formGroup[T](group: Int)(f: =&gt; T): T = {</diff>
      <filename>lift/src/main/scala/net/liftweb/http/S.scala</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8a78cd691f27b27417c959633a63bef42c4d7248</id>
    </parent>
  </parents>
  <author>
    <name>David Pollak</name>
    <email>feeder.of.the.bears@gmail.com</email>
  </author>
  <url>http://github.com/dpp/liftweb/commit/d488d23b463319eb29542eb6cea7a8a3608e2b6c</url>
  <id>d488d23b463319eb29542eb6cea7a8a3608e2b6c</id>
  <committed-date>2009-07-03T09:52:40-07:00</committed-date>
  <authored-date>2009-07-03T09:52:40-07:00</authored-date>
  <message>Stable identifiers for form fields in Test mode</message>
  <tree>41f5d540d65db8d295879337f7751e78d4af7020</tree>
  <committer>
    <name>David Pollak</name>
    <email>feeder.of.the.bears@gmail.com</email>
  </committer>
</commit>
