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

Extra requirement of having output files break TestNG integration and create complex implementation

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Windows with slaves

      Jenkins Junit plug-ins works very well with TestNG, but not the junit-attachments plug-ins.

      Junit plug-ins is able to show the console output in master when a test fail even if executing testng.

      But junit-attachments plug-ins is making the thing complicated by requiring real file created that contain the output.

      The plug-in is looking for path/file like:
      c:\jenkins\workspace\SIT3_OPS_Smoketest_Functional_Tests\functional-tests\target\surefire-reports\junitreports\com.onassignment.ops.tests.company.CompanyTests-output.txt

      But those files doesn't exist.

      Again, to be clear, the core junit plug-ins is able to grab the output stream from the slave, so I don't see why the attachment plug-ins find it hard to do so.

      We do have a file having the entire output at that location: C:\jenkins\workspace\SIT3_OPS_Smoketest_Functional_Tests\functional-tests\target\surefire-reports\TestSuite-output.txt

      That file may be created only with <redirectTestOutputToFile>true</redirectTestOutputToFile>, this should not be needed at all. Jenkins core Junit plug-ins is working very fine without this setting to true.

          [JENKINS-14866] Extra requirement of having output files break TestNG integration and create complex implementation

          It's not really clear what you're trying to do here.

          You do not have to write files to those locations – you can also use the [[ATTACHMENT|/path/to/file.txt]] syntax mentioned on the wiki page.

          In any case, Jenkins will show the stderr/stdout info it finds in any testsuites, with or without the attachments plugin.

          Christopher Orr added a comment - It's not really clear what you're trying to do here. You do not have to write files to those locations – you can also use the [ [ATTACHMENT|/path/to/file.txt] ] syntax mentioned on the wiki page. In any case, Jenkins will show the stderr/stdout info it finds in any testsuites, with or without the attachments plugin.

          Sebastien Tardif added a comment - - edited

          I raised couple of points.

          1 - redirectTestOutputToFile option should not exist, I don't see the point of it, and Junit plug-ins works fine without that.
          2 - junit-attachments should also work with TestNG without any need of customization.
          3 - [[ATTACHMENT|/path/to/file.txt]] syntax doesn't work!

          Example of output where the attachment syntax is not working:
          1740 [main] INFO com.onassignment.ops.framework.TestNGListener - Test run started represented by: Command line suite
          1746 [main] INFO com.onassignment.ops.framework.PersistentTestContext - [[ATTACHMENT|c:\jenkins\workspace\SIT3_OPS_Smoketest_Functional_Tests\functional-tests\chrome.log|]]
          Started ChromeDriver

          Sebastien Tardif added a comment - - edited I raised couple of points. 1 - redirectTestOutputToFile option should not exist, I don't see the point of it, and Junit plug-ins works fine without that. 2 - junit-attachments should also work with TestNG without any need of customization. 3 - [ [ATTACHMENT|/path/to/file.txt] ] syntax doesn't work! Example of output where the attachment syntax is not working: 1740 [main] INFO com.onassignment.ops.framework.TestNGListener - Test run started represented by: Command line suite 1746 [main] INFO com.onassignment.ops.framework.PersistentTestContext - [ [ATTACHMENT|c:\jenkins\workspace\SIT3_OPS_Smoketest_Functional_Tests\functional-tests\chrome.log|] ] Started ChromeDriver

          The "redirectTestOutputToFile" option is a Maven feature; nothing to do with Jenkins?

          The attachments syntax definitely does work. However the parser is currently pretty strict, and requires that each ATTACHMENT line has no extra whitespace at the start or end, and there must be a newline after each attachment. Could that be where you're having problems? If so, this should be improved once pull request #1 gets merged.

          Otherwise, can you provide a minimal XML file where you see a failure to show attachments?

          Christopher Orr added a comment - The "redirectTestOutputToFile" option is a Maven feature; nothing to do with Jenkins? The attachments syntax definitely does work. However the parser is currently pretty strict, and requires that each ATTACHMENT line has no extra whitespace at the start or end, and there must be a newline after each attachment. Could that be where you're having problems? If so, this should be improved once pull request #1 gets merged. Otherwise, can you provide a minimal XML file where you see a failure to show attachments?

          Christopher Orr added a comment - - edited

          In fact, looking at the example you posted in your comment, it seems that the ATTACHMENT part isn't on its own line – it's at the end of the line starting with "1746".

          Try inserting a newline before the ATTACHMENT part.

          Christopher Orr added a comment - - edited In fact, looking at the example you posted in your comment, it seems that the ATTACHMENT part isn't on its own line – it's at the end of the line starting with "1746". Try inserting a newline before the ATTACHMENT part.

            huybrechts huybrechts
            sebtardif Sebastien Tardif
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: