Individual Project: cleaveDeliverable 1 Project Goals In this project, you will be developing a simple Java application (cleave) using an agile, test-driven process involving multiple deliverables. While you will receive one grade for the entire project, each deliverable must be completed by its own due date, and all deliverables will contribute to the overall project … Continue reading “cleave Deliverable 1 | My Assignment Tutor”
Individual Project: cleaveDeliverable 1 Project Goals In this project, you will be developing a simple Java application (cleave) using an agile, test-driven process involving multiple deliverables. While you will receive one grade for the entire project, each deliverable must be completed by its own due date, and all deliverables will contribute to the overall project grade. Specification of the cleave Utility cleave is a simple command-line utility written in Java with the following specification: Summary cleave allows for removing sections from each line of a file Syntax cleave OPTIONS FILE Description Program cleave prints selected parts of the lines in FILE to stdout, where FILE is the name of the input file and OPTIONS are one or more of the following: -c LISTselect only the characters at the indices specified by LIST-f LISTselect only the fields at indices specified by LIST; also print any line that contains no delimiter character (default=TAB)-d DELIMuse character DELIM instead of TAB as field delimiter (used only with option -f) Use one and only one of -c or -f. Each LIST consists of either one range or many ranges separated by commas. Selected input is written in the same order that it is read, and is written exactly once. Each range is one of: NNth character or field, counted from 1.N-from Nth character or field to the end of the line.N-Mfrom Nth to Mth (included) character or field. Where N≤M.-Mfrom first to Mth (included) character or field. NOTES: If -d is specified, DELIM must consist of a single character. Selected fields are printed to stdout delimited by DELIM (default=TAB). Delimiter options (-d) are only valid for field selection (-f), and they can appear in either order. There will always be one output line for each input line. EXAMPLES OF USAGE (In the following, “↵” represents a newline character, and “→” represents a TAB character.) Example 1:cleave -c 2 FILE input FILE: 0123456789↵abcdefghi↵ stdout: 1↵ b↵ Example 2: (same as Example 1, but FILE ends without a newline)cleave -c 2 FILE input FILE: 0123456789↵abcdefghi stdout: 1↵ b↵ Example 3:cleave -c 15 FILE input FILE: 0123456789↵ stdout: ↵ Example 4:cleave -c 15 FILE input FILE: 0123456789↵abcdefghi stdout: ↵ ↵ Example 5:cleave -c 5,1 FILE input FILE: 0123456789↵ stdout: 04↵ Example 6:cleave -c -5 FILE input FILE: 0123456789↵ stdout: 01234↵ Example 7:cleave -c 4-7 FILE input FILE: 0123456789 stdout: 3456↵ Example 8:cleave -c 4-7,2 FILE input FILE: 0123456789 stdout: 13456↵ Example 9:cleave -f 2,4 FILE input FILE: 012→34→5678→9↵a→b→c→d→e→f→g→h→i stdout: 34→9↵b→d↵ Example 10:cleave -f 2-4 FILE input FILE: 012→34→5678→9↵a→b→c→d→e→f→g→h→i stdout: 34→5678→9↵b→c→d↵ Example 11:cleave -f 2-4 -d : FILE input FILE: 012:34:5678:9↵a:b:c:d:e:f:g:h:i stdout: 34:5678:9↵b:c:d↵ Example 12:cleave -d : -f 2-4 FILE input FILE: 012:34:5678:9↵a:b:c:d:e:f:g:h:i stdout: 34:5678:9↵b:c:d↵ Example 13:cleave -f 3- -d , FILE input FILE: 012,34,5678,9↵a,b,c,d,e,f,g,h,i↵ stdout: 5678,9↵c,d,e,f,g,h,i↵ Example 14:cleave -f 2-4,3 -d : FILE input FILE: 012:34:5678:9↵a:b:c:d:e:f:g:h:i stdout: 34:5678:9↵b:c:d↵ Example 15:cleave -f 10 FILE input FILE: 012→34→5678→9↵a→b→c→d→e→f→g→h→i stdout: ↵↵ Deliverables Summary This part of the document is provided to help you keep track of where you are in the individual project and will be updated in future deliverables. DELIVERABLE 1 (this deliverable, see below for details) Provided:cleave specificationSkeleton of the main class for cleaveExample tests and skeleton of the test class to submitJUnit librariesExpected:Part I (Category Partition)catpart.txt: TSL file you createdcatpart.txt.tsl: test specifications generated by the TSLgenerator tool when run on your TSL file.Part II (Junit Tests)Junit tests derived from your category partition test frames (MyMainTest.java) DELIVERABLE 2 provided: TBDexpected: TBD DELIVERABLE 3 provided: TBDexpected: TBD DELIVERABLE 4 provided: TBDexpected: TBD Deliverable 1: Instructions Part I Generate between 40 and 80 test-case specifications (i.e., generated test frames) for the cleave utility using the category-partition method presented in lesson P4L2. Make sure to watch the lesson and demo before getting started. When defining your test specifications, your goal is to suitably cover the domain of the application under test, including relevant erroneous inputs and input combinations. Just to give you an example, if you were testing a calculator, you may want to cover the case of a division by zero. Do not manually generate combinations of inputs as single choices. Instead, use multiple categories and choices with necessary constraints to cause the tool to generate meaningful combinations. Using the calculator example again, you should not offer choices “add”, “multiply”, and also “add and multiply” in a single category. In particular, make sure to use constraints (error and single), selector expression (if), and properties appropriately, rather than eliminating choices, to keep the number of test cases within the specified thresholds. Note that the domain is that of the java application under test, so you can assume that anything the shell would reject (e.g., unmatched double quotes) will not reach the application. In other words, you must test for invalid input arguments, but do not need to test for errors involving parsing the command-line arguments before they are sent to the java application. You can find more details about command-line argument parsing at this link. To illustrate, the sample tests in Part II will demonstrate how input arguments would be sent to your application. Please also keep in mind that you are only required to specify test inputs, but you do not have to specify the expected outcome for such inputs in Part I. It is therefore OK if you do not know how the system would behave for a specific input. Using once more the calculator example, you could test the case of a division by zero even if you did not know how exactly the calculator would behave for that input. Tools and Useful Files You will use the TSLgenerator tool to generate test frames starting from a TSL file, just like we did in the demo for lesson P4L2. Versions of the TSLgenerator for Linux, Mac OS X, and Windows, together with a user manual, are available at: TSLgenerator-manual.txtTSL generator for LinuxTSL generator for Mac OSTSL generator for Windows 8 and newerTSL generator for Windows XP and earlier We are also providing the TSL file for the example we used in the lesson, cp-example.txt, for your reference. Important: These are command-line tools, which means that you have to run them from the command line, as we do in the video demo, rather than by clicking on them.On Linux and Mac systems, you may need to change the permissions of the files to make them executable using the chmod utility. To run the tool on a Mac, for instance, you should do the following, from a terminal:chmod +x TSLgenerator-mac./TSLgenerator-mac You can run the TSLgenerator as follows: [–manpage] [-cs] infile [-o outfile]Where is the specific tool for your architecture, and the command-line flags have the following meaning:–manpage Prints the man page for the tool.-c Reports the number of test frames that would be generated, without actually producing them.-s Outputs the result to standard output.-o outfile Outputs the result to file outfile, unless the-s option is also used. If you encounter issues while using the tool, please post a public question on Piazza and consider running the tool on the VM provided for the class or on a different platform (if you have the option to do so). Gradescope will execute the tool on a Linux platform. Committing Part I Create a directory “IndividualProject” in the personal GitHub repo we assigned to you.Add to this new directory two text files:catpart.txt: TSL file you created.catpart.txt.tsl: test specifications generated by the TSLgenerator tool when it processes your TSL file.Commit and push your files to GitHub. (You can also do this only at the end of Part II, but it is always safer to have intermediate commits.) Part II In this second part of the deliverable, you will create actual test cases implementing the test specifications you created in Part I. (As discussed in the lesson on the category-partition method, each test frame is a test spec that can be instantiated as an individual concrete test case). To do so, you should perform the following steps: Download archive individualproject.tar.gzUnpack the archive in the directory “IndividualProject”, which you created in Part I of the deliverable. Hereafter, we will refer to this directory as .After unpacking, you should see the following structure:/cleave/src/edu/gatech/seclass/cleave/Main.javaThis is a skeleton of the Main class of the cleave utility, which we provide so that the test cases for cleave can be compiled. It contains an empty main method and a method usage, which prints on standard error a usage message and should be called when the program is invoked incorrectly. In case you wonder, this method is provided for consistency in test results./cleave/test/edu/gatech/seclass/cleave/MainTest.javaThis is a test class with a few test cases for the cleave utility that you can use as an example and that correspond to the examples of usage of cleave that we provided. In addition to providing this initial set of tests, class MainTest also provides some utility methods that you can leverage/adapt and that may help you implement your own test cases:File createTmpFile()Creates a File object for a new temporary file in a platform-independent way.File createInputFile*()Examples of how to create, leveraging method createTmpFile, input files with given contents as inputs for your test cases. /cleave/test/edu/gatech/seclass/cleave/MyMainTest.javaThis is an empty test class in which you will add your test cases, provided for your convenience./cleave/lib/junit-4.12.jar/cleave/lib/hamcrest-core-1.3.jarJUnit and Hamcrest libraries to be used for the assignment.Use the test frames from Part I to generate additional JUnit test cases for the cleave utility, one per frame, and put them in the test class MyMainTest (i.e., do not add your test cases to class MainTest). For ease of grading, please name your test cases cleaveTest1, cleaveTest2, and so on. Each test should contain a concise comment that indicates which test frame the test case implements. Use the following format for your comments, before each test:// Frame #: Your test frames should contain enough information to create relevant test cases. If you cannot implement your test frames as useful JUnit tests (e.g., because the test frames do not provide enough information), you should revisit Part I. Extending the calculator example, if your test frame specified a numerical input, and you realized that you should use both negative and positive numbers in your actual test case, you should revise your categories and choices so that this is reflected in your test framesIf you are uncertain what the result should be for a test, you may make a reasonable assumption on what to use for your test oracle. While you should include a test oracle, we will not grade the accuracy of the test oracle itself.Feel free to reuse and adapt, when creating your test cases, some of the code we provided in the MainTest class. Feel also free to implement your test cases differently. Basically, class MainTest is provided for your convenience and to help you get started. Whether you leverage class MainTest or not, your test cases should assume (just like the test cases in MainTest do) that the cleave utility will be executed from the command line, as follows:java -cp edu.gatech.seclass.cleave.Main Make sure not to make calls to System.exit() within your tests, as that creates problems for JUnit.For this deliverable, do not implement the cleave utility, but only the test cases for it. This means that most, if not all of your test cases will fail, which is fine. Committing Part II and Submitting the Deliverable As usual, commit and push your code to your individual, assigned private repository.Make sure that all Java files are committed and pushed, including the ones we provided.Make also sure to commit and push the provided libraries (lib directory). To do so, you may need to force add the jar files (i.e., “git add -f lib/*”), which are typically excluded by the “.gitignore” file.You can check that you committed and pushed all the files you needed by doing the following:Clone a fresh copy of your personal repo in another directoryGo to directory IndividualProject/cleave in this fresh cloneCompile your code. One way to do is to run, from a Unix-like shell:javac -cp lib/* -d classes src/edu/gatech/seclass/cleave/*.java test/edu/gatech/seclass/cleave/*.java(on some platforms, you may need to first create directory “classes”)Run your tests. Again, from a Unix-like shell, you can run:java -cp classes:lib/* org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest1Submit on Gradescope a file, called submission.txt that contains, in two separate lines (1) your GT username and (2) the commit ID for your submission. For example, the content of file submission.txt for George P. Burdell could look something like the following:submission.txt gpburdell181b2f59 As soon as you submit, Gradescope will verify your submission by making sure that your files are present and in the correct location, as well as a few additional minor checks. If you pass all these checks, you will see a placeholder grade of 10 and a positive message from Gradescope. Otherwise, you will see a grade of 0 and an error message with some diagnostic information. Please note that:a positive response from Gradescope only indicates that you passed the initial checks and is meant to prevent a number of trivial errors;if your submission does not pass the Gradescope checks, it will not be graded and will receive a 0, so please make sure to pay attention to the feedback you receive when you submit and keep in mind that you can resubmit as many times as you want before the deadline.2 Gradescope Queries If you need clarification or have questions regarding Gradescope output, please post privately on Piazza (we will make it public if appropriate) and make sure to add, when it applies: a link to the Gradescope results, andany information that may be relevant. The bottom line is that, to make the interaction efficient, you should make your posts as self-contained and easy-to-check as possible. The faster we can respond to the posts, the more students we can help. 1 If using a Windows-based system, you may need to run java -cp “classes;lib/*” org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest instead. 2 Although we tested the checker, it is possible that it might not handle correctly some corner cases. If you receive feedback that seems to be incorrect, please contact us on Piazza.