GithubHelp home page GithubHelp logo

abdullahasendar / gasubtle Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 30.55 MB

Generate Higher Order Mutants using Genetic Algorithm

License: GNU General Public License v3.0

Java 98.05% CSS 1.95%
fault-based-testing mutation-testing genetic-algorithm java-8 javafx junit4 spring-boot

gasubtle's Introduction

GaSubtle - Generate Subtle Higher Order Mutants

GaSubtle is based on Java that uses genatic algorithm to generate subtle higher order mutants. For more details check our website.

Using the Tool

To run GaSubtle you can either use the GUI or the command line.

CMD

  • Open up the CMD.
  • Locate to the directory that contains GaSubtle-${version}.jar.
  • Execute java -cp GaSubtle-${version}.jar -Dloader.main=org.hu.hom.ui.cmd.CmdLauncher org.springframework.boot.loader.PropertiesLauncher <args>

replace with the VM arguments that you want to pass to GaSubtle

  • -b or --benchmark ➡️ specifies benchmark name, directory path should be [${home}/${benchmark}]
  • -h or --home ➡️ specifies the home default: [${current.path}/GaSubtle-home]
  • -s or --selection-strategy ➡️ sets selection strategy values: [ROULETTE_WHEEL, SUS, RANDOM, TOURNAMENT, TRUNCATION] default: uses all the selection stratiges

GUI

Just execute java -jar GaSubtle-${version}.jar

For the developers

If you want to edit the source code of GaSubtle just do the following:

Prerequisite

Java SE Development Kit 8

GaSubtle is based on Java 8, so in order to run, compile and build the tool Java SE Development Kit 8 is required.

Project Lombok

Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again. It is used to generate constructors, setter, getters, build methods, etc. using annotations only.

Download Project Lombok and run the downloaded file. It will ask you to locate you IDE installation directory. Press install and restart your IDE.

Setup

  • Download Lombok and open the downloaded file.
  • Locate your IDE and press install.
  • Restart your IDE.
  • Import the project to youe IDE as Maven project.

How To Use The API

	GeneticAlgorithm
	.builder()
	.mutationPercentage(10) \\ the mutation percentage
	.maxOrder(5) \\ max order of the HOMs not to be exceeded
	.runRepeat(1) \\ how many time to run the algorithm [for benchmarking]
        \\ stopping conditions, at least one should be provided
	.requiredSubtleHoms(1000) \\ stopping condition: minimum subtle HOMs needed
	.maxHoms(1500) \\ stopping condition: maximum HOMs to generate
	.maxGeneration(300) \\ stopping condition: maximum generation to reach
	.timeout(1000) \\ stopping condition: timeout in seconds
	.originalFile("/some/.java/file") \\ path to the original file
	.testCasesPath("/some/.class/test/path") \\ path to test cases
	.resultPath("/some/path") \\ path to store the results in
	.mutantsPath("/some/path") \\ path to store the mutants in
	.evaluation(new EvaluationDefaultImpl())
	.evaluation(new EvaluationDefaultImpl())
	.crossover(new CrossoverDefaultImpl())
	.mutation(new MutationDefaultImpl())
	.selection(selection)
	.messageListener(new MessageListener() {
		
		@Override
		public void info(String value) {
                        System.out.println("Info message from the GA is: "+ value);
		}
		
		@Override
		public void error(String value) {
		    System.out.println("There was an error:" + value);
		}
		
		@Override
		public void debug(String value) {
		    System.out.println("Debugging: "+ value);
		}
	})
	.geneticAlgorithmListener((int generation, int populationSize, int liveMutants, int subtleMutants)
			-> LOG.info(String.format("Generation [%s] Population [%s] Live Mutants [%s] Subtle Mutants [%s]",
					generation, populationSize, liveMutants, subtleMutants)))
			.build()
	.run();

Build

You can build the project by executing mvn clean install

License

GNU General Public License v3.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.