How to just run tests in a test class?

117 views
Skip to first unread message

eagl...@gmail.com

unread,
Aug 1, 2018, 8:23:05 AM8/1/18
to Kylo Community
Hi, All,

I'm writing a patch for kylo, but when I test the patch with 'mvn test', some testcases are failed.

I want to run some specfic test class and try the following command:
mvn test -Dtest=PutFeedMetadataTest

But I got following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project kylo-commons-security: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.


Does anyone know how to run this specific test class with mvn and how to get the command line that the the test case?

Thanks

Boying

Jagrut Sharma

unread,
Aug 1, 2018, 3:19:00 PM8/1/18
to Kylo Community
Hi Boying - Your command is correct and should run the tests in the specific class. I performed the below and it works:

Create a test class at /kylo/commons/commons-security/src/test/java/MyTest.java

To run tests in the above class:
1) Navigate to directory: /kylo/commons/commons-security
2) Run: mvn test -Dtest=MyTest

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running MyTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 s - in MyTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0


Thanks.
--
Jagrut

eagl...@gmail.com

unread,
Aug 1, 2018, 10:59:38 PM8/1/18
to Kylo Community
Thanks for your help.

But could you try this?
1. cd integrations/nifi/nifi-nar-bundles/nifi-core-bundle/nifi-core-processors
2. mvn test -DtDtest=PutFeedMetadataTest

I got following error:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.thinkbiganalytics.kylo.integrations:kylo-nifi-core-processors:jar:0.9.2-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.sonatype.plugins:nexus-staging-maven-plugin is missing. @ com.thinkbiganalytics.kylo.integrations:kylo-integrations:[unknown-version], /home/brian/kylo-trunk/integrations/pom.xml, line 27, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building kylo-nifi-core-processors 0.9.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.thinkbiganalytics.kylo.integrations:kylo-nifi-framework-api:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo.integrations:kylo-nifi-hadoop-service-api:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo.integrations:kylo-nifi-core-service-api:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo:kylo-metadata-api:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo:kylo-metadata-rest-model:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo:kylo-commons-hive:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo:kylo-commons-jdbc:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.thinkbiganalytics.kylo.integrations:kylo-nifi-framework-v1:jar:0.9.2-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.032 s
[INFO] Finished at: 2018-08-02T10:55:21+08:00
[INFO] Final Memory: 48M/1979M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project kylo-nifi-core-processors: Could not resolve dependencies for project com.thinkbiganalytics.kylo.integrations:kylo-nifi-core-processors:jar:0.9.2-SNAPSHOT: The following artifacts could not be resolved: com.thinkbiganalytics.kylo.integrations:kylo-nifi-framework-api:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo.integrations:kylo-nifi-hadoop-service-api:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo.integrations:kylo-nifi-core-service-api:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo:kylo-metadata-api:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo:kylo-metadata-rest-model:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo:kylo-commons-hive:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo:kylo-commons-jdbc:jar:0.9.2-SNAPSHOT, com.thinkbiganalytics.kylo.integrations:kylo-nifi-framework-v1:jar:0.9.2-SNAPSHOT: Could not find artifact com.thinkbiganalytics.kylo.integrations:kylo-nifi-framework-api:jar:0.9.2-SNAPSHOT -> [Help 1]

[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Thanks again.

Jagrut Sharma

unread,
Aug 2, 2018, 1:53:57 AM8/2/18
to Kylo Community
Hi Boying - The test runs fine at my end.

cd /kylo/integrations/nifi/nifi-nar-bundles/nifi-core-bundle/nifi-core-processors
mvn test -Dtest=PutFeedMetadataTest

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.thinkbiganalytics.nifi.v2.metadata.PutFeedMetadataTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.532 s - in com.thinkbiganalytics.nifi.v2.metadata.PutFeedMetadataTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------

Your log indicates that there are missing dependencies that the module depends on. Try to build the full project (mvn clean install) so that the dependencies get into the local maven repo, and then you can run the test individually.

Thanks.
--
Jagrut

eagl...@gmail.com

unread,
Aug 2, 2018, 11:50:41 PM8/2/18
to Kylo Community
ok, so it's an issue in my dev env. I'll take further look.

Thanks again :)
Reply all
Reply to author
Forward
0 new messages