Skip to content

Commit ef707b2

Browse files
committed
Readme
1 parent 1b47f68 commit ef707b2

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

README.md

+71-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
1-
# junit4-runner
2-
A junit version 4 tests runner which provides the expected json file.
1+
# java-maven3-junit4-runner
2+
3+
First, this runner compiles the project and generate all jars (project + dependencies).
4+
5+
At each play, it compiles user's answer using `javac` and run the specified testcase using junit4.
6+
7+
8+
# How to Use
9+
10+
To use this runner for your project, edit the `codingame.yml` file and add the following lines to your project:
11+
12+
runner:
13+
name: codingame/java-maven3-junit4-runner
14+
version: 1.1.0-java-8
15+
16+
## Example
17+
18+
**A Git repository example**
19+
20+
```
21+
.
22+
├── about.md
23+
├── codingame.yml
24+
├── markdowns
25+
│ └── <YOUR_LESSONS>.md
26+
└── projects
27+
└── example #Your project root
28+
├── src/main/java
29+
│ └── Example.java #The stub provided to the user
30+
└── src/test/java
31+
└── ExampleTest.java #Your JUnitTest Class
32+
```
33+
34+
**In your CS project:**
35+
36+
*Example.java*
37+
```java
38+
public class Example
39+
{
40+
/**
41+
* This method should return the sum between a and b
42+
**/
43+
public void sum(int a, int b) {
44+
return 1;
45+
}
46+
}
47+
```
48+
49+
*ExampleTestTest.java*
50+
```java
51+
import static org.junit.Assert.assertEquals;
52+
public class ExampleTest {
53+
private Example example;
54+
@Before
55+
public void init() {
56+
example = new Example();
57+
}
58+
59+
@Test
60+
public void testSum(){
61+
int a = 23487;
62+
int b = 240587;
63+
assertEquals(example.sum(a, b), a + b);
64+
}
65+
}
66+
```
67+
68+
**In your lesson:**
69+
```md
70+
@[Fix the following code so that the function DoSum returns a sum of integer]({"stubs": ["src/main/java/Example.java"],"command": "ExampleTest#testSum"})
71+
```

0 commit comments

Comments
 (0)