Giter VIP home page Giter VIP logo

a3test's Introduction

A3Test - Assertion Augmented Automated Test Case Generation

Developing a BART based model for the unit test cases generation

How to replicate

About the Environment Setup

First of all, clone this repository to your local machine and access the main dir via the following command:

https://github.com/awsm-research/A3Test

cd A3Test

Then, install the python dependencies via the following command:

pip install transformers

pip install torch

pip install numpy

pip install tqdm

pip install pandas

pip install tokenizers

To download the training and evaluation in our experiments, run the following commands:

A3Test

To Train the Assert Augmented model

We use methods2test data to fine-tune the model.

python python training.py -i train.csv -c codePreTrain.csv -po preModel.pth -o model.pth -s src_fm_fc_ms_ff -t test.csv -v eval.csv -pe 7 -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

``python
parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-c", "--codepretrainInput", dest="codepretrainInput", help="Code Pre Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-po", "--premodelOutputDir", dest="PreOutPath", help="Pre Training Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-ce", "--preCodeEpochs", dest="preCodeEpochs", help="Epochs for the model code pre train") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

``

To Test the Assert Augmented model

python testScript.py -i model.pth -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script")
parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy")
parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs")
parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

Post Processing script

python python postProcessingScript.py -i Gson_Plbart.txt -o finalOut55.txt -e errors55.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--input", dest="input", help="Input txt file to begin the post processing with") parser.add_argument("-o", "--output", dest="output", help="Output file txt file aftet the post processing") parser.add_argument("-e", "--errorPath", dest="errorLogs", help="Errors Logs ")

AthenaReplication

To Train the BART model

python python training.py -i train.csv -p enPreTrain.csv -c codePreTrain.csv -eo enModel.pth -po preModel.pth -o model.pth -s src_fm_fc_ms_ff -t test.csv -v eval.csv -e 20 -pe 7 -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

To Test the BART model

python testScript.py -i model.pth -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script")
parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy")
parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs")
parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

PLBART

To Train the plBart model

python python plBartTraining.py -i train.csv -o FinalplBartModelDir -s src_fm_fc_ms_ff -t test.csv -v eval.csv -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

To Test the plBart model

python python plBartTest.py -i FinalPlBartModelDir -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

CodeT5

To Train the codeT5 model

python python codeT5Training.py -i train.csv -o FinalplBartModelDir -s src_fm_fc_ms_ff -t test.csv -v eval.csv -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

To Test the codeT5 model

python python codeT5Test.py -i FinalModelDir -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

CodeBERT

To Train the codeBERT model

python python codeBERTTraining.py -i train.csv -o FinalplBartModelDir -s src_fm_fc_ms_ff -t test.csv -v eval.csv -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

To Test the codeBERT model

python python codeBERT.py -i FinalModelDir -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

CodeGPT

To Train the codeGPT model

python python codeGPTTraining.py -i train.csv -o FinalplBartModelDir -s src_fm_fc_ms_ff -t test.csv -v eval.csv -ce 8 -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--trainInput", dest="trainInput", help="Training file for the model") parser.add_argument("-o", "--modelOutputDir", dest="outPath", help="Output Directory Path for the model") parser.add_argument("-s", "--sourceLabel", dest="sourceLabel", help="Source Label for the train.csv file") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-v", "--valInput", dest="valInput", help="Val Input file for the model accuracy") parser.add_argument("-e", "--epochs", dest="epochs", help="Epochs for the model") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

To Test the codeGPT model

python python codeGPT.py -i FinalModelDir -t test.csv -a test.txt -q Defect4jTests.txt

See Arguments ๐Ÿ”Ž

python parser.add_argument("-i", "--modelInput", dest="modelInput", help="Saved Model file for the testing the script") parser.add_argument("-t", "--testInput", dest="testInput", help="Test Input file for the model accuracy") parser.add_argument("-a","--externalTestFile", dest="externalTestFile", help="External Test Files for generating the UTs") parser.add_argument("-q","--externalTestFileOutput", dest="externalTestFileOutput", help="External Test Files output for generating the UTs")

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.