Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Translate the entire conversation x

Compiling unit tests on Windchill+ gives symbol "error: cannot find symbol" at the custom Java class

VC_10988901
7-Bedrock

Compiling unit tests on Windchill+ gives symbol "error: cannot find symbol" at the custom Java class

Version: Windchill 12.1

 

Use Case: For context, we are using Windchill+ which means we need to send CCD packages to PTC for deployment. This would also mean we cannot adjust certain settings and properties located in Windchill, as the PTC-managed deployment to TEST and PROD would cause issues. I created a custom java class that is called within a workflow. It has been compiled and deployed and is currently functioning in our dev system. I am now attempting to write unit tests for my custom java class. I have been following the customization guide, especially "Building and Deploying Tests in Development System", but while I attempt `ant compile.test`, it fails as it cannot find my package .


Description:

For context, we are using Windchill+ which means we need to send CCD packages to PTC for deployment.

I created a custom java class that is called within a workflow.


It is located in <\opt\ptc\windchill_customization\customModule\main\src\com\acme\customClass.java> as suggested in the Customization Guide.
I am able to compile and deploy the jar file to our dev system at: <\opt\ptc\WT_HOME\custom\lib\customModule.jar> using `ant compile` and `ant deploy`.
I am able to call the class in the workflow, and the methods are all working correctly and my workflow behaves as customised. All great.

 

I am now attempting to write unit tests for my custom java class as we plan to expand it in the future. I have been following the customization guide, especially "Building and Deploying Tests in Development System", but while I attempt `ant compile.test`, it fails as it cannot find my package <com.acme>. I have ensured that both my custom java class and my test file have the correct "package com.acme" spelling.

I have followed the suggested test file location, <\opt\ptc\windchill_customization\customModule\test\source\src\com\acme\customClassTest.java>

 

Has anyone successfully compiled and deployed a unit test?

ACCEPTED SOLUTION

Accepted Solutions

I solved this in the end. There is a small note on the External Targets page:

If there is compile time dependency for the test module on src modules, then the sequence to run ant targets is as follows: ant compile compile.test deploy deploy.test

View solution in original post

2 REPLIES 2
avillanueva
22-Sapphire II
(To:VC_10988901)

I am at the user conference and sat in on many presentations about the coming changes. Thanks for being vanguard on this topic. I think you should make a cross ticket to Tech Support but if you get a solution, please post here. You can also look at the presentation topics from the user conference below and reach out to the PLMs who might be able to answer or direct your issue to their team.  Normally, I do not recommend pestering PLMs but on this topic, I think this team is working with customers closely on these new type of issues.

https://globalsummit.ptcuser.org/event/4908edd4-ca93-4481-8a94-16802e6dfd12/agenda

 

I solved this in the end. There is a small note on the External Targets page:

If there is compile time dependency for the test module on src modules, then the sequence to run ant targets is as follows: ant compile compile.test deploy deploy.test
Announcements
Top Tags