-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/include coverage html assets #42
Conversation
this is to simplify testing with environment setting preconditions
Integration-Tests are run in verify-scope, not in test. All tests which require database being setup are now declared as Integration-tests
Aw, just saw the old test don't run. Will have to rewrite them. You can still review the other changes :) |
Closes #39 |
This PR does not yet solve the original problem. Still need to rewrite cli so it does in fact copy the assets to the output location and set the path for the assets. |
I would prefer to have the api download the resources as a dependency at build time from: https://github.com/utPLSQL/utPLSQL-coverage-html |
import org.utplsql.api.rules.DatabaseRule; | ||
import org.junit.Assert; | ||
import org.junit.Rule; |
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.
Seems like dependency from jUnit; there are no rules in Jupiter
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.
It's actually a dependency from junit-jupiter-migrationsupport which is the recommended approach by JUnit 5 as long as you can't completely get rid of Rules - which I can't at that point. I see this as topic for a future refactoring.
} | ||
|
||
@Test | ||
public void reporterFactory() { | ||
Assert.assertTrue(ReporterFactory.createReporter(CustomTypes.UT_COVERAGE_HTML_REPORTER) | ||
assertTrue(ReporterFactory.createReporter(CustomTypes.UT_COVERAGE_HTML_REPORTER) |
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.
This may be implemented using harmcrest marchers, which provide a better feedback.
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 thought about including hamcrest but didn't see the big benefit. Hamcrest is another library, another dependency which is increasing complexity and for the moment I didn't see a reason to introduce it.
@@ -1,8 +1,7 @@ | |||
package org.utplsql.api; | |||
|
|||
import org.junit.Assert; | |||
import org.junit.Rule; |
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.
Another rule
@@ -25,7 +26,7 @@ public void runWithDefaultParameters() { | |||
Connection conn = db.newConnection(); | |||
new TestRunner().run(conn); | |||
} catch (SQLException e) { | |||
Assert.fail(e.getMessage()); | |||
fail(e); |
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.
There is no need to re-fail just declare throws SQLException
and remove 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.
Thanks, will change that
@@ -79,12 +80,12 @@ public void failOnErrors() { | |||
new TestRunner() | |||
.failOnErrors(true) | |||
.run(conn); | |||
Assert.fail(); | |||
fail("Test expected to throw exception"); |
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.
jUnit5 introduced assertThrows
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.
Will have a look
@jgebal I agree with you in general that dynamic insertion would be nice here, but I wouldn't want to do it now. It will be quite a bit of work because it increases complexity by a good part. We'll have to write tests post-packaging because we compose the behaviour in that step. |
I was thinking of integration this as part of maven build. <plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<!-- the wget goal actually binds itself to this phase by default -->
<phase>process-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://codeload.github.com/utPLSQL/utPLSQL-coverage-html/zip/1.0.0</url>
<outputFileName>utPLSQL-coverage-html</outputFileName>
<!-- default target location, just to demonstrate the parameter -->
<outputDirectory>${project.build.resources[0].directory}/CoverageHTMLReporter</outputDirectory>
</configuration>
</execution>
</executions>
</plugin> source: https://stackoverflow.com/questions/2741806/maven-downloading-files-from-url And then we can unzip it with: I'm not sure if that's all it takes, but would be worth a try. |
I got the download part to work, just didn't get a chance to try the unzip part. |
Added Maven goal for downloading unzipping resources in the `process-resources` phase.
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.
Looks like a nice set of improvements.
Thanks @pesse
Just noticed a Bug in asset retrieval when packed as jar. Will fix it before merging |
Also some refactoring of the tests and maven setup