-
Notifications
You must be signed in to change notification settings - Fork 43
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
Update/rewrite reddeer test suite run with requirements loaded from config file #1586
Conversation
not just JRE/Server, those were just examples. This have to work with any other. |
Expected output:
Please, edit this document if necessary. |
looks good! Another possibility could be to specifically define all versions required for example @jre(version="1,6","1.8") (1.7 is missing). |
Two ideas:
|
Guys... keep in mind that we are trying to design something more general. We used server/jre as an example. Another example could be databases and connections. One could have configuration file with X URL's to different databases (and for example even with different credentials) and we should be able to provide "something" in this core implementation which would enable user to create it's own restrictions of which configurations should be running and which not. |
In other words: I think that "restriction management" should be done on requiement level (every requirement should be able to decide by itself). But the core implementation (this issue) must provide everything the requiement could need to make that decision. |
If restriction management will be done on requirement level - requirement should decide on itself whether to run or not, we would already get error/failures in execution, because requirement would fail on fulfill/canFulfill. We should address requirements to run as well, e.g. in requirement builder. But to the point, @SomeReq() should run all defined reqs in xml. @SomeReq() @SomeReq2() should run defined reqs combination (MxN). Restrictions would limit amount of requirements to run tests with, combinations with other requirements should be preserved. |
DO NOT MERGE!
|
4183081
to
3bcdec9
Compare
We want to support only one config file which means that SuiteConfiguration.getListOfConfigurationsPerFile() should be renamed and should return just one file |
check support for nested suites |
require requirements .xml file not just folder |
Could you please create more lightweight tests? Using server requirement and JRE requirement seems too much for me. Create 2 simple requirements (or if there are existing for testing, use those) and assert numbers of executed classes/tests for various combination are equal to expected numbers.. |
2a6b1c0
to
edc381c
Compare
testPR |
9ecdfa1
to
0da34d8
Compare
a55e021
to
2d2dead
Compare
@rawagner @mlabuda @apodhrad @rhopp @jkopriva @jrichter1 @theJNOVAK |
* @author odockal | ||
* | ||
*/ | ||
public class RequirementConfigurationObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to RequirementConfiguration
@@ -31,7 +32,7 @@ | |||
* @author Lucia Jelinkova | |||
* @see TestRunConfiguration | |||
*/ | |||
public class RequirementsConfigurationImpl implements RequirementsConfiguration{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to RequirementsConfiguratorImpl and interface to RequirementsConfigurator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this classes intact, we agreed on that, right?
* Gets all test classes as an array. | ||
* @return all test classes as an array | ||
*/ | ||
public Class<?>[] getClassesAsArray() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one liner testClasses.toArray(new Class<?>[testClasses.size()]);
Requirement<Annotation> requirement = (Requirement<Annotation>) createInstance(this.requirementConfigurationClass.getEnclosingClass()); | ||
|
||
if (!(requirement instanceof CustomConfiguration || requirement instanceof PropertyConfiguration)){ | ||
throw new IllegalArgumentException("The requirement does not implement " + CustomConfiguration.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt you mention PropertyConfiguration.class too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned.
if (configs.isEmpty()){ | ||
throw new RedDeerConfigurationException("No configuration found in XML configuration file for requirement class " + customConfiguration.getClass()); | ||
// iterate over all configurations and tries to cast the configuration object to expected configuration class | ||
// Class cast exception is caught and iteration continues, if none configuration fits, new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"new" what ? Something is missing in the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment deleted, Method's javadoc description updated.
// Class cast exception is caught and iteration continues, if none configuration fits, new | ||
boolean configurationSet = false; | ||
for (Object configuration : this.configurations) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change try-catch to isAssignableFrom
|
||
boolean configurationSet = false; | ||
for (Object configuration : this.configurations) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change try-catch to isAssignableFrom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One catch removed - added if with PropertyBasedConfiguration.class.isAssignableFrom(configuration.getClass()) condition.
@@ -51,6 +51,7 @@ public int compare(Class<?> clazz0, Class<?> clazz1) { | |||
* as test class without a run | |||
*/ | |||
public void addTest(Class<?> testClass) { | |||
System.out.println("Adding class without a run: " + testClass.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println deleted
@@ -62,6 +63,7 @@ public void addTest(Class<?> testClass) { | |||
* as test class with a run | |||
*/ | |||
public void addExecutedTest(Class<?> testClass) { | |||
System.out.println("Adding class with a run: " + testClass.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for output.
@@ -5,7 +5,7 @@ | |||
|
|||
<!-- Import basic RedDeer requirements --> | |||
<xs:import namespace="http://www.jboss.org/NS/Req" | |||
schemaLocation="http://www.jboss.org/schema/reddeer/v1/RedDeerSchema.xsd" /> | |||
schemaLocation="RedDeerSchema2.xsd" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undone.
@@ -85,6 +86,12 @@ public boolean canFulfill() { | |||
} | |||
} | |||
|
|||
@Override | |||
public boolean isDeclarationAcceptable() { | |||
// TODO Delete random generating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted whole method. It is declared with default value in the interface.
int i = 0; | ||
while (realSequenceIterator.hasNext() && expectedSequenceIterator.hasNext()){ | ||
Object real = realSequenceIterator.next(); | ||
Object expected = expectedSequenceIterator.next(); | ||
System.out.println(real.toString() + " vs. " + expected.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for output...
2d2dead
to
ec68d6c
Compare
ec68d6c
to
86db3e5
Compare
I need to update some unit tests for CustomConfigurator. |
f341215
to
73220c5
Compare
testPR |
- Test run configuration requirements operates with multiple configurations - Single configuration xml file - Added processing of requirements without configuration - Only one configuration xml file is being work with - Support for nested suites - Support for property based requirements Tests: - Refactored tests: - PropertyBasedConfigurator - CustomConfigurator - TestRunConfigurationImpl - SuiteConfiguration - ParametriziedRequirementTest - RequirementsSequenceTest - InjectRequirementsBeforeRunIfTest - RedDeerSuiteTest - ComplexConfigurationTest - Unit tests for RequirementConfiguration - Unit tests for TestClassRequirementMap - Refactored tests failing due to changes
73220c5
to
e67f9ee
Compare
@rawagner commits squashed. |
Aim is to be able to run multiple test runs on single test suite based on annotated requirements loaded from single config file. This is especially aiming to use of JRE and Server (only to those?) requirements together defined with one single config xml file. Such loaded requirement configuration would create matrix of combination of possible configurations that would test suite be run with.