diff --git a/Writing-a-unit-test.md b/Writing-a-unit-test.md new file mode 100644 index 0000000..651914a --- /dev/null +++ b/Writing-a-unit-test.md @@ -0,0 +1,41 @@ +### Step 1: Create the unit test file + +Create the unit test file in src/test/java/com/rarchives/ripme/tst/ripper/rippers + +File should follow the naming scheme RipperTest.java + +### Step 2: Extend the RippersTest class + +public class YoursiteRipper extends RippersTest { + +### Step 3: Write the main unit test + +```java + public void testRip() throws IOException { + Ripper ripper = new DribbbleRipper(new URL()); + testRipper(ripper); + } +``` + +You should do this for ever album type that the ripper supports + +### Step 4: Write tests for getGID and getAlbumTitle // Optional! + +Althought not required you should write a unit test for getGID and getAlbumbTitle (If your ripper supports getAlbumbTitle) + +An example of both of these can be found in the zizki ripper + +```java + + public void testGetGID() throws IOException { + URL url = new URL("http://zizki.com/dee-chorde/we-got-spirit"); + ZizkiRipper ripper = new ZizkiRipper(url); + assertEquals("dee-chorde", ripper.getGID(url)); + } + + public void testAlbumTitle() throws IOException { + URL url = new URL("http://zizki.com/dee-chorde/we-got-spirit"); + ZizkiRipper ripper = new ZizkiRipper(url); + assertEquals("zizki_Dee Chorde_We Got Spirit", ripper.getAlbumTitle(url)); + } +``` \ No newline at end of file