[IronJacamar Development] - TestSuite - redesign of some tests and " false" coverage
by Stefano Maestri
Stefano Maestri [http://community.jboss.org/people/maeste] created the discussion
"TestSuite - redesign of some tests and "false" coverage"
To view the discussion, visit: http://community.jboss.org/message/573339#573339
--------------------------------------------------------------
Hi all,
A deep look at our test suite reveal that some of the coverage report, is not saying the true about test situation.
Coverage is sometime overestimated. To say that better, cobertura is not wrong, from a pure coverage point of view, but some of our tests (for examples parsers' ones) are not well defined in terms of atomicity of behaviors verified. In a lot of cases, to achieve our very short time release goal, we have written a generic tests stressing all possible problems in just one tests. For example I've written my self this horrible test:
@Test
public void shouldParseAnyExample() throws Exception
{
FileInputStream is = null;
//given
File directory = new File(Thread.currentThread().getContextClassLoader().getResource("ds").toURI());
for (File xmlFile : directory.listFiles(new FileSuffixFilter("-ds.xml")))
{
System.out.println(xmlFile.getName());
try
{
is = new FileInputStream(xmlFile);
DsParser parser = new DsParser();
//when
DataSources ds = parser.parse(is);
//then
assertThat(ds.getDataSource().size() + ds.getXaDataSource().size(), is(1));
}
finally
{
if (is != null)
is.close();
}
}
}
@Test
public void shouldParseAnyExample() throws Exception
{
FileInputStream is = null;
//given
File directory = new File(Thread.currentThread().getContextClassLoader().getResource("ds").toURI());
for (File xmlFile : directory.listFiles(new FileSuffixFilter("-ds.xml")))
{
System.out.println(xmlFile.getName());
try
{
is = new FileInputStream(xmlFile);
DsParser parser = new DsParser();
//when
DataSources ds = parser.parse(is);
//then
assertThat(ds.getDataSource().size() + ds.getXaDataSource().size(), is(1));
}
finally
{
if (is != null)
is.close();
}
}
}
Of course it give us a good coverage parsing a lot of file, bit in case of failure the reasons for that failure could become a pain to understand and of course it doesn't help a lot as regression tests.
I think we should review this kind of code to have more proper UNIT test :)
>From this point of view I'd like very much also to limit as much as possible xml files as test resources, defining xml to be parsed inline inside the tests (for this kind of work scala language and its xml type would be a dream). Of course this approach has the plus of having a real unit test with a fail containing really everything to read and understand given-when-then conditions. The minus of this approach is that we would provide less example files in our tests suite.
Please let me know what you think about. My ideal solution would be to keep both approach, keeping the above test to parse and use real xml file put in an integration-test phase (no coverage consideration there) and the PURE UNIT tests described with inline xml file genration.
best regards
S.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/573339#573339]
Start a new discussion in IronJacamar Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months
[EJB3 Development] - Configuring Quartz in External properties(EJBs are not injected)
by Andriy Lytvynskyy
Andriy Lytvynskyy [http://community.jboss.org/people/andy_l] created the discussion
"Configuring Quartz in External properties(EJBs are not injected)"
To view the discussion, visit: http://community.jboss.org/message/573148#573148
--------------------------------------------------------------
Hi
I'm using EJB 3.0, and I'm using Quartz, I removed all the annotations for my MDB which implements Job interface because I want to configure Quartz (cron scheduling) out of my application:
I have quartz.properties which are in my classpath:
#===============================================================
# Configure Main Scheduler Properties
#===============================================================
org.quartz.scheduler.instanceName = QuartzScheduler
org.quartz.scheduler.instanceId = AUTO
#===============================================================
# Configure ThreadPool
#===============================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
#===============================================================
# Configure JobStore
#===============================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = dpp-quartz-job.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
I've got also dpp-quartz-job.xml which descibes my job is laced to 'conf' folder in JBoss:
<?xml version="1.0" encoding="UTF-8"?>
<quartz xmlns=" http://www.opensymphony.com/quartz/JobSchedulingData http://www.opensymphony.com/quartz/JobSchedulingData"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
overwrite-existing-jobs="true">
<job>
<job-detail>
<name>MyTask</name>
<group>Svn Update Parse Group</group>
<description></description>
<job-class>
com.avery.dpp.QuartzUtils
</job-class>
<job-data-map allows-transient-data="false">
<entry>
<key></key>
<value></value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>JobTrigger</name>
<group>trigger-group</group>
<job-name>Svn Update Parse</job-name>
<job-group>Svn Update Parse Group</job-group>
<!-- Fire every 2 seconds -->
<!-- <cron-expression>0/2 * * * * ?</cron-expression -->
<!-- Fire every November 11 at 11:11 AM -->
<!-- cron-expression>0 11 11 11 11 ?</cron-expression -->
<!-- Daily Every day at 18:15 PM -->
<cron-expression> 0 17 18 * * ?</cron-expression>
</cron>
</trigger>
</job>
</quartz>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/573148#573148]
Start a new discussion in EJB3 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months
[JBoss Tools Development] - Build Cascade & Results
by Nick Boldt
Nick Boldt [http://community.jboss.org/people/nickboldt] created the document:
"Build Cascade & Results"
To view the document, visit: http://community.jboss.org/docs/DOC-16166
--------------------------------------------------------------
Build Cascade:
* http://community.jboss.org/jbosstools-3.2_stable_branch.target-platform Local Target Platform build (build + publish) * /jbosstools-3.2_stable_branch.continuous Continuous build (build only, no tests, no publish)
* http://community.jboss.org/jbosstools-3.2_stable_branch.tests Tests build (build + tests, no publish)
* /jbosstools-3.2_stable_branch.nightly Nightly build (build + tests, publish) * /jbosstools-3.2_stable_branch.aggregate-publish Aggregate build publisher (publish select pieces of aggregate site for use by JBDS uberbuild) ----
* http://community.jboss.org/devstudio-4.0.target-platform Local JBDS Target Platform build (build + publish) * http://community.jboss.org/devstudio-4.0_stable_branch.updatesite JBDS Aggregate site build (build core [JBT + JBDS], third-party, and preview sites, publish) * /devstudio-4.0_stable_branch.product JBDS Product build (experimental) (combine JBDS components + TP into installers, publish)
* +http://community.jboss.org/devstudio-4.0_stable_branch.uberbuild JBDS PDE "Uberbuilder" build (compile JBDS components + some aggregate pieces into installers, publish) :: deprecated+
Results:
* JBT Aggregate update sites: http://download.jboss.org/jbosstools/updates/nightly/ http://download.jboss.org/jbosstools/updates/nightly/ :: http://download.jboss.org/jbosstools/updates/nightly/trunk/ latest from trunk
* JBT Aggregate builds: http://download.jboss.org/jbosstools/builds/nightly/ http://download.jboss.org/jbosstools/builds/nightly/ :: http://download.jboss.org/jbosstools/builds/nightly/trunk/latestBuild.html latest from trunk* JBT Component builds: http://download.jboss.org/jbosstools/builds/staging/ http://download.jboss.org/jbosstools/builds/staging/----
* JBDS Aggregate update sites: http://reports.qa.atl.jboss.com/binaries/RHDS/updates/nightly/ http://reports.qa.atl.jboss.com/binaries/RHDS/updates/nightly/ :: http://reports.qa.atl.jboss.com/binaries/RHDS/updates/nightly/trunk/ latest from trunk
* JBDS Product builds: http://reports.qa.atl.jboss.com/binaries/RHDS/builds/staging/devstudio-4.... http://reports.qa.atl.jboss.com/binaries/RHDS/builds/staging/devstudio-4.... :: http://reports.qa.atl.jboss.com/binaries/RHDS/builds/staging/devstudio-4.... latest from trunk
* +JBDS "Uber" builds: http://reports.qa.atl.jboss.com/binaries/RHDS/builds/nightly/ http://reports.qa.atl.jboss.com/binaries/RHDS/builds/nightly/ :: http://reports.qa.atl.jboss.com/binaries/RHDS/builds/nightly/trunk/latest... latest from trunk :: deprecated+ * JBDS Component builds: http://reports.qa.atl.jboss.com/binaries/RHDS/builds/staging/ http://reports.qa.atl.jboss.com/binaries/RHDS/builds/staging/
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16166]
Create a new document in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 3 months