Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68497

Changing the File Path for Junit XML file throws Exception

      When we try to change the path to the JUnit XML Result file it doesn't save the new path. It continues using the default file path instead like shown in the screenshot.

      This is the exception which is thrown by the plugin:

      Mai 10, 2022 3:54:28 NACHM. WARNUNG hudson.ExpressionFactory2$JexlExpression evaluate
      Caught exception evaluating: attrs.value ?: instance[attrs.field] ?: default in /view/TQS/job/TQS/job/qTest-Tosca/job/Tosca_Delete_Screenshots_All/configure. Reason: java.lang.reflect.InvocationTargetException
      java.lang.NullPointerException
      at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.getName(TestResultPublisher.java:211)
      Caused: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
      at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
      at org.apache.commons.jexl.parser.ASTArrayAccess.evaluateExpr(ASTArrayAccess.java:185)
      at org.apache.commons.jexl.parser.ASTArrayAccess.value(ASTArrayAccess.java:118) 

          [JENKINS-68497] Changing the File Path for Junit XML file throws Exception

          Shane added a comment -

          I encountered this issue and found a fix for it after finding the index.js file in the plugin directory and amending to be as follows -

           

          (function(){
              setTimeout(function(){
                  const formatSelect = document.querySelector('#tm4jAutomationPostBuildActionFormatSelect');
                  const filePath = document.querySelector('#tm4jAutomationPostBuildActionFilePath');
                  let currentPath;
                  if (filePath) {
                      currentPath = (formatSelect.value === 'Cucumber' || formatSelect.value === 'JUnit XML Result File') ? filePath.value : null;
                  }
                  formatSelect.onchange=changeEventHandler;
                  checkFormat(formatSelect);
          
                  function changeEventHandler(event) {
                      checkFormat(event.target)
                  }
          
                  function checkFormat(target){
                      if  (target.value === 'Cucumber') {
                          filePath.value = currentPath ? currentPath : 'target/cucumber/*.json';
                          filePath.disabled = false;
                      } else if (target.value == 'JUnit XML Result File') {
                          filePath.value = currentPath ? currentPath : 'target/surefire-reports/*.xml';
                          filePath.disabled = false;
                      } else {
                          filePath.value = 'zephyrscale_result.json';
                          filePath.disabled = true;
                      }
                      filePath.onchange();
                  }
              },200)
          })(); 

          The issue appears to be that JUnit XML Result File was not being considered.

          Shane added a comment - I encountered this issue and found a fix for it after finding the index.js file in the plugin directory and amending to be as follows -   (function(){ setTimeout(function(){ const formatSelect = document.querySelector( '#tm4jAutomationPostBuildActionFormatSelect' ); const filePath = document.querySelector( '#tm4jAutomationPostBuildActionFilePath' ); let currentPath; if (filePath) { currentPath = (formatSelect.value === 'Cucumber' || formatSelect.value === 'JUnit XML Result File' ) ? filePath.value : null ; } formatSelect.onchange=changeEventHandler; checkFormat(formatSelect); function changeEventHandler(event) { checkFormat(event.target) } function checkFormat(target){ if (target.value === 'Cucumber' ) { filePath.value = currentPath ? currentPath : 'target/cucumber/*.json' ; filePath.disabled = false ; } else if (target.value == 'JUnit XML Result File' ) { filePath.value = currentPath ? currentPath : 'target/surefire-reports/*.xml' ; filePath.disabled = false ; } else { filePath.value = 'zephyrscale_result.json' ; filePath.disabled = true ; } filePath.onchange(); } },200) })(); The issue appears to be that JUnit XML Result File was not being considered.

            zeedeveloper Zephyr Developer
            sven_schneider Sven Schneider
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: