Presentation is loading. Please wait.

Presentation is loading. Please wait.

The quick fact of EMMA Seiya Kawashima Loyola University Chicago EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

Similar presentations


Presentation on theme: "The quick fact of EMMA Seiya Kawashima Loyola University Chicago EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved."— Presentation transcript:

1 The quick fact of EMMA Seiya Kawashima Loyola University Chicago EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

2 Here is the overview Two modes of EMMA. When to use which mode. What depth EMMA can detect coverage? When EMMA can detect only partially? How about unit test with EMMA? Appendix EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

3 Two modes of EMMA 1. On-The-Fly Instrumenting as classes are loaded by JVM. Three stages( Instrument, Execute and Report) are into ONE step. 2. Offline Before classes are loaded by JVM. Their instrumented data is on disk. Three stages (Instrument,Execute and Report) are INDIVIDUAL steps. EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

4 Words are enough! On-The-Fly : Instrume nt Execut e Report All on MEMORY ! Offline : Instrume nt All on Disk ! *.em (metadat a) Execut e *.ec (covera ge runtime data) Report txt, html, or xml EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

5 When to use which mode 1.On-The-Fly a)When you want to experiment with it. b)When you use unit tests with EMMA. c)When you don't have large projects with bunch of people. 2.Offline a)When you have large projects with groups of people. b)When you want to combine the results from different teams into a report. EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

6 What depth that EMMA can detect These are the default setting especially for HTML reports. All of these depths are on the type of report on EMMA. It looks like this......  Class  Method  Line  Basic Block EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

7 EMMA can detect only partially when? As you can see, there is a yellow line on the screen. The yellow line means that EMMA executed. Why ? Because on the yellow line, there are two commands combined with'&'. Since the test covered partially on the line, it is executed partially. EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

8 How about unit test on EMMA ? Unit test classes can't generate necessary data for Off line mode. Nobody wants to instrument test classes but target classes. EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

9 Appendix A Here is why we can't use unit tests with offline mode. 1. Make a directory for the source class and compile the target class mkdir Testout javac -d out -g -cp “where junit.jar is”:. targetTest.java 2. Make a directory for the instrumented class and instrument the class mkdir Testinstr java emma instr -d Test -ip Testinstr 3. Get runtime coverage data for the test java -cp Testinstr:Testout:. -cp “where junit is”:. junit.textui.TestRunner targetTest (Then get an error on this line since there is no main there.) EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

10 Appendix B.1 Here is the description of step-by-step On-The-Fly mode on command line. 1. Make sure if you use Unix-like or Windows operating system. 2. Compile the target class with this command. Javac -g target.java (-g means get full debug information which is useful on EMMA.) 3. Now, you are ready to use On-The-Fly mode with this command. Java -cp /...../emma.jar( : || ;) emmarun -cp.. target (Tell java where emma.jar is with the separator ' :' on Unix-like operating system and ';' on Windows operating system. And type “emmarun” command followed by “-cp”,where the target is for the command 4. Then, you get a text report by default. If you want to get an html report, you can put “-r” for “emmarun” command like this. Java -cp /.../emma.jar(: || ;) emmarun -r html -sourcepath /.../target - cp. target EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

11 Appendix B.2 Here is the description of step-by-step Offline mode on command line. 1. The same as On-The-fly mode. 2. Make a directory for the target original class to clear which is original and instrumented with this command. mkdir out 3. Since this time we have a directory, so use it as a target directory and compile it with this command. javac -d out -g target.java 4. Make one more directory for the instrumented target code. mkdir outinstr 5. Now. It's ready to instrument it. java emma instr -d outinstr -ip out (“emma” and “instr” commands are for Offline mode. And “instr” is for instrumenting. “-d” means that you can specify the destination directory, and “-ip” means that where the code that you want to insrument. As a result, you get “coverage.em” by default. Continued to the next page ! Copyright © 2001-2005 Vlad Roubtsov All rights reserved. EMMA :

12 Appendix B.2 ( Continued) 6. It's time to execute it with this command. java -cp outinstr:out:. TargetMainClass (As a result, you get “coverage.ec” by default) 7. Finally we can get the report from those commands. java emma report -r txt,html - sourcepath /../target -in coverage.em - in coverage.ec Appendix C There is a property file of EMMA called “emma_default/properties” in the same directory as “emma.jar”. Using this file, you can change the default values anyway you want easily. Here is the description of it. 1. Save “emma_default.properties” as “yours.properties” since the file is read-only. 2. Then modify “yours.properties”. 3. Use this command to set the properties file for EMMA (For both modes) java -cp /.../emma.jar:. Emmarun -properties yours.properties -cp. target java emma run -cp /.../emma.jar :. -properties yours.properties -cp.target EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved.

13 There is one more thing.....

14


Download ppt "The quick fact of EMMA Seiya Kawashima Loyola University Chicago EMMA:Copyright © 2001-2005 Vlad Roubtsov All rights reserved."

Similar presentations


Ads by Google