Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spanScaleFactor support #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ test {
}
```

Span Scale Factor
----------------
```groovy
test {
spanScaleFactor 10.0
}
```

Other Frameworks
----------------
The default behaviour is to replace all `Test` tasks with a scalatest implementation.
Expand Down Expand Up @@ -157,4 +165,4 @@ task myTest(dependsOn: testClasses, type: Test, group: 'verification') {
include 'com.example.tags.MyTag'
}
}
```
```
6 changes: 6 additions & 0 deletions src/main/groovy/com/github/maiflai/ScalaTestAction.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ScalaTestAction implements Action<Test> {
static String SUITES = '_suites'
static String CONFIG = '_config'
static String REPORTERS = '_reporters'
static String SPAN_SCALE_FACTOR = '_spanScaleFactor'

@Override
void execute(Test t) {
Expand Down Expand Up @@ -196,6 +197,11 @@ class ScalaTestAction implements Action<Test> {
args.add('-C')
args.add(it)
}
def spanScaleFactor = t.extensions.findByName(SPAN_SCALE_FACTOR) as List<Float>
spanScaleFactor?.toSet()?.each {
args.add('-F')
args.add(it.toString())
}
assert args.every { it.length() > 0 }
return args
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/groovy/com/github/maiflai/ScalaTestPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class ScalaTestPlugin implements Plugin<Project> {
test.extensions.add(ScalaTestAction.REPORTERS, reporters)
test.extensions.add("reporter", { String name -> reporters.add(name) })
test.extensions.add("reporters", { String... name -> reporters.addAll(name) })
List<Float> spanScaleFactor = []
test.extensions.add(ScalaTestAction.SPAN_SCALE_FACTOR, spanScaleFactor)
test.extensions.add("spanScaleFactor", { Float factor -> spanScaleFactor.add(factor) })

test.testLogging.events = TestLogEvent.values() as Set
}

Expand Down
10 changes: 9 additions & 1 deletion src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,12 @@ class ScalaTestActionTest {
def args = commandLine(test)
assertThat(args, hasOption('-R', '/serviceuitest-1.1beta4.jar /myjini /target/class\\ files'))
}
}

@Test
void spanScaleFactor() throws Exception {
Task test = testTask()
test.spanScaleFactor 10.5
def args = commandLine(test)
assertThat(args, hasOption('-F', '10.5'))
}
}