{"action":"created","comment":{"url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/comments/47443610","id":47443610,"diff_hunk":"@@ -0,0 +1,135 @@\n+function str=getSummaryStr(obj, format)\n+% get summary of tests that were run and their output\n+%\n+% str=getSummaryStr(obj, format)\n+%\n+% Inputs:\n+%   obj                 MOxUnitTestReport instance\n+%   format              Output format: 'xml' or 'text'\n+%\n+% Output:\n+%   str                 text or XML string representation of the results of\n+%                       the tests\n+%\n+\n+    format2converter=struct();\n+    format2converter.text=@report2summary_text;\n+    format2converter.xml=@report2summary_xml;\n+\n+    f=format2converter.(format);\n+    str=f(obj);\n+\n+function str=report2summary_xml(obj)\n+% return summary in XML format\n+    header=sprintf('<testsuite name=\"%s\" time=\"%.3f\" %s>',...\n+                    moxunit_util_escape_xml(getName(obj)),...\n+                    getDuration(obj),...\n+                    statistics_xml(obj));\n+\n+    summary_text_cell=get_outcome_summary_cell(obj,'xml');\n+    body=strjoin(summary_text_cell,'\\n');\n+\n+    footer='</testsuite>';\n+    str=sprintf('%s\\n%s\\n%s',header,body,footer);\n+\n+\n+function str=report2summary_text(obj)\n+% return summary in text format\n+    verbosity=obj.verbosity;\n+\n+    hor_line=repmat('-',1,50);\n+\n+    body='';\n+    if verbosity>=2\n+        summary_text_cell=get_outcome_summary_cell(obj,'text');\n+        non_empty_msk=~cellfun(@isempty,summary_text_cell);\n+        if any(non_empty_msk)\n+            summary_text_cell_nonempty=summary_text_cell(non_empty_msk);\n+            body_non_pass=strjoin(summary_text_cell_nonempty,'\\n\\n');\n+            body=sprintf('%s\\n\\n%s\\n%s\\n\\n',hor_line,body_non_pass);\n+        end\n+    end\n+\n+\n+    if verbosity>=1\n+        footer=sprintf('\\n%s\\n\\n%s',hor_line,statistics_text(obj));\n+    else\n+        footer='';\n+    end\n+\n+    str=sprintf('%s%s',body,footer);\n+\n+\n+\n+function [c,n_tests]=get_outcome_summary_cell(obj, format)\n+% helper function to get the summary from each test\n+    n_tests=countTestOutcomes(obj);\n+    c=cellfun(@(x)getSummaryStr(getTestOutcome(obj,x),format),...\n+                    num2cell(1:n_tests),...\n+                    'UniformOutput',false);\n+\n+function str=statistics_xml(obj)\n+% return xm; string indicating number of tests, and how many were failures,\n+% skips and errors\n+%\n+% Example outputs:\n+%       'tests=\"9\"'\n+%       'tests=\"9\" failures=\"2\"'\n+\n+    total_tests=sprintf('tests=\"%d\"',countTestOutcomes(obj));\n+\n+    labels_singular_plural={'failure','failures';...\n+                            'skipped','skipped';...\n+                            'error','errors'};\n+    n_labels=size(labels_singular_plural,1);\n+\n+    label2count=getTestOutputStatistics(obj);\n+    non_success_tests_cell=cell(n_labels,1);\n+    for k=1:n_labels\n+        singular=labels_singular_plural{k,1};\n+        plural=labels_singular_plural{k,2};\n+\n+        if isfield(label2count,singular)\n+            count=label2count.(singular);\n+        else\n+            count=0;\n+        end\n+\n+        non_success_tests_cell{k}=sprintf('%s=\"%d\"',plural,count);\n+    end\n+\n+    str=sprintf('%s %s',total_tests,strjoin(non_success_tests_cell,' '));\n+\n+\n+\n+\n+function str=statistics_text(obj)\n+% return text string indicating whether all tests passed or not, and\n+% number of failures, skips and errors.\n+%\n+% Example outputs:\n+%       'OK'\n+%       'FAILED (skipped=2)'\n+\n+    if wasSuccessful(obj)\n+        str='OK';\n+    else\n+        str='FAILED';\n+    end\n+\n+    label2count=getTestOutputStatistics(obj);","path":"MOxUnit/@MOxUnitTestReport/getSummaryStr.m","position":120,"original_position":120,"commit_id":"2d1aec89cf4ffa719b1971de3cab2aa338a0bd41","original_commit_id":"2d1aec89cf4ffa719b1971de3cab2aa338a0bd41","user":{"login":"scottclowe","id":2891791,"avatar_url":"https://avatars.githubusercontent.com/u/2891791?v=3","gravatar_id":"","url":"https://api.github.com/users/scottclowe","html_url":"https://github.com/scottclowe","followers_url":"https://api.github.com/users/scottclowe/followers","following_url":"https://api.github.com/users/scottclowe/following{/other_user}","gists_url":"https://api.github.com/users/scottclowe/gists{/gist_id}","starred_url":"https://api.github.com/users/scottclowe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottclowe/subscriptions","organizations_url":"https://api.github.com/users/scottclowe/orgs","repos_url":"https://api.github.com/users/scottclowe/repos","events_url":"https://api.github.com/users/scottclowe/events{/privacy}","received_events_url":"https://api.github.com/users/scottclowe/received_events","type":"User","site_admin":false},"body":"Odd choice of variable name. I would expect `label2count` to be a conversion function,as opposed to a mapping structure. I would just call it `labelCounts` myself, I think.","created_at":"2015-12-13T12:18:45Z","updated_at":"2015-12-13T12:18:45Z","html_url":"https://github.com/MOxUnit/MOxUnit/pull/14#discussion_r47443610","pull_request_url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/comments/47443610"},"html":{"href":"https://github.com/MOxUnit/MOxUnit/pull/14#discussion_r47443610"},"pull_request":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14","id":53391835,"html_url":"https://github.com/MOxUnit/MOxUnit/pull/14","diff_url":"https://github.com/MOxUnit/MOxUnit/pull/14.diff","patch_url":"https://github.com/MOxUnit/MOxUnit/pull/14.patch","issue_url":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/14","number":14,"state":"open","locked":false,"title":"NF: support for JUnit XML output and use with shippable.com ci","user":{"login":"nno","id":1453927,"avatar_url":"https://avatars.githubusercontent.com/u/1453927?v=3","gravatar_id":"","url":"https://api.github.com/users/nno","html_url":"https://github.com/nno","followers_url":"https://api.github.com/users/nno/followers","following_url":"https://api.github.com/users/nno/following{/other_user}","gists_url":"https://api.github.com/users/nno/gists{/gist_id}","starred_url":"https://api.github.com/users/nno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nno/subscriptions","organizations_url":"https://api.github.com/users/nno/orgs","repos_url":"https://api.github.com/users/nno/repos","events_url":"https://api.github.com/users/nno/events{/privacy}","received_events_url":"https://api.github.com/users/nno/received_events","type":"User","site_admin":false},"body":"This PR adds JUnit XML output support (as did #13), and includes an updates .travis.yml which operates with shippable.com. \r\n- refactoring of MOxUnit code\r\n- support for `-junit_xml` argument in `moxunit_runtests`\r\n- updated `.travis.yml` which outputs JUnit XML output when running on shippable.com\r\n\r\nExample output: https://app.shippable.com/projects/56697a971895ca44744e850b","created_at":"2015-12-11T13:23:28Z","updated_at":"2015-12-13T12:18:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a25f0be3c96ce25fcf24623aa1219c52f32faff4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14/commits","review_comments_url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14/comments","review_comment_url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/14/comments","statuses_url":"https://api.github.com/repos/MOxUnit/MOxUnit/statuses/2d1aec89cf4ffa719b1971de3cab2aa338a0bd41","head":{"label":"nno:_nf/shippable","ref":"_nf/shippable","sha":"2d1aec89cf4ffa719b1971de3cab2aa338a0bd41","user":{"login":"nno","id":1453927,"avatar_url":"https://avatars.githubusercontent.com/u/1453927?v=3","gravatar_id":"","url":"https://api.github.com/users/nno","html_url":"https://github.com/nno","followers_url":"https://api.github.com/users/nno/followers","following_url":"https://api.github.com/users/nno/following{/other_user}","gists_url":"https://api.github.com/users/nno/gists{/gist_id}","starred_url":"https://api.github.com/users/nno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nno/subscriptions","organizations_url":"https://api.github.com/users/nno/orgs","repos_url":"https://api.github.com/users/nno/repos","events_url":"https://api.github.com/users/nno/events{/privacy}","received_events_url":"https://api.github.com/users/nno/received_events","type":"User","site_admin":false},"repo":{"id":42809751,"name":"MOxUnit","full_name":"nno/MOxUnit","owner":{"login":"nno","id":1453927,"avatar_url":"https://avatars.githubusercontent.com/u/1453927?v=3","gravatar_id":"","url":"https://api.github.com/users/nno","html_url":"https://github.com/nno","followers_url":"https://api.github.com/users/nno/followers","following_url":"https://api.github.com/users/nno/following{/other_user}","gists_url":"https://api.github.com/users/nno/gists{/gist_id}","starred_url":"https://api.github.com/users/nno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nno/subscriptions","organizations_url":"https://api.github.com/users/nno/orgs","repos_url":"https://api.github.com/users/nno/repos","events_url":"https://api.github.com/users/nno/events{/privacy}","received_events_url":"https://api.github.com/users/nno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nno/MOxUnit","description":"An xUnit framework for Matlab and GNU Octave ","fork":true,"url":"https://api.github.com/repos/nno/MOxUnit","forks_url":"https://api.github.com/repos/nno/MOxUnit/forks","keys_url":"https://api.github.com/repos/nno/MOxUnit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nno/MOxUnit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nno/MOxUnit/teams","hooks_url":"https://api.github.com/repos/nno/MOxUnit/hooks","issue_events_url":"https://api.github.com/repos/nno/MOxUnit/issues/events{/number}","events_url":"https://api.github.com/repos/nno/MOxUnit/events","assignees_url":"https://api.github.com/repos/nno/MOxUnit/assignees{/user}","branches_url":"https://api.github.com/repos/nno/MOxUnit/branches{/branch}","tags_url":"https://api.github.com/repos/nno/MOxUnit/tags","blobs_url":"https://api.github.com/repos/nno/MOxUnit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nno/MOxUnit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nno/MOxUnit/git/refs{/sha}","trees_url":"https://api.github.com/repos/nno/MOxUnit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nno/MOxUnit/statuses/{sha}","languages_url":"https://api.github.com/repos/nno/MOxUnit/languages","stargazers_url":"https://api.github.com/repos/nno/MOxUnit/stargazers","contributors_url":"https://api.github.com/repos/nno/MOxUnit/contributors","subscribers_url":"https://api.github.com/repos/nno/MOxUnit/subscribers","subscription_url":"https://api.github.com/repos/nno/MOxUnit/subscription","commits_url":"https://api.github.com/repos/nno/MOxUnit/commits{/sha}","git_commits_url":"https://api.github.com/repos/nno/MOxUnit/git/commits{/sha}","comments_url":"https://api.github.com/repos/nno/MOxUnit/comments{/number}","issue_comment_url":"https://api.github.com/repos/nno/MOxUnit/issues/comments{/number}","contents_url":"https://api.github.com/repos/nno/MOxUnit/contents/{+path}","compare_url":"https://api.github.com/repos/nno/MOxUnit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nno/MOxUnit/merges","archive_url":"https://api.github.com/repos/nno/MOxUnit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nno/MOxUnit/downloads","issues_url":"https://api.github.com/repos/nno/MOxUnit/issues{/number}","pulls_url":"https://api.github.com/repos/nno/MOxUnit/pulls{/number}","milestones_url":"https://api.github.com/repos/nno/MOxUnit/milestones{/number}","notifications_url":"https://api.github.com/repos/nno/MOxUnit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nno/MOxUnit/labels{/name}","releases_url":"https://api.github.com/repos/nno/MOxUnit/releases{/id}","created_at":"2015-09-20T11:01:21Z","updated_at":"2015-09-20T11:01:23Z","pushed_at":"2015-12-11T13:17:23Z","git_url":"git://github.com/nno/MOxUnit.git","ssh_url":"git@github.com:nno/MOxUnit.git","clone_url":"https://github.com/nno/MOxUnit.git","svn_url":"https://github.com/nno/MOxUnit","homepage":null,"size":126,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MOxUnit:master","ref":"master","sha":"35d5576d7f7097ef58ed39d27256d2e492acbf66","user":{"login":"MOxUnit","id":14369552,"avatar_url":"https://avatars.githubusercontent.com/u/14369552?v=3","gravatar_id":"","url":"https://api.github.com/users/MOxUnit","html_url":"https://github.com/MOxUnit","followers_url":"https://api.github.com/users/MOxUnit/followers","following_url":"https://api.github.com/users/MOxUnit/following{/other_user}","gists_url":"https://api.github.com/users/MOxUnit/gists{/gist_id}","starred_url":"https://api.github.com/users/MOxUnit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOxUnit/subscriptions","organizations_url":"https://api.github.com/users/MOxUnit/orgs","repos_url":"https://api.github.com/users/MOxUnit/repos","events_url":"https://api.github.com/users/MOxUnit/events{/privacy}","received_events_url":"https://api.github.com/users/MOxUnit/received_events","type":"Organization","site_admin":false},"repo":{"id":42809210,"name":"MOxUnit","full_name":"MOxUnit/MOxUnit","owner":{"login":"MOxUnit","id":14369552,"avatar_url":"https://avatars.githubusercontent.com/u/14369552?v=3","gravatar_id":"","url":"https://api.github.com/users/MOxUnit","html_url":"https://github.com/MOxUnit","followers_url":"https://api.github.com/users/MOxUnit/followers","following_url":"https://api.github.com/users/MOxUnit/following{/other_user}","gists_url":"https://api.github.com/users/MOxUnit/gists{/gist_id}","starred_url":"https://api.github.com/users/MOxUnit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOxUnit/subscriptions","organizations_url":"https://api.github.com/users/MOxUnit/orgs","repos_url":"https://api.github.com/users/MOxUnit/repos","events_url":"https://api.github.com/users/MOxUnit/events{/privacy}","received_events_url":"https://api.github.com/users/MOxUnit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MOxUnit/MOxUnit","description":"An xUnit framework for Matlab and GNU Octave ","fork":false,"url":"https://api.github.com/repos/MOxUnit/MOxUnit","forks_url":"https://api.github.com/repos/MOxUnit/MOxUnit/forks","keys_url":"https://api.github.com/repos/MOxUnit/MOxUnit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MOxUnit/MOxUnit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MOxUnit/MOxUnit/teams","hooks_url":"https://api.github.com/repos/MOxUnit/MOxUnit/hooks","issue_events_url":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/events{/number}","events_url":"https://api.github.com/repos/MOxUnit/MOxUnit/events","assignees_url":"https://api.github.com/repos/MOxUnit/MOxUnit/assignees{/user}","branches_url":"https://api.github.com/repos/MOxUnit/MOxUnit/branches{/branch}","tags_url":"https://api.github.com/repos/MOxUnit/MOxUnit/tags","blobs_url":"https://api.github.com/repos/MOxUnit/MOxUnit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MOxUnit/MOxUnit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MOxUnit/MOxUnit/git/refs{/sha}","trees_url":"https://api.github.com/repos/MOxUnit/MOxUnit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MOxUnit/MOxUnit/statuses/{sha}","languages_url":"https://api.github.com/repos/MOxUnit/MOxUnit/languages","stargazers_url":"https://api.github.com/repos/MOxUnit/MOxUnit/stargazers","contributors_url":"https://api.github.com/repos/MOxUnit/MOxUnit/contributors","subscribers_url":"https://api.github.com/repos/MOxUnit/MOxUnit/subscribers","subscription_url":"https://api.github.com/repos/MOxUnit/MOxUnit/subscription","commits_url":"https://api.github.com/repos/MOxUnit/MOxUnit/commits{/sha}","git_commits_url":"https://api.github.com/repos/MOxUnit/MOxUnit/git/commits{/sha}","comments_url":"https://api.github.com/repos/MOxUnit/MOxUnit/comments{/number}","issue_comment_url":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/comments{/number}","contents_url":"https://api.github.com/repos/MOxUnit/MOxUnit/contents/{+path}","compare_url":"https://api.github.com/repos/MOxUnit/MOxUnit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MOxUnit/MOxUnit/merges","archive_url":"https://api.github.com/repos/MOxUnit/MOxUnit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MOxUnit/MOxUnit/downloads","issues_url":"https://api.github.com/repos/MOxUnit/MOxUnit/issues{/number}","pulls_url":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls{/number}","milestones_url":"https://api.github.com/repos/MOxUnit/MOxUnit/milestones{/number}","notifications_url":"https://api.github.com/repos/MOxUnit/MOxUnit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MOxUnit/MOxUnit/labels{/name}","releases_url":"https://api.github.com/repos/MOxUnit/MOxUnit/releases{/id}","created_at":"2015-09-20T10:38:42Z","updated_at":"2015-12-05T01:48:49Z","pushed_at":"2015-12-11T13:23:28Z","git_url":"git://github.com/MOxUnit/MOxUnit.git","ssh_url":"git@github.com:MOxUnit/MOxUnit.git","clone_url":"https://github.com/MOxUnit/MOxUnit.git","svn_url":"https://github.com/MOxUnit/MOxUnit","homepage":null,"size":112,"stargazers_count":1,"watchers_count":1,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14"},"html":{"href":"https://github.com/MOxUnit/MOxUnit/pull/14"},"issue":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/14"},"comments":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/MOxUnit/MOxUnit/statuses/2d1aec89cf4ffa719b1971de3cab2aa338a0bd41"}}}}