Generate XSLT Report+ Ant build.xml+TestNG Fatal Error! Could not find function: if Issue +No suites, classes, methods or jar file was specified.

We usually depend on Testng for generating the default reports. Apart from that we use XSLT reports as well to generate PIE Charts based on Failed,Passed,Skipped Testcases.
During this process we face lot of issues. Few of the most commonly observed issues are as follows:

[xslt] Unknown file:23:146: Fatal Error! Could not find function: if
[xslt] : Fatal Error! Fatal error during transformation Cause: Fatal error during transformation


In order to resolve this we have to follow the below steps. At every step we will check and see whether issues are resolved or not.
Step 1 :
Make sure the build.xml file contains ‘SaxonLiaison’ processor added.
Example:

Re-run the build.xml and verify the issue is resolved. If still the issue is not resolved try performing Step2.
Step 2 :
Make sure the following jars added to the lib folder and Project build path as well.
saxon-8.7.jar -> Link to download the saxon jar-> Click here
SaxonLiaison.jar ->Link to download the SaxonLiaison jar-> Click here
guice-3.0.jar->Link to download guice-3.0.jar-> Click here


Re-run the build.xml and verify the issue is resolved. If the issue is not resolved goto Step3.
Step 3:

Refer to the build.xml mentioned below .Try to do necessary changes.
Re-run the build.xml and verify the issue is resolved.

Step 4:
Re-verify the testng-results.xsl available in the project directory by downloading from the link Click here .Try to do necessary changes.
Re-run the build.xml and verify all the issues are resolved.
If even after the issues are not resolved, please refer to the directory structure mentioned in the below screenshot.
Resolving “No suites, classes, methods or jar file was specified” in Ant TestNG
Make sure the testng.xml is available in the src folder as mentioned in the image below. Refer to the point1.
XSLT+ANT+TESTNG




Leave a Reply

Your email address will not be published. Required fields are marked *