I have some 'integration' tests that have been written as POJOs. They run 
manually

I'm looking at refactoring to automate, making use of the failsafe plugin, 
together with a few other plugins to launch a server process, and configure the 
server against which the integration tests run.

I'm struggling to get failsafe to call any tests...

We have a 300+ multi module maven project. A significant amount of those 
projects contribute to a spring boot application - this is all built/assembled 
through maven.

When the pojo tests were written, they were added as a regular maven module. As 
such the source is in the usual source folders, not test ... so I have added 
configuration like

                           
<testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
                            
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>

The classes didn't follow the failsafe naming convention, so I added:

                           <includes>
                                 <include>**/*.java</include>
                                 <include>**/*.java</include>
                             </includes>

This isn't where I finally want to get to (refactoring to naming conventions 
will be clearer for the future) but as a demonstration/first pass, I thought 
this would be a sensible evolutionary approach.

The tests themselves are not written using any framework like junit/testNG, and 
require input/parms, but in a class which begins:

 package org.odpi.openmetadata.accessservices.subjectarea.fvt;
// imports
 public class GlossaryFVT {

I could add a method like:

    public static void testGlossary()
     {
         try {
             runIt("https://localhost:10443";, "fvtserver", "garygeeke");
         } catch (Exception e) {
             // Test method - so ok to do this
             Thread.dumpStack();
         }
     }

(here runIt is an existing method, which is also called via a main() entry 
point - but that's not of interest in  migrating to failsafe)

Not only is the method not reported by failsafe, but the class isn't either. 
For the method, I also tried prepending/appending with 'test' , 'Test', 'IT' 
but couldn't get any combination working. The code on github (for surefire) 
hinted at Test, but the docs refer to IT

In the actual source directory I have a number of classes:

CategoryFVT.java                      GlossaryFVT.java                      
RunAllFVTNow.java
CategoryHierarchyFVT.java             GraphFVT.java                         
SubjectAreaDefinitionCategoryFVT.java
EffectiveDatesFVT.java                ProjectFVT.java                       
SubjectAreaFVTCheckedException.java
FVTConstants.java                     RelationshipsFVT.java                 
TermFVT.java
FVTUtils.java                         RunAllFVT.java

and when I run I actually get some of these classes picked up by surefire for 
example:

[INFO] --- maven-failsafe-plugin:3.0.0-M5:integration-test (local) @ 
subject-area-fvt ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.odpi.openmetadata.accessservices.subjectarea.fvt.FVTConstants
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s 
- in org.odpi.openmetadata.accessservices.subjectarea.fvt.FVTConstants
[INFO] Running org.odpi.openmetadata.accessservices.subjectarea.fvt.RunAllFVT
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in 
org.odpi.openmetadata.accessservices.subjectarea.fvt.RunAllFVT
[INFO] Running org.odpi.openmetadata.accessservices.subjectarea.fvt.RunAllFVTNow
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s 
- in org.odpi.openmetadata.accessservices.subjectarea.fvt.RunAllFVTNow
[INFO] Running org.odpi.openmetadata.accessservices.subjectarea.fvt.FVTUtils
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s 
- in org.odpi.openmetadata.accessservices.subjectarea.fvt.FVTUtils
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Interesting ... in fact I changed the includes to '**/*.FVT' as these represent 
the classes I actually will modify for testing (as opposed to utils/runners) - 
but then I had NONE of the classes listed above. Hence I went back to * for 
purpose of explanation . 

If we look at one of those picked up - 

$ cat 
src/main/java/org/odpi/openmetadata/accessservices/subjectarea/fvt/FVTConstants.java
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.subjectarea.fvt;
public class FVTConstants
{
    public static final String USERID = "erinoverview";
    public static final String DEFAULT_URL = "https://localhost:9443";;
    public static final String SERVER_NAME1  = "cocoMDS4";
    public static final String SERVER_NAME2  = "cocoMDS1";
}

There's nothing of interest there.. 

So, I am confused over the status of POJO testing, how to specify classes to 
test, and which methods will be called. 

Can anyone explain?

Are pojo tests supported?
What methods are counted as tests?
Can I override the method names used
Why aren't my other classes even picked up when figuring out classes to use? 
let alone methods?

I should add I'm using the latest 3.0.0-M5 plugin, though also tried backing 
off to 2.x - same results. Currently java 14 locally, though java 8 is the base 
build env. MacOS

I can do more refactoring - ie move to test directories, refactor code, follow 
method naming conventions (once known), and if needed just do more refactoring 
and move to JUnit etc, but was confused why my first step wasn't working?

Many thanks
Nigel Jones
ODPi Egeria maintainer
https://github.com/odpi/egeria




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to