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

xUnit plugin support for Check xml format

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.427, xunit 1.22
    • Similar Issues:

      Description

      Check http://check.sourceforge.net/ also supports xml test results. It would be nice if these could be parsed automatically.

      I've attached a basic functional xsl file here: http://false.ekta.is/2011/09/c-unittests-with-check-and-reporting-in-jenkinshudson/
      and also attached here.

      It would be super sexy if this could be integrated automatically into a later release.

        Attachments

          Activity

          Hide
          gbois Gregory Boissinot added a comment -

          OK no problems.
          Thanks for providing the XSL.
          Please could you attach Check reports to add unit tests in the plugin?

          Show
          gbois Gregory Boissinot added a comment - OK no problems. Thanks for providing the XSL. Please could you attach Check reports to add unit tests in the plugin?
          Hide
          karlp Karl P added a comment -

          Attached some sample check output, showing both completely successful and partially failing test results.

          each test file has the following code, from Check's documentation

          
          START_TEST(test_empty) {
          // just some test....
              char mylist[4][45];
              int index;
              char *raws = NULL;
              int list_len = cfg_list_load(mylist, &index, raws);
              fail_unless(list_len == 0, "Should have found zero hosts");    
          }
          END_TEST
          Suite * create_suite(void) {
              Suite *s = suite_create(__FILE__);
          
              /* Should probably use a better name in each file */
              TCase *tc_core = tcase_create("Core");
              tcase_add_test(tc_core, test_list_3);
              tcase_add_test(tc_core, test_single_entry);
              tcase_add_test(tc_core, test_allow_spaces);
              tcase_add_test(tc_core, test_only_first_entries);
              tcase_add_test(tc_core, test_empty);
              suite_add_tcase(s, tc_core);
              return s;
          }
          
          int main(void) {
              int num_fail;
              Suite *s = create_suite();
              SRunner *sr = srunner_create(s);
              srunner_set_xml (sr, __FILE__ ".xml");
              srunner_run_all(sr, CK_NORMAL);
              num_fail = srunner_ntests_failed(sr);
              srunner_free(sr);
              return (num_fail == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
          }
          

          Hope that helps.

          Show
          karlp Karl P added a comment - Attached some sample check output, showing both completely successful and partially failing test results. each test file has the following code, from Check's documentation START_TEST(test_empty) { // just some test.... char mylist[4][45]; int index; char *raws = NULL; int list_len = cfg_list_load(mylist, &index, raws); fail_unless(list_len == 0, "Should have found zero hosts" ); } END_TEST Suite * create_suite(void) { Suite *s = suite_create(__FILE__); /* Should probably use a better name in each file */ TCase *tc_core = tcase_create( "Core" ); tcase_add_test(tc_core, test_list_3); tcase_add_test(tc_core, test_single_entry); tcase_add_test(tc_core, test_allow_spaces); tcase_add_test(tc_core, test_only_first_entries); tcase_add_test(tc_core, test_empty); suite_add_tcase(s, tc_core); return s; } int main(void) { int num_fail; Suite *s = create_suite(); SRunner *sr = srunner_create(s); srunner_set_xml (sr, __FILE__ ".xml" ); srunner_run_all(sr, CK_NORMAL); num_fail = srunner_ntests_failed(sr); srunner_free(sr); return (num_fail == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } Hope that helps.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/xunit/types/CheckInputMetric.java
          src/main/java/org/jenkinsci/plugins/xunit/types/CheckType.java
          src/main/resources/org/jenkinsci/plugins/xunit/types/check-to-junit-4.xsl
          src/test/java/org/jenkinsci/plugins/xunit/types/AbstractTest.java
          src/test/java/org/jenkinsci/plugins/xunit/types/CheckTypeTest.java
          src/test/java/org/jenkinsci/plugins/xunit/types/CustomTest.java
          src/test/java/org/jenkinsci/plugins/xunit/types/CustomTypeTest.java
          src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase1/input.xml
          src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase1/result.xml
          src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase2/input.xml
          src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase2/result.xml
          http://jenkins-ci.org/commit/xunit-plugin/ea51f37b8cad386d0d9f06d752e8bb735c0b36f6
          Log:
          Fixed JENKINS-10909

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/xunit/types/CheckInputMetric.java src/main/java/org/jenkinsci/plugins/xunit/types/CheckType.java src/main/resources/org/jenkinsci/plugins/xunit/types/check-to-junit-4.xsl src/test/java/org/jenkinsci/plugins/xunit/types/AbstractTest.java src/test/java/org/jenkinsci/plugins/xunit/types/CheckTypeTest.java src/test/java/org/jenkinsci/plugins/xunit/types/CustomTest.java src/test/java/org/jenkinsci/plugins/xunit/types/CustomTypeTest.java src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase1/input.xml src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase1/result.xml src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase2/input.xml src/test/resources/org/jenkinsci/plugins/xunit/types/check/testcase2/result.xml http://jenkins-ci.org/commit/xunit-plugin/ea51f37b8cad386d0d9f06d752e8bb735c0b36f6 Log: Fixed JENKINS-10909
          Hide
          gbois Gregory Boissinot added a comment -

          Thanks for your inputs. Check support available in 1.23.

          Show
          gbois Gregory Boissinot added a comment - Thanks for your inputs. Check support available in 1.23.

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              karlp Karl P
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: