diff --git a/sigil/gogo/junit/src/org/apache/felix/sigil/gogo/junit/SigilTestAdapter.java b/sigil/gogo/junit/src/org/apache/felix/sigil/gogo/junit/SigilTestAdapter.java
index fcb51b8..1755b73 100644
--- a/sigil/gogo/junit/src/org/apache/felix/sigil/gogo/junit/SigilTestAdapter.java
+++ b/sigil/gogo/junit/src/org/apache/felix/sigil/gogo/junit/SigilTestAdapter.java
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.sigil.gogo.junit;
 
-
 import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 
@@ -29,34 +28,71 @@
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Function;
 
-
 public class SigilTestAdapter
 {
-    public TestCase newTest( final CommandSession session, final String name, final Function f, final Object... args )
+    public TestCase newTest(final CommandSession session, final String name,
+        final Function f, final Object... args)
     {
-        return new TestCase( name )
+        return new TestCase(name)
         {
             public void runTest() throws Throwable
             {
                 try
                 {
-                    f.execute( session, Arrays.asList( args ) );
+                    f.execute(session, Arrays.asList(args));
                 }
-                catch ( InvocationTargetException e )
+                catch (Throwable t)
                 {
-                    throw e.getCause();
+                    if (t instanceof InvocationTargetException)
+                        t = t.getCause();
+
+                    // stack trace is no use for identifying the location of
+                    // junit:assert methods in scripts.
+                    // So add gogo script location to stack trace.
+                    Object loc = session.get(".location");
+                    if (loc != null)
+                    {
+                        // file:/path/to/file:line.column
+                        String sloc = (String) loc;
+                        String fileName = sloc;
+                        int lineNumber = 0;
+
+                        if (sloc.matches(".*:[\\d.]+$"))
+                        {
+                            int colon = sloc.lastIndexOf(':');
+                            fileName = sloc.substring(0, colon);
+                            String number = sloc.substring(colon + 1);
+                            int dot = number.indexOf('.');
+                            if (dot > 0)
+                                number = number.substring(0, dot);
+                            lineNumber = Integer.parseInt(number);
+                        }
+
+                        StackTraceElement[] trace = t.getStackTrace();
+                        StackTraceElement element = new StackTraceElement(
+                            "SigilTestAdaptor", "runTest", fileName, lineNumber);
+
+                        StackTraceElement[] ev = new StackTraceElement[1 + trace.length];
+                        int i = 0;
+                        ev[i++] = element;
+                        for (StackTraceElement e : trace)
+                            ev[i++] = e;
+
+                        t.setStackTrace(ev);
+                    }
+
+                    throw t;
                 }
             }
         };
     }
 
-
-    public TestSuite newTestSuite( String name, Test... tests )
+    public TestSuite newTestSuite(String name, Test... tests)
     {
-        TestSuite suite = new TestSuite( name );
-        for ( Test t : tests )
+        TestSuite suite = new TestSuite(name);
+        for (Test t : tests)
         {
-            suite.addTest( t );
+            suite.addTest(t);
         }
         return suite;
     }
