https://github.com/assert-kth/pankti
Generating tests from production workloads http://arxiv.org/pdf/2012.01198
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.2%) to scientific vocabulary
Keywords
Repository
Generating tests from production workloads http://arxiv.org/pdf/2012.01198
Basic Info
Statistics
- Stars: 16
- Watchers: 12
- Forks: 6
- Open Issues: 7
- Releases: 0
Topics
Metadata Files
README.md
About
This repository contains code for the following research tools: - pankti: Tests from production data (documentation) - rick: Tests + mocks from production data (documentation)
🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊
Head to the Wiki for detailed tutorials!
🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌🌌
pankti
Pankti transforms production workloads into test cases. The test generation pipeline consists of four phases: 1. Extract 2. Instrument 3. Execute 4. Generate
If you use this code for academic research, please cite: "Production Monitoring to Improve Test Suites", In IEEE Transactions on Reliability, 2021.
bibtex
@article{arXiv-2012.01198,
title = {Production Monitoring to Improve Test Suites},
journal = {IEEE Transactions on Reliability},
year = {2021},
doi = {10.1109/TR.2021.3101318},
author = {Deepika Tiwari and Long Zhang and Martin Monperrus and Benoit Baudry},
}
Extract (pankti-extract)
pankti-extract leverages Spoon to statically analyze Java applications in order to find relevant methods for test generation. The output is a list of methods that meet the following criteria: - they are public - they are not empty - they are not abstract, and do not belong to an interface or annotation type - they are not deprecated and do not belong to a deprecated class - they are not static
To run pankti-extract,
- Clone this repository
cd /path/to/pankti/pankti-extract/mvn clean installjava -jar target/pankti-extract-<version>-jar-with-dependencies.jar /path/to/maven/project- Available flags:
-h(--help) for usage,-v(--void) to include methods that return void
- Available flags:
- The output is a CSV file at
/path/to/pankti/pankti-extract/called extracted-methods-<project-name>.csv. - Generate Descartes report(s) to find pseudo-tested methods in the project (we use the
method.jsonfiles) python find-pseudo-tested.py /path/to/method/list/from/step5.csv /space/separated/paths/to/descartes/method.jsonoutputs a CSV with the list of methods that are candidates for instrumentation. ___
Instrument (pankti-instrument)
pankti-instrument is a Glowroot (download) plugin that serializes objects for instrumented methods that are invoked. pankti-instrument uses the Plugin API of Glowroot to instrument the methods extracted from pankti-extract.
To run pankti-instrument,
1. cd /path/to/pankti/pankti-instrument/
2. python instrument.py <path/to/instrumentation/candidates/from/previous/phase>.csv
3. New aspect classes for these methods are generated in se.kth.castor.pankti.instrument.plugins. These aspect classes are also included in ./src/main/resources/META-INF/glowroot.plugin.json
4. mvn clean install
5. Drop <pankti-instrument-<version>-jar-with-dependencies.jar to /path/to/glowroot/plugins/
Execute
Execute the application with a workload, using Glowroot as a javaagent.\
java -javaagent:/path/to/glowroot/glowroot.jar -jar <project-jar>.jar <cli-args>\
The serialized objects for invoked methods are saved at /tmp/pankti-object-data/.
Additionally, a list of invoked methods is generated at /tmp/pankti-object-data/invoked-methods.csv.
Generate (pankti-generate)
pankti-generate creates test classes for an application from the collected object profiles.\ It takes as input the path to the Java + Maven project, a CSV file with a list of invoked methods, and the path to the directory containing objects serialized as XML.
To run pankti-generate,
1. cd /path/to/pankti/pankti-generate/
2. mvn clean install
3. java -jar target/pankti-generate-<version>-jar-with-dependencies.jar /path/to/project /path/to/invoked/methods.csv /path/to/directory/with/objects/
The output is in a directory at /path/to/pankti/pankti-generate/output/generated/<project-name>/. Generated test classes are placed in appropriate package directories. The naming convention followed is Test<ClassName>PanktiGen.java. Resource files for long XML strings are created at /path/to/pankti/pankti-generate/output/generated/object-data.
:telescope: Results and data: pankti-experiments
rick
Rick transforms production workloads into tests that use mocks. In addition to some functionalities and implementation shared with pankti, it supports the instrumentation of methods that can be mocked within a test. It also handles the generation of these mocks with data collected from production.
Building
- Clone this repository
cd pankti/
3. mvn clean install
Running
To extract methods under test (MUTs) and mockable methods:
1. cd pankti/pankti-extract/
2. java -jar target/pankti-extract-<version>-jar-with-dependencies.jar /path/to/maven/project
3. The output is ./extracted-methods-<project>.csv
To instrument MUTs and mockable methods:
1. cd pankti/pankti-instrument/
2. Instrument all MUTs found across all classes:
- python3 instrument-mock.py ../pankti-extract/extracted-methods-<project>.csv
3. Alternatively, instrument MUTs found in a specific class under test (CUT):
- python3 instrument-mock.py ../pankti-extract/extracted-methods-<project>.csv fully.qualified.name.of.CUT
4. This generates aspect classes for MUTs and corresponding mockable methods in se.kth.castor.pankti.instrument.plugins
5. It also updates ./src/main/resources/META-INF/glowroot.plugin.json
6. mvn clean install
7. Drop <pankti-instrument-<version>-jar-with-dependencies.jar to /path/to/glowroot/plugins/
To execute the target project:
1. java -javaagent:/path/to/glowroot/glowroot.jar <project-jar-and-options>
- The collected objects are stored at /tmp/pankti-object-data/
- A CSV with the list of invoked MUTs is at /tmp/pankti-object-data/invoked-methods.csv
To generate tests:
1. cd pankti/rick/
2. java -jar target/rick-<version>-jar-with-depdendencies.jar /path/to/maven/project/ /tmp/pankti-object-data/invoked-methods.csv /tmp/pankti-object-data/
- The generated tests (Test*PanktiGen.java) are at ./output/generated/<project>
Owner
- Name: ASSERT
- Login: ASSERT-KTH
- Kind: organization
- Location: Sweden
- Website: https://github.com/ASSERT-KTH/
- Repositories: 87
- Profile: https://github.com/ASSERT-KTH
assertEquals("Research group at KTH Royal Institute of Technology, Stockholm, Sweden", description);
GitHub Events
Total
- Watch event: 2
- Push event: 2
Last Year
- Watch event: 2
- Push event: 2
Dependencies
- com.sun.activation:javax.activation 1.2.0
- fr.inria.gforge.spoon:spoon-core 8.0.0
- fr.inria.gforge.spoon:spoon-decompiler 0.1.0
- info.picocli:picocli 4.2.0
- javax.xml.bind:jaxb-api 2.3.1
- org.apache.commons:commons-csv 1.8
- org.glassfish.jaxb:jaxb-runtime 2.3.1
- org.slf4j:slf4j-api 1.7.30
- org.slf4j:slf4j-log4j12 1.7.30
- org.jetbrains.kotlin:kotlin-runtime 1.2.41 compile
- org.jetbrains.kotlin:kotlin-stdlib 1.2.41 compile
- com.googlecode.json-simple:json-simple 1.1.1
- com.typesafe:config 1.3.4
- dom4j:dom4j 1.6.1
- org.eclipse.jetty.websocket:websocket-server 9.4.15.v20190215
- org.eclipse.jetty:jetty-rewrite 9.4.15.v20190215
- org.eclipse.jetty:jetty-servlets 9.4.15.v20190215
- org.glassfish.jersey.containers:jersey-container-jetty-http 2.29
- org.glassfish.jersey.containers:jersey-container-servlet 2.29
- org.glassfish.jersey.inject:jersey-hk2 2.29
- org.glassfish.jersey.media:jersey-media-json-jackson 2.29
- org.glassfish.jersey.test-framework:jersey-test-framework-core 2.29
- org.igniterealtime.smack:smack-extensions 4.2.4-47d17fc
- org.igniterealtime.whack:core 2.0.1
- org.igniterealtime:tinder 1.3.0
- org.javassist:javassist 3.22.0-CR2
- org.jetbrains:annotations 15.0
- org.jitsi:ice4j 3.0-1-ge854e4e
- org.jitsi:jicoco 1.1-5-g6ee23f2
- org.jitsi:jitsi-android-osgi 1.0-20190327.160432-3
- org.jitsi:jitsi-media-transform 1.0-58-g13fe894
- org.jitsi:jitsi-stats 1.0-3-gd5cc199
- org.jitsi:jitsi-utils 1.0-20-g37eacac
- org.jitsi:jitsi-xmpp-extensions 1.0-2-g6624b3a
- org.jitsi:libjitsi 1.0-3-gd07c465
- org.jitsi:rtp 1.0-17-gfec6b74
- org.jitsi:sctp 1.0-20190319.172750-1
- org.osgi:org.osgi.core 4.3.1
- org.reflections:reflections 0.9.11
- rusv:agafua-syslog 0.4
- xpp3:xpp3 1.1.4c
- junit:junit 4.11 test
- org.easymock:easymock 3.4 test
- org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2 2.29 test
- org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-jetty 2.29 test
- org.powermock:powermock-api-easymock 1.7.3 test
- org.powermock:powermock-core 1.7.3 test
- org.powermock:powermock-module-junit4 1.7.3 test
- com.thoughtworks.xstream:xstream 1.4.12
- fr.inria.gforge.spoon:spoon-core 8.0.0
- info.picocli:picocli 4.2.0
- org.apache.commons:commons-collections4 4.4
- org.apache.commons:commons-csv 1.8
- org.apache.commons:commons-text 1.8
- org.codehaus.jettison:jettison 1.4.1
- org.junit.jupiter:junit-jupiter 5.8.2
- org.junit.jupiter:junit-jupiter-api 5.8.2
- org.junit.jupiter:junit-jupiter-engine 5.8.2
- org.junit.jupiter:junit-jupiter-params 5.8.2
- org.junit.platform:junit-platform-runner 1.8.2
- org.mockito:mockito-core 4.0.0
- org.mockito:mockito-junit-jupiter 2.23.0
- org.glowroot:glowroot-agent-plugin-api 0.13.6 provided
- com.thoughtworks.xstream:xstream 1.4.12
- org.apache.commons:commons-lang3 3.5
- org.openclover:clover-maven-plugin 4.4.1
- org.junit.jupiter:junit-jupiter-engine 5.5.2 test
- org.junit.jupiter:junit-jupiter-params 5.6.2 test
- org.junit.platform:junit-platform-runner 1.5.2 test
- se.kth.castor:pankti-generate 1.0-SNAPSHOT