diff --git a/Makefile b/Makefile
index f010dbd61cb44e06c3bc68a0285c14751a5747bd..c217b6581231cf392be863f3eef2346e93f88516 100755
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,7 @@ RELEASE_STD_FILES_LIB =  TClock1.lib TTimerv01.lib
 RELEASE_STD_FILES_BIN = $(LAUNCHER_BINARY) $(TTOOL_BINARY) $(TIFTRANSLATOR_BINARY) $(TMLTRANSLATOR_BINARY) $(REMOTESIMULATOR_BINARY) $(RUNDSE_BINARY) 
 RELEASE_STD_FILES_LICENSES = LICENSE LICENSE_CECILL_ENG LICENSE_CECILL_FR
 
-TEST_DIR        = tests
+TEST_DIR        = $(TTOOL_PATH)/tests
 TEST_MK         = test.mk
 TEST_DIRS       = $(shell find $(TEST_DIR)/* -type d)
 TEST_MAKEFILES  = $(patsubst %,%/$(TEST_MK),$(TEST_DIRS))
@@ -294,8 +294,8 @@ test: $(TEST_MAKEFILES)
 	$(foreach m,$(TEST_MAKEFILES),$(MAKE) -s -C $(dir $(m)) -f $(TEST_MK);)
 	@echo "Everything went fine"
 
-$(TEST_DIR)/%/$(TEST_MK):
-	@cp $(TEST_DIR)/$(TEST_MK) $@
+$(TEST_DIR)/%/$(TEST_MK): $(TEST_DIR)/$(TEST_MK)
+	@cp $< $@
 
 clean:
 	rm -f $(TTOOL_SRC)/*.dot $(TTOOL_SRC)/*.dta $(TTOOL_SRC)/*.sim $(TTOOL_SRC)/*.lot
@@ -315,10 +315,11 @@ clean:
 		if [ -w $$t/$(TEST_MK) ]; \
 		then \
 			$(MAKE) -s -C $$t -f $(TEST_MK) clean; \
-			echo rm -f ./$$t/*.class; \
-			rm -f ./$$t/$(TEST_MK); \
+			echo rm -f $$t/*.class; \
+			rm -f $$t/$(TEST_MK); \
 		fi; \
 	done
+	rm -f $(TEST_DIR)/*.class
 
 ultraclean: clean
 	@@for p in $(RELEASE_STD_FILES_BIN); do \
diff --git a/src/avatartranslator/AvatarPragmaTests.java b/src/avatartranslator/AvatarPragmaTests.java
deleted file mode 100644
index 1aa7d1c7b988211a16cf2e83f0b8864c0ac2f94b..0000000000000000000000000000000000000000
--- a/src/avatartranslator/AvatarPragmaTests.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
- *
- * ludovic.apvrille AT enst.fr
- *
- * This software is a computer program whose purpose is to allow the
- * edition of TURTLE analysis, design and deployment diagrams, to
- * allow the generation of RT-LOTOS or Java code from this diagram,
- * and at last to allow the analysis of formal validation traces
- * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
- * from INRIA Rhone-Alpes.
- *
- * This software is governed by the CeCILL  license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "http://www.cecill.info".
- *
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- *
- * /**
- * Class AvatarPragma
- * Creation: 20/05/2010
- * @version 1.1 01/07/2014
- * @author Ludovic APVRILLE, Raja GATGOUT
- * @see
- */
-
-package avatartranslator;
-
-import java.util.*;
-
-import myutil.*;
-
-
-public class AvatarPragmaTests {	
-
-    public static void main(String[] args){
-	
-	//AvatarStateMachine Aasm = new AvatarStateMachine("Aasm", null);
-	//Aasm.addElement(new AvatarState("a1", null));
-	AvatarBlock A = new AvatarBlock("A", null);
-	AvatarStateMachine Aasm = A.getStateMachine();
-	Aasm.addElement(new AvatarState("a1", null));
-	A.addAttribute(new AvatarAttribute("key1", AvatarType.INTEGER, null));
-	A.addAttribute(new AvatarAttribute("key2", AvatarType.INTEGER, null));
-
-	AvatarBlock B = new AvatarBlock("B", null);
-	B.addAttribute(new AvatarAttribute("key1", AvatarType.INTEGER, null));
-	B.addAttribute(new AvatarAttribute("key2", AvatarType.BOOLEAN, null));
-
-	AvatarBlock C = new AvatarBlock("C", null);
-	AvatarStateMachine Casm = C.getStateMachine();
-	Casm.addElement(new AvatarState("c1", null));
-	C.addAttribute(new AvatarAttribute("attr", AvatarType.INTEGER, null));
-
-
-	//System.out.println(A.getStateMachine().getStateWithName("a1"));
-
-	LinkedList<AvatarBlock> blocks = new LinkedList<AvatarBlock>();
-	blocks.add(A);
-	blocks.add(B);
-        blocks.add(C);
-	AvatarPragma res;
-
-	//Test Bad keyword
-	res = AvatarPragma.createFromString("FakePragma A.key1", null,blocks);
-	System.out.println("Bad keyword: " + (res==null));
-
-	//Handle whitespace
-	res = AvatarPragma.createFromString("Public      A.key1", null,blocks);
-	System.out.println("Whitespace parsing: " + (res!=null));
-	res = AvatarPragma.createFromString("PrivatePublicKeys   A.key1     B.key2", null,blocks);
-	System.out.println("Whitespace parsing: " + (res!=null));
-
-	//Test missing block
-	res = AvatarPragma.createFromString("Confidentiality non.arrrrg", null,blocks);
-	System.out.println("Missing Block: " + (res==null));
-	res = AvatarPragma.createFromString("Confidentiality A.key1 B.key2 C.attr non.arrrrg", null,blocks);
-	System.out.println("Missing Block: " + (res==null));
-
-	//Test badly formed attribute
-	res = AvatarPragma.createFromString("Confidentiality attr", null,blocks);
-	System.out.println("Attribute formatting: " + (res==null));
-	res = AvatarPragma.createFromString("Public A.a1.attr", null,blocks);
-	System.out.println("Attribute formatting: " + (res==null));
-
-	//Test missing attribute
-	res = AvatarPragma.createFromString(" Confidentiality            ", null,blocks);
-	System.out.println("Missing Attribute: " + (res==null));
-	res = AvatarPragma.createFromString("Confidentiality A.arrrrg", null,blocks);
-	System.out.println("Missing Attribute: " + (res==null));
-	res = AvatarPragma.createFromString("Confidentiality C.attr C.attr B.key1 A.arrrrg", null,blocks);
-	System.out.println("Missing Attribute: " + (res==null));
-	System.out.println("-------------------------------------");
-
-	//Test Confidentiality
-	System.out.println("Confidentiality Tests");
-	res = AvatarPragma.createFromString("Confidentiality A.key1", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaSecret));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 1));
-	System.out.println("Attr Name " + res.getArgs().get(0));
-	System.out.println("-------------------------------------");
-
-	//Test Secret
-	System.out.println("Secret Tests");
-	res = AvatarPragma.createFromString("Secret A.key1 A.key2", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaSecret));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 2));
-	System.out.println(res.getArgs().get(0));
-	System.out.println("Attr Name "+ (res.getArgs().get(0).equals("int key1")));
-	System.out.println("Attr Name "+(res.getArgs().get(1).equals("int key2")));
-	System.out.println("-------------------------------------");
-	
-	//Test Secrecy Assumption
-	System.out.println("SecrecyAssumption Tests");
-	res = AvatarPragma.createFromString("SecrecyAssumption A.key1 A.key2 B.key1 C.attr", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaSecrecyAssumption));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 4));
-	System.out.println("-------------------------------------");
-	
-	//Test System Knowledge
-	System.out.println("Initial System Knowledge Tests");
-	res = AvatarPragma.createFromString("InitialSystemKnowledge A.key1 A.key2 B.key1 C.attr", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaInitialKnowledge));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 4));
-	//Is system
-	AvatarPragmaInitialKnowledge res2 = (AvatarPragmaInitialKnowledge) res;
-	System.out.println("Is System: " + res2.isSystem());
-	System.out.println("-------------------------------------");
-
-	//Test System Knowledge
-	System.out.println("Initial Session Knowledge Tests");
-	res = AvatarPragma.createFromString("InitialSessionKnowledge A.key2 B.key1 C.attr", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaInitialKnowledge));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 3));
-	//Is session
-	res2 = (AvatarPragmaInitialKnowledge) res;
-	System.out.println("Is Session: " + !res2.isSystem());
-	System.out.println("-------------------------------------");
-
-	//Test PrivatePublicKey
-	System.out.println("PrivatePublicKeys Tests");
-	//Fail if wrong # of args
-	res = AvatarPragma.createFromString("PrivatePublicKeys C.attr", null,blocks);	
-	System.out.println("PrivatePublicKeys args count " + (res==null));
-	res = AvatarPragma.createFromString("PrivatePublicKeys A.key1 A.key2 B.key1 C.attr", null,blocks);	
-	System.out.println("PrivatePublicKeys args count " + (res==null));
-	//Check no error
-	res = AvatarPragma.createFromString("PrivatePublicKeys A.key2 B.key1", null,blocks);	
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaPrivatePublicKey));
-	//1 Attribute
-	AvatarPragmaPrivatePublicKey res4 = (AvatarPragmaPrivatePublicKey) res;
-	System.out.println("# of Attributes: " + (res4.getArgs().size() == 2));
-	System.out.println("Attr Name "+ res4.getPublicKey());
-	System.out.println("Attr Name "+ res4.getPrivateKey());
-	System.out.println("-------------------------------------");
-
-	//Test Public
-	System.out.println("Public Tests");
-	res = AvatarPragma.createFromString("Public A.key1 B.key2", null,blocks);	
-	//Check no error
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaPublic));
-	//1 Attribute
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 2));
-	System.out.println("Attr Name " + res.getArgs().get(0));
-	System.out.println("Attr Name " + res.getArgs().get(1));
-	System.out.println("-------------------------------------");
-	
-	//Test Authenticity
-	System.out.println("Authenticity Tests");
-	//Fail if wrong # of args
-	res = AvatarPragma.createFromString("Authenticity A.key1 A.key2 B.key1 C.attr", null,blocks);	
-	System.out.println("Authenticity args count " + (res==null));
-	res = AvatarPragma.createFromString("Authenticity C.attr", null,blocks);	
-	System.out.println("Authenticity args count " + (res==null));
-	//Fail if lack of state
-	res = AvatarPragma.createFromString("Authenticity A.state.attr", null,blocks);	
-	System.out.println("Missing State " + (res==null));
-	//Check no error
-	res = AvatarPragma.createFromString("Authenticity A.a1.key1 C.c1.attr", null,blocks);	
-	System.out.println("No error: "+ (res !=null));
-	//Check Type
-	System.out.println("Right Type: " + (res instanceof AvatarPragmaAuthenticity));
-	//1 Attribute
-	AvatarPragmaAuthenticity res3 = (AvatarPragmaAuthenticity) res;
-	System.out.println("# of Attributes: " + (res.getArgs().size() == 2));
-	System.out.println("Attr "+ res3.getAttrA());
-	System.out.println("Attr "+ res3.getAttrB());
-	System.out.println("Attr Name "+ res3.getAttrA().getName());
-	System.out.println("Attr Name "+ res3.getAttrB().getName());
-	System.out.println("Attr State "+ res3.getAttrA().getState());
-	System.out.println("Attr State "+ res3.getAttrB().getState());
-	System.out.println("-------------------------------------");
-
-
-	//Test Constants
-	System.out.println("Constant Tests");
-	res = AvatarPragma.createFromString("Constant 1 0 a b", null,blocks);	
-	System.out.println("Right type :" + (res instanceof AvatarPragmaConstant));
-	AvatarPragmaConstant res5 = (AvatarPragmaConstant) res;
-        System.out.println("Right number of constants " + (res5.getConstants().size() == 4));
-	for (int i=0; i< res5.getConstants().size(); i++){
-            System.out.println("Constant " + res5.getConstants().get(i).getName());
-	}
-	System.out.println("-------------------------------------");
-
-
-	//Avatar Specification Tests
-	
-	System.out.println("Tests finished");
-    }
-    public static void test(String[] args){
-	System.out.println("!!!");
-	}
-}
diff --git a/src/myutil/TraceManager.java b/src/myutil/TraceManager.java
index e2d71cf80cd0173215a0235ee46108161b203c61..bceafa037c42d7e10c84e33ac934c94f6d06b4bd 100644
--- a/src/myutil/TraceManager.java
+++ b/src/myutil/TraceManager.java
@@ -49,45 +49,45 @@ import java.io.*;
 
 
 public class TraceManager {
-	public final static int TO_CONSOLE = 0;
-	public final static int TO_FILE = 1;
-	public final static int TO_BUFFER = 2;
-	public final static int TO_DEVNULL = 3;
-	
+    public final static int TO_CONSOLE = 0;
+    public final static int TO_FILE = 1;
+    public final static int TO_BUFFER = 2;
+    public final static int TO_DEVNULL = 3;
+
     public static int userPolicy = TO_CONSOLE;
     public static int devPolicy = TO_CONSOLE;
-	public static int errPolicy = TO_CONSOLE;
-    
-	public static void addDev(String _s) {
-		switch(devPolicy) {
-		case TO_CONSOLE:
-			System.out.println(_s);
-			break;
-		case TO_DEVNULL:
-			break;
-		default:
-		}
-	}
-	
-	public static void addUser(String _s) {
-		switch(userPolicy) {
-		case TO_CONSOLE:
-			System.out.println(_s);
-			break;
-		default:
-			System.out.println(_s);
-		}
-	}
-	
-	public static void addError(String _s) {
-		switch(errPolicy) {
-		case TO_CONSOLE:
-			System.err.println(_s);
-			break;
-		default:
-			System.err.println(_s);
-		}
-	}
+    public static int errPolicy = TO_CONSOLE;
+
+    public static void addDev(String _s) {
+        switch(devPolicy) {
+            case TO_CONSOLE:
+                System.out.println(_s);
+                break;
+            case TO_DEVNULL:
+                break;
+            default:
+        }
+    }
+
+    public static void addUser(String _s) {
+        switch(userPolicy) {
+            case TO_CONSOLE:
+                System.out.println(_s);
+                break;
+            default:
+                System.out.println(_s);
+        }
+    }
+
+    public static void addError(String _s) {
+        switch(errPolicy) {
+            case TO_CONSOLE:
+                System.err.println(_s);
+                break;
+            default:
+                System.err.println(_s);
+        }
+    }
+
 
-    
 } // Class TraceManager
diff --git a/tests/Avatar/AvatarPragmaTests.java b/tests/Avatar/AvatarPragmaTests.java
new file mode 100644
index 0000000000000000000000000000000000000000..c9d435c249e9ff3cd1357b58da03108495297c63
--- /dev/null
+++ b/tests/Avatar/AvatarPragmaTests.java
@@ -0,0 +1,271 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarPragma
+ * Creation: 20/05/2010
+ * @version 1.1 01/07/2014
+ * @author Ludovic APVRILLE, Raja GATGOUT
+ * @see
+ */
+
+import java.util.LinkedList;
+
+import avatartranslator.AvatarStateMachine;
+import avatartranslator.AvatarState;
+import avatartranslator.AvatarAttribute;
+import avatartranslator.AvatarType;
+import avatartranslator.AvatarBlock;
+import avatartranslator.AvatarPragma;
+import avatartranslator.AvatarPragmaSecret;
+import avatartranslator.AvatarPragmaSecrecyAssumption;
+import avatartranslator.AvatarPragmaInitialKnowledge;
+import avatartranslator.AvatarPragmaPrivatePublicKey;
+import avatartranslator.AvatarPragmaPublic;
+import avatartranslator.AvatarPragmaAuthenticity;
+import avatartranslator.AvatarPragmaConstant;
+
+public class AvatarPragmaTests extends TToolTest {	
+
+    public AvatarPragmaTests () {
+        super ("AvatarPragmas", false);
+    }
+
+    protected void test () {
+        AvatarBlock A = new AvatarBlock("A", null, null);
+        AvatarStateMachine Aasm = A.getStateMachine();
+        Aasm.addElement(new AvatarState("a1", null));
+        A.addAttribute(new AvatarAttribute("key1", AvatarType.INTEGER, A, null));
+        A.addAttribute(new AvatarAttribute("key2", AvatarType.INTEGER, A, null));
+
+        AvatarBlock B = new AvatarBlock("B", null, null);
+        B.addAttribute(new AvatarAttribute("key1", AvatarType.INTEGER, B, null));
+        B.addAttribute(new AvatarAttribute("key2", AvatarType.BOOLEAN, B, null));
+
+        AvatarBlock C = new AvatarBlock("C", null, null);
+        AvatarStateMachine Casm = C.getStateMachine();
+        Casm.addElement(new AvatarState("c1", null));
+        C.addAttribute(new AvatarAttribute("attr", AvatarType.INTEGER, C, null));
+
+
+        //this.updateDigest(A.getStateMachine().getStateWithName("a1"));
+
+        LinkedList<AvatarBlock> blocks = new LinkedList<AvatarBlock>();
+        blocks.add(A);
+        blocks.add(B);
+        blocks.add(C);
+        AvatarPragma res;
+
+        //Test Bad keyword
+        res = AvatarPragma.createFromString("FakePragma A.key1", null,blocks);
+        this.updateDigest("Bad keyword: " + (res==null));
+
+        //Handle whitespace
+        res = AvatarPragma.createFromString("Public      A.key1", null,blocks);
+        this.updateDigest("Whitespace parsing: " + (res!=null));
+        res = AvatarPragma.createFromString("PrivatePublicKeys   A.key1     B.key2", null,blocks);
+        this.updateDigest("Whitespace parsing: " + (res!=null));
+
+        //Test missing block
+        res = AvatarPragma.createFromString("Confidentiality non.arrrrg", null,blocks);
+        this.updateDigest("Missing Block: " + (res==null));
+        res = AvatarPragma.createFromString("Confidentiality A.key1 B.key2 C.attr non.arrrrg", null,blocks);
+        this.updateDigest("Missing Block: " + (res==null));
+
+        //Test badly formed attribute
+        res = AvatarPragma.createFromString("Confidentiality attr", null,blocks);
+        this.updateDigest("Attribute formatting: " + (res==null));
+        res = AvatarPragma.createFromString("Public A.a1.attr", null,blocks);
+        this.updateDigest("Attribute formatting: " + (res==null));
+
+        //Test missing attribute
+        res = AvatarPragma.createFromString(" Confidentiality            ", null,blocks);
+        this.updateDigest("Missing Attribute: " + (res==null));
+        res = AvatarPragma.createFromString("Confidentiality A.arrrrg", null,blocks);
+        this.updateDigest("Missing Attribute: " + (res==null));
+        res = AvatarPragma.createFromString("Confidentiality C.attr C.attr B.key1 A.arrrrg", null,blocks);
+        this.updateDigest("Missing Attribute: " + (res==null));
+        this.updateDigest("-------------------------------------");
+
+        //Test Confidentiality
+        this.updateDigest("Confidentiality Tests");
+        res = AvatarPragma.createFromString("Confidentiality A.key1", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaSecret));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 1));
+        this.updateDigest("Attr Name " + res.getArgs().get(0));
+        this.updateDigest("-------------------------------------");
+
+        //Test Secret
+        this.updateDigest("Secret Tests");
+        res = AvatarPragma.createFromString("Secret A.key1 A.key2", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaSecret));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 2));
+        this.updateDigest(res.getArgs().get(0).toString ());
+        this.updateDigest("Attr Name "+ (res.getArgs().get(0).equals("int key1")));
+        this.updateDigest("Attr Name "+(res.getArgs().get(1).equals("int key2")));
+        this.updateDigest("-------------------------------------");
+
+        //Test Secrecy Assumption
+        this.updateDigest("SecrecyAssumption Tests");
+        res = AvatarPragma.createFromString("SecrecyAssumption A.key1 A.key2 B.key1 C.attr", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaSecrecyAssumption));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 4));
+        this.updateDigest("-------------------------------------");
+
+        //Test System Knowledge
+        this.updateDigest("Initial System Knowledge Tests");
+        res = AvatarPragma.createFromString("InitialSystemKnowledge A.key1 A.key2 B.key1 C.attr", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaInitialKnowledge));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 4));
+        //Is system
+        AvatarPragmaInitialKnowledge res2 = (AvatarPragmaInitialKnowledge) res;
+        this.updateDigest("Is System: " + res2.isSystem());
+        this.updateDigest("-------------------------------------");
+
+        //Test System Knowledge
+        this.updateDigest("Initial Session Knowledge Tests");
+        res = AvatarPragma.createFromString("InitialSessionKnowledge A.key2 B.key1 C.attr", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaInitialKnowledge));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 3));
+        //Is session
+        res2 = (AvatarPragmaInitialKnowledge) res;
+        this.updateDigest("Is Session: " + !res2.isSystem());
+        this.updateDigest("-------------------------------------");
+
+        //Test PrivatePublicKey
+        this.updateDigest("PrivatePublicKeys Tests");
+        //Fail if wrong # of args
+        res = AvatarPragma.createFromString("PrivatePublicKeys C.attr", null,blocks);	
+        this.updateDigest("PrivatePublicKeys args count " + (res==null));
+        res = AvatarPragma.createFromString("PrivatePublicKeys A.key1 A.key2 B.key1 C.attr", null,blocks);	
+        this.updateDigest("PrivatePublicKeys args count " + (res==null));
+        //Check no error
+        res = AvatarPragma.createFromString("PrivatePublicKeys A.key2 B.key1", null,blocks);	
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaPrivatePublicKey));
+        //1 Attribute
+        AvatarPragmaPrivatePublicKey res4 = (AvatarPragmaPrivatePublicKey) res;
+        this.updateDigest("# of Attributes: " + (res4.getArgs().size() == 2));
+        this.updateDigest("Attr Name "+ res4.getPublicKey());
+        this.updateDigest("Attr Name "+ res4.getPrivateKey());
+        this.updateDigest("-------------------------------------");
+
+        //Test Public
+        this.updateDigest("Public Tests");
+        res = AvatarPragma.createFromString("Public A.key1 B.key2", null,blocks);	
+        //Check no error
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaPublic));
+        //1 Attribute
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 2));
+        this.updateDigest("Attr Name " + res.getArgs().get(0));
+        this.updateDigest("Attr Name " + res.getArgs().get(1));
+        this.updateDigest("-------------------------------------");
+
+        //Test Authenticity
+        this.updateDigest("Authenticity Tests");
+        //Fail if wrong # of args
+        res = AvatarPragma.createFromString("Authenticity A.key1 A.key2 B.key1 C.attr", null,blocks);	
+        this.updateDigest("Authenticity args count " + (res==null));
+        res = AvatarPragma.createFromString("Authenticity C.attr", null,blocks);	
+        this.updateDigest("Authenticity args count " + (res==null));
+        //Fail if lack of state
+        res = AvatarPragma.createFromString("Authenticity A.state.attr", null,blocks);	
+        this.updateDigest("Missing State " + (res==null));
+        //Check no error
+        res = AvatarPragma.createFromString("Authenticity A.a1.key1 C.c1.attr", null,blocks);	
+        this.updateDigest("No error: "+ (res !=null));
+        //Check Type
+        this.updateDigest("Right Type: " + (res instanceof AvatarPragmaAuthenticity));
+        //1 Attribute
+        AvatarPragmaAuthenticity res3 = (AvatarPragmaAuthenticity) res;
+        this.updateDigest("# of Attributes: " + (res.getArgs().size() == 2));
+        this.updateDigest("Attr "+ res3.getAttrA());
+        this.updateDigest("Attr "+ res3.getAttrB());
+        this.updateDigest("Attr Name "+ res3.getAttrA().getName());
+        this.updateDigest("Attr Name "+ res3.getAttrB().getName());
+        this.updateDigest("Attr State "+ res3.getAttrA().getState());
+        this.updateDigest("Attr State "+ res3.getAttrB().getState());
+        this.updateDigest("-------------------------------------");
+
+
+        //Test Constants
+        this.updateDigest("Constant Tests");
+        res = AvatarPragma.createFromString("Constant 1 0 a b", null,blocks);	
+        this.updateDigest("Right type :" + (res instanceof AvatarPragmaConstant));
+        AvatarPragmaConstant res5 = (AvatarPragmaConstant) res;
+        this.updateDigest("Right number of constants " + (res5.getConstants().size() == 4));
+        for (int i=0; i< res5.getConstants().size(); i++){
+            this.updateDigest("Constant " + res5.getConstants().get(i).getName());
+        }
+        this.updateDigest("-------------------------------------");
+
+
+        //Avatar Specification Tests
+        this.updateDigest("Tests finished");
+
+        if (!this.testDigest (new byte[] {84, 40, -70, -41, -32, 102, 18, 125, -30, -120, -87, -7, 112, -25, 119, 106, 96, 18, -97, 41}))
+            this.error ("Unexpected result when testing AvatarPragmas...");
+    }
+
+    public static void main(String[] args){
+        AvatarPragmaTests apt = new AvatarPragmaTests ();
+        apt.runTest ();
+    }
+}
diff --git a/tests/Avatar/ProVerif/ProVerifOutputAnalyzerTest.java b/tests/Avatar/ProVerif/ProVerifOutputAnalyzerTest.java
index 999050efdcb4e5a0644e7d154a6562a960559e03..1649045b72fa26cf35cd45784a4864a30cb8c903 100644
--- a/tests/Avatar/ProVerif/ProVerifOutputAnalyzerTest.java
+++ b/tests/Avatar/ProVerif/ProVerifOutputAnalyzerTest.java
@@ -46,8 +46,6 @@
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
 
 import avatartranslator.AvatarAttribute;
 import avatartranslator.AvatarBlock;
@@ -55,13 +53,14 @@ import avatartranslator.AvatarSpecification;
 import avatartranslator.toproverif.AVATAR2ProVerif;
 import proverifspec.ProVerifOutputAnalyzer;
 
+public class ProVerifOutputAnalyzerTest extends TToolTest {
 
-public class ProVerifOutputAnalyzerTest {
-    public static void main(String[] args){
-        BufferedReader br = null;
-        byte[] expectedTyped = {-6, -76, -105, 122, 48, -22, 6, -4, 75, 68, 112, -32, 38, 67, 123, -98, -38, -87, 30, -27};
-        byte[] expectedUntyped = {-84, -61, 35, -120, 72, -116, -42, 37, -20, 80, -38, -73, -1, -17, 85, -81, 53, -5, 70, 88};
+    public ProVerifOutputAnalyzerTest () {
+        super ("ProVerif Output Analyzer", false);
+    }
 
+    protected void test () {
+        BufferedReader br = null;
         try {
             String s="";
             String sCurrentLine;
@@ -71,8 +70,6 @@ public class ProVerifOutputAnalyzerTest {
             }
             //System.out.println(s);
 
-            System.out.print("==========> Testing ProVerif Output Analyzer");
-
             AvatarSpecification avspec = new AvatarSpecification ("dummy", null);
             AvatarBlock aliceBlock = new AvatarBlock ("Alice", avspec, null);
             aliceBlock.addAttribute (new AvatarAttribute ("sk__data", null, aliceBlock, null));
@@ -86,8 +83,6 @@ public class ProVerifOutputAnalyzerTest {
             avspec.addBlock (aliceBlock);
             avspec.addBlock (bobBlock);
 
-            MessageDigest md = MessageDigest.getInstance ("SHA");
-
             ProVerifOutputAnalyzer poa = new ProVerifOutputAnalyzer(
                     new AVATAR2ProVerif (avspec) {
                         public String getTrueName (AvatarAttribute attr) {
@@ -99,63 +94,61 @@ public class ProVerifOutputAnalyzerTest {
 
 
             //Test for Reachable Events
-            //System.out.println("Reachable Events " + poa.getReachableEvents().size());
+            this.updateDigest ("Reachable Events " + poa.getReachableEvents().size());
             for (String str: poa.getReachableEvents()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
 
-            //System.out.println("NonReachable Events " + poa.getNonReachableEvents().size());
+            this.updateDigest ("NonReachable Events " + poa.getNonReachableEvents().size());
             for (String str: poa.getNonReachableEvents()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Secret Terms " + poa.getSecretTerms().size());
+
+            this.updateDigest ("Secret Terms " + poa.getSecretTerms().size());
             for (AvatarAttribute attr: poa.getSecretTerms()){
-                md.update((attr.getBlock ().getName () + "." + attr.getName ()).getBytes ());
+                this.updateDigest ((attr.getBlock ().getName () + "." + attr.getName ()));
             }
-            //System.out.println("Non Secret Terms " + poa.getNonSecretTerms().size());
+            
+            this.updateDigest ("Non Secret Terms " + poa.getNonSecretTerms().size());
             for (AvatarAttribute attr: poa.getNonSecretTerms()){
-                md.update((attr.getBlock ().getName () + "." + attr.getName ()).getBytes ());
+                this.updateDigest ((attr.getBlock ().getName () + "." + attr.getName ()));
             }
-            //System.out.println("Satisfied Authenticity " +poa.getSatisfiedAuthenticity().size());
+
+            this.updateDigest ("Satisfied Authenticity " +poa.getSatisfiedAuthenticity().size());
             for (String str: poa.getSatisfiedAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Satisfied Weak Authenticity " +poa.getSatisfiedWeakAuthenticity().size());
+            
+            this.updateDigest ("Satisfied Weak Authenticity " +poa.getSatisfiedWeakAuthenticity().size());
             for (String str: poa.getSatisfiedWeakAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Non Satisfied Authenticity " +poa.getNonSatisfiedAuthenticity().size());
+
+            this.updateDigest ("Non Satisfied Authenticity " +poa.getNonSatisfiedAuthenticity().size());
             for (String str: poa.getNonSatisfiedAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Errors " +poa.getErrors().size());
+
+            this.updateDigest ("Errors " +poa.getErrors().size());
             for (String str: poa.getErrors()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Not proved " +poa.getNotProved().size());	
+
+            this.updateDigest ("Not proved " +poa.getNotProved().size());	
             for (String str: poa.getNotProved()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
 
-            byte[] dig = md.digest ();
-            for (int i=0; i<dig.length; i++)
-                if (expectedTyped[i] != dig[i]) {
-                    System.err.println ("\nCouldn't analyze ProVerif typed output...\n");
-                    System.exit (-1);
-                }
-
-            //Untyped Tests
-            //System.out.println("Untyped Tests");
+            if (!this.testDigest (new byte[] {-126, -51, 48, -20, -15, -101, 107, 0, -46, -110, -80, -56, -4, -120, 37, -47, -20, -55, 114, 111}))
+                this.error ("Couldn't analyze ProVerif typed output...");
 
             s = "";
             br = new BufferedReader(new FileReader("untyped.txt"));
             while ((sCurrentLine = br.readLine()) != null) {
                 s= s.concat(sCurrentLine+"\n");
             }
-            //System.out.println(s);
-
-            //System.out.println("__________________________________");
 
+            this.updateDigest ("__________________________________");
 
             poa = new ProVerifOutputAnalyzer(
                     new AVATAR2ProVerif (avspec) {
@@ -165,75 +158,67 @@ public class ProVerifOutputAnalyzerTest {
                     });
             poa.analyzeOutput(s,false);
 
-            md.reset ();
-
-            //System.out.println("Reachable Events " + poa.getReachableEvents().size());
+            this.updateDigest ("Reachable Events " + poa.getReachableEvents().size());
             for (String str: poa.getReachableEvents()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
 
-            //System.out.println("NonReachable Events " + poa.getNonReachableEvents().size());
+            this.updateDigest ("NonReachable Events " + poa.getNonReachableEvents().size());
             for (String str: poa.getNonReachableEvents()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Secret Terms " + poa.getSecretTerms().size());
+
+            this.updateDigest ("Secret Terms " + poa.getSecretTerms().size());
             for (AvatarAttribute attr: poa.getSecretTerms()){
-                md.update((attr.getBlock ().getName () + "." + attr.getName ()).getBytes ());
+                this.updateDigest ((attr.getBlock ().getName () + "." + attr.getName ()));
             }
-            //System.out.println("Non Secret Terms " + poa.getNonSecretTerms().size());
+
+            this.updateDigest ("Non Secret Terms " + poa.getNonSecretTerms().size());
             for (AvatarAttribute attr: poa.getNonSecretTerms()){
-                md.update((attr.getBlock ().getName () + "." + attr.getName ()).getBytes ());
+                this.updateDigest ((attr.getBlock ().getName () + "." + attr.getName ()));
             }
-            //System.out.println("Satisfied Authenticity " +poa.getSatisfiedAuthenticity().size());
+
+            this.updateDigest ("Satisfied Authenticity " +poa.getSatisfiedAuthenticity().size());
             for (String str: poa.getSatisfiedAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Satisfied Weak Authenticity " +poa.getSatisfiedWeakAuthenticity().size());
+
+            this.updateDigest ("Satisfied Weak Authenticity " +poa.getSatisfiedWeakAuthenticity().size());
             for (String str: poa.getSatisfiedWeakAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Non Satisfied Authenticity " +poa.getNonSatisfiedAuthenticity().size());
+
+            this.updateDigest ("Non Satisfied Authenticity " +poa.getNonSatisfiedAuthenticity().size());
             for (String str: poa.getNonSatisfiedAuthenticity()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Errors " +poa.getErrors().size());
+
+            this.updateDigest ("Errors " +poa.getErrors().size());
             for (String str: poa.getErrors()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
-            //System.out.println("Not proved " +poa.getNotProved().size());	
+
+            this.updateDigest ("Not proved " +poa.getNotProved().size());	
             for (String str: poa.getNotProved()){
-                md.update(str.getBytes ());
+                this.updateDigest (str);
             }
 
+            if (!this.testDigest (new byte[] {103, 89, 62, 106, -11, 41, -54, -64, -24, 74, 109, -93, 77, -21, 72, -62, 117, -41, -114, 46}))
+                this.error ("Couldn't analyze ProVerif untyped output...");
 
-            dig = md.digest ();
-
-            //System.out.print ("{");
-            //for (byte b: dig) {
-            //    System.out.print (b);
-            //    System.out.print (", ");
-            //}
-            //System.out.println ();
-            
-            for (int i=0; i<dig.length; i++)
-                if (expectedUntyped[i] != dig[i]) {
-                    System.err.println ("\nCouldn't analyze ProVerif untyped output...\n");
-                    System.exit (-1);
-                }
-
-            System.out.println(": ok");
-
-        } catch (IOException | NoSuchAlgorithmException e) {
-            e.printStackTrace();
-            System.exit (-1);
+        } catch (IOException e) {
+            this.error (e.toString ());
         } finally {
             try {
                 if (br != null)br.close();
             } catch (IOException ex) {
-                ex.printStackTrace();
-                System.exit (-1);
+                this.error (ex.toString ());
             }
         }
+    }
 
+    public static void main(String[] args){
+        ProVerifOutputAnalyzerTest pvoat = new ProVerifOutputAnalyzerTest ();
+        pvoat.runTest ();
     }
 }
diff --git a/tests/TToolTest.java b/tests/TToolTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..0450167d55d01bcc5a623e43c229fe7cfc94f540
--- /dev/null
+++ b/tests/TToolTest.java
@@ -0,0 +1,149 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarPragma
+ * Creation: 20/05/2010
+ * @version 1.1 01/07/2014
+ * @author Ludovic APVRILLE, Florian LUGOU
+ * @see
+ */
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import myutil.TraceManager;
+
+public abstract class TToolTest {	
+    private MessageDigest md;
+    private boolean verbose;
+    private boolean ok;
+    private String name;
+
+    public TToolTest (String name, boolean verbose) {
+        if (!this.verbose) {
+            TraceManager.userPolicy = TraceManager.TO_DEVNULL;
+            TraceManager.devPolicy = TraceManager.TO_DEVNULL;
+            TraceManager.errPolicy = TraceManager.TO_DEVNULL;
+        }
+
+        try {
+            this.ok = true;
+            this.md = MessageDigest.getInstance ("SHA");
+            this.verbose = verbose;
+            this.name = name;
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace ();
+            System.exit (-1);
+        }
+    }
+
+    public TToolTest (String name) {
+        this (name, false);
+    }
+
+    protected void error (String str) {
+        if (this.ok)
+            System.err.println ();
+        System.err.println (str);
+        this.ok = false;
+    }
+
+    protected void updateDigest (String str) {
+        if (this.verbose)
+            System.out.println (str);
+        this.md.update (str.getBytes ());
+    }
+
+    public byte[] getDigest () {
+        return this.md.digest ();
+    }
+
+    public boolean testDigest (byte[] expected) {
+        byte[] dig = this.getDigest ();
+        if (dig.length != expected.length)
+            return false;
+
+        for (int i=0; i<dig.length; i++)
+            if (expected[i] != dig[i])
+                return false;
+
+        return true;
+    }
+
+    public void printDigest () {
+        boolean first = true;
+        byte[] dig = this.getDigest ();
+
+        System.out.print ("new byte[] {");
+        for (byte b: dig) {
+            if (first)
+                first = false;
+            else
+                System.out.print (", ");
+            System.out.print (b);
+        }
+        System.out.println ("}");
+    }
+
+    public void resetDigest () {
+        this.md.reset ();
+    }
+
+    public void runTest () {
+        System.out.print("==========> Testing " + this.name);
+        System.out.flush ();
+        if (this.verbose)
+            System.out.println ();
+
+        this.test ();
+
+        this.end ();
+    }
+
+    private void end () {
+        if (this.ok) {
+            if (this.verbose)
+                System.out.print("==========> Testing " + this.name);
+            System.out.println(": ok");
+        }
+        else
+            System.exit (-1);
+    }
+
+    protected abstract void test ();
+}
diff --git a/tests/test.mk b/tests/test.mk
index 90640359a1ff3c429eee171acb3f4ecd081a48dc..feff1a4a81cbd0e6712ac918c4313eee75577c78 100644
--- a/tests/test.mk
+++ b/tests/test.mk
@@ -1,7 +1,7 @@
 CLASS=$(patsubst %.java,%.class,$(wildcard *.java))
 test: $(CLASS)
-	$(foreach var,$(CLASS),$(JAVA) $(CLASSPATH) "$(TTOOL_SRC):." $(patsubst %.class,%,$(var));)
+	$(foreach var,$(CLASS),$(JAVA) $(CLASSPATH) "$(TTOOL_SRC):$(TEST_DIR):." $(patsubst %.class,%,$(var));)
 %.class: %.java
-	$(JAVAC) $(CLASSPATH) $(TTOOL_BIN)/$(JSOUP_BINARY):$(TTOOL_BIN)/$(COMMON_CODEC_BINARY):$(TTOOL_SRC) $<
+	$(JAVAC) $(CLASSPATH) $(TTOOL_BIN)/$(JSOUP_BINARY):$(TTOOL_BIN)/$(COMMON_CODEC_BINARY):$(TTOOL_SRC):$(TEST_DIR) $<
 clean:
 	rm -f *.class