mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-21 13:11:27 +02:00
Added documentation for writing a unit test
41
Writing-a-unit-test.md
Normal file
41
Writing-a-unit-test.md
Normal file
@@ -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 <Site>RipperTest.java
|
||||
|
||||
### Step 2: Extend the RippersTest class
|
||||
|
||||
public class YoursiteRipper extends RippersTest {
|
||||
|
||||
### Step 3: Write the main unit test
|
||||
|
||||
```java
|
||||
public void test<Site>Rip() throws IOException {
|
||||
<Site>Ripper ripper = new DribbbleRipper(new URL(<URL the ripper supports>));
|
||||
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));
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user