De Software testing
Revisão de 23h17min de 29 de março de 2011 por Magsilva (discussão | contribs)
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para: navegação, pesquisa



  • JaBUTi is designed to support test set adequacy evaluation and to provide guidance in test case selection. <bibref>vincenzi-etal:2003, 18</bibref>
  • JaBUTi works with the bytecode, thus not requiring the source code of the application to perform its activities. <bibref>vincenzi-etal:2003</bibref>


  • Invoke JaBUTi's graphical interface.
  1. Supposing that JaBUTi is installed on ~/Tools/jabuti and the user's current directory is ~/Tools/jabuti, the following command causes the invocation of its graphical interface: java -cp ".;lib/BCEL.jar:lib/jviewsall.jar:lib/crimson.jar;lib/junit.jar" br.jabuti.gui.JabutiGUI

  1. Select a base Java class file from File/Open Class menu. A dialog window, as illustrated in Arquivo:JaBUTi Open Class dialog.png, appears.
  2. From this dialog window, select the directory where the base Java class file is located and then select the base Java class file itself, as ilustrated in Arquivo:JaBUTi Open Class dialog - base Java class selected.png.
  3. Once the base Java class file is selected, the tool automatically identifies the package that it belongs (if any) and fills out the Package field with the package’s name. The Classpath should contains only the path necessary to run the selected base class, as illustrated in Arquivo:JaBUTi Open Class dialog - base Java class information specified.png.
  4. Click the Open button. The Project Manager dialog is shown, as illustrated in Arquivo:JaBUTi Project Manager dialog.png.
  5. From the Project Manager dialog, select the Java class files that will be tested. At least one class file must be selected.
  6. Give a name to the project being created by clicking on the Select button. By clicking on the Ok button, JaBUTi creates a new project, constructs the DUG for each method of each class under testing, derives the complete set of testing requirements for each criterion, calculates the weight of each testing requirement, and presents the bytecode of a given class under testing.

  • Import JUnit test set (<bibref>vincenzi-etal:2003, 22</bibref>) script
  1. Once compiled, a JUnit test case can be imported by JaBUTi from the Test Case ! Import from JUnit menu option. A dialog, as illustrated in Arquivo:JaBUTi Import from JUnit dialog.png, will be shown. The fields to be entered are:
    • Path to application: automatically filled by JaBUTi.
    • Path to JUnit test suite source/binary code: if you followed the manual it should be your current path; otherwise it’s the path to your application’s source and binary codes.
    • Test suite full qualified name: the full name of the JUnit test which will be used.
    • JaBUTi’s library: the .jar used to run JaBUTi.
    • Other application specific libraries: other libraries your application may need.
    • javac: full path to your java compiler.
    • Trace file name: automatically filled by JaBUTi.

  • Instrument a class using the command line tool:
  1. Set the environment variable JABUTI_HOME:
    $ export JABUTI_HOME=/home/auri/workspace/Jabuti
  2. Run the prober:
    $ java -Xmx512M -cp $JABUTI_HOME/bin:$JABUTI_HOME/lib/bcel-5.2.jar:../classes/:. br.jabuti.probe.ProberInstrum -jar your_package.jar -o your_package-instr.jar

  • Test the instrumented classes using the command line tool:
  1. Set up the environment variable BATCH_MODE.
    $ export BATCH_MODE=""
  2. Organize the instrument classes.
    1. The package generated by JaBUTi contains only the class files. If the original package (passed as parameter in step 1.1) contains other types of files, these files have to be manually added in the package generated by JaBUTi;
    2. If the tests search for the class files in a specific folder, the package generated by JaBUTi have to be uncompressed in this folder, replacing the non instrumented files;
    3. If the tests of application use the original jar package, switch the jar package name generated by JaBUTi by this name;
    4. Sometimes is possible to use a property of ant to configure to test the classes/package instrumented without any modification.

  • Collect test data:
  1. List every class that have been tested and save the filenames to a file (file which will be used by the script Arquivo:Test-session.sh). You my use the script Arquivo:List-classes.sh, as follows:
    $ ./list-classes.sh <the .class files directory> classes.txt
  2. Generate the report for the listed files. Use the Arquivo:Test-session.sh script, as follows:

  • Collect measures for the application under testing:
  1. Select Visualizaton ! Complexity metrics in the main menu.
  2. The metrics for all classes under testing will be shown. It is possible to scroll horizontally the window to see all the metrics.