-
Notifications
You must be signed in to change notification settings - Fork 9
0.8.x Annotations for JUnit4 @ConfigureWith
You can control how test suite is generated using this annotation.
@ConfigureWith(
parameterSpace = Example.class
)
With this annotation you can define requirements for test suite to be generated and a parameter space, from which the test suite to be generated.
Feature | Specification |
---|---|
name | @ConfigureWith |
package | com.github.dakusui.jcunit8.runners.junit4.annotations |
target | A test class |
attributes |
value , parameterSpace
|
With this attribute you can specify characteristics a test suite to be generated.
You can give to this attribute a class that extends com.github.dakusui.jcunit8.pipeline.stages.ConfigFactory
, that requires you to let JCUnit know "strength", "seeds", and if "negative tests" is required or not.
By default, ConfigFactory.Default
is used. This makes JCUnit generate a test suite whose strength is 2, with no seed, and has no negative test.
@ConfigureWith(QuadraticEquationExampleWithSeeds.Config.class)
public class QuadraticEquationExampleWithSeeds extends QuadraticEquationExample {
public static class Config extends ConfigFactory.Base {
@Override
protected Requirement defineRequirement(Requirement.Builder defaultValues) {
return defaultValues.withNegativeTestGeneration(
true
).addSeed(
// Positive test
Tuple.builder().put("a", 1).put("b", -2).put("c", 1).build()
).addSeed(
// Negative test
Tuple.builder().put("a", 1).put("b", 1).put("c", 1).build()
).build();
}
}
}
With this attribute you can choose a class that defines a parameter space. A parameter space consists of a set of parameters and a set of constraints for them. From it JCUnit generates a test suite.
By default, the same class the this annotation is attached to is used.
Copyright 2013 Hiroshi Ukai.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.