-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from szpak/issues/23-add-tests
Basic functional tests
- Loading branch information
Showing
7 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
jdk: | ||
- oraclejdk8 | ||
- oraclejdk7 | ||
- openjdk6 | ||
|
||
script: | ||
- ./gradlew clean build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/groovy/com/blogspot/toomuchcoding/testprofiler/BasicFuncSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.blogspot.toomuchcoding.testprofiler | ||
|
||
import nebula.test.IntegrationSpec | ||
import nebula.test.functional.ExecutionResult | ||
|
||
class BasicFuncSpec extends IntegrationSpec { | ||
|
||
void setup() { | ||
fork = true //to make stdout assertion work with Gradle 2.x - http://forums.gradle.org/gradle/topics/unable-to-catch-stdout-stderr-when-using-tooling-api-i-gradle-2-x#reply_15357743 | ||
} | ||
|
||
def "should do something"() { | ||
given: | ||
copyResources("sample_project", "") | ||
when: | ||
ExecutionResult result = runTasksSuccessfully("profileTests") | ||
then: | ||
result.standardOutput.contains("Your tests report is ready") | ||
and: | ||
fileExists("reports/test_profiling/summary.csv") //TODO: Put reports in project.buildDir | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apply plugin: 'groovy' | ||
apply plugin: 'com.blogspot.toomuchcoding.testprofiler' | ||
|
||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
compile "org.codehaus.groovy:groovy-all:2.3.9" | ||
compile "org.slf4j:slf4j-api:1.7.10" | ||
|
||
testRuntime 'org.slf4j:slf4j-log4j12:1.7.10' | ||
testCompile('org.spockframework:spock-core:0.7-groovy-2.0') { | ||
exclude module: 'groovy-all' | ||
} | ||
testRuntime 'cglib:cglib-nodep:2.2.2' | ||
testRuntime 'org.objenesis:objenesis:1.2' | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/resources/sample_project/src/main/java/foo/Calculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package foo; | ||
|
||
public class Calculator { | ||
int add(int first, int second) { | ||
return first + second; | ||
} | ||
|
||
int subtract(int first, int second) { | ||
return first - second; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/test/resources/sample_project/src/test/java/foo/CalculatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class CalculatorTest { | ||
|
||
@Test | ||
public void should_add_two_numbers() { | ||
assert 5 == new foo.Calculator().add(2, 3); | ||
} | ||
|
||
@Test | ||
public void should_subtract_a_number_from_another() { | ||
assert 2 == new foo.Calculator().subtract(3, 1); | ||
} | ||
} |