Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 4.5 KB

README.md

File metadata and controls

116 lines (90 loc) · 4.5 KB

CS6367-TestPrioritizationTool

Test Prioritization Tool The test prioritization tool enables optimization to select and prioritize tests for applications. The tool developed includes the total and additional test prioritization strategies.

Dependecies:

  • ASM 5.0.3 for the compilation of JavaAgent.
  • JUnit version 4.11

The example project on which the tool is tested is joda-time which can be found at https://github.com/JodaOrg/joda-time.git, acff94148b2110b95f7aeae6a1bdcafb756061f0

Steps to run the tool on joda-time.git is as follows

  1. Update the pom.xml of the example project with the pom.xml uploaded in the repository (https://github.com/emyemmanuel/CS6367-TestPrioritizationTool/blob/master/pom.xml) (see below for changes made in pom.xml)

  2. Add Listener.java (https://github.com/emyemmanuel/CS6367-TestPrioritizationTool/blob/master/Listener.java) to the example project so that the path of listener is ~/joda-time/src/test/java/org/joda/time/Listener.java

  3. Add the test-agent.jar (https://github.com/emyemmanuel/CS6367-TestPrioritizationTool/blob/master/test-agent.jar) to the example project so that the path is ~/joda-time/test-agent.jar (Steps to make jar is mentioned below)

  4. Once the Listener.java and test-agent.jar are added to joda-time use the command $ mvn test to run the tool. Make sure the Maven path and environment variables are aready set before running this command

  5. The output will first run the TestClasses without any prioritization, followed by total test prioritization and finally additional test prioritization of the TestClasses

  6. Example output files are added in the repository (Folder: SampleOutput) to show the execution order of the test classes in total and additional strategies.


Here are the changes that should be made to the tool while running on any other example project.

A. Updates made in pom.xml

The changes or additions made in the pom.xml are as follows: -- First Change org.apache.maven.plugins maven-surefire-plugin **/TestAllPackages.java -javaagent:test-agent.jar
listener org.joda.time.Listener

--Second Change org.apache.maven.plugins maven-assembly-plugin false src/main/assembly/dist.xml gnu make-assembly deploy single

--Third Change junit junit 4.11 test org.ow2.asm asm 5.0.3 test.pack test-agent 1.0 system ${basedir}/test-agent.jar

B. Changes in java file i) Update the class path in MyClassFileTransformer.java and TestJavaAgent.java from "org/joda/time" to the class path of the example project ii) Update the package details in Listener.java to the package details of he example project

C. Steps to make a jar file

i) Compile all the java files using command javac -cp ".;../lib/asm-all-5.0.3.jar" *.java ii) Consolidate all the class files while mantaining the folder structure in this case test->pack iii) Create manifest.txt containing Premain-Class: test.pack.Agent iv) Run the following command jar -cvfm test-agent.jar manifest.txt test

Steps to install maven on mac http://toolsqa.com/java/maven/how-to-install-maven-on-mac/