Skip to content

Commit 574a452

Browse files
committed
jira doc samples
1 parent 0cab698 commit 574a452

File tree

2 files changed

+303
-0
lines changed

2 files changed

+303
-0
lines changed
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
[
2+
{
3+
"fields" : {
4+
"versions" : [],
5+
"labels" : [],
6+
"duedate" : null,
7+
"timespent" : null,
8+
"timeoriginalestimate" : null,
9+
"updated" : "2017-10-24T00:32:32.000+0000",
10+
"description" : null,
11+
"lastViewed" : "2017-10-25T18:17:39.778+0000",
12+
"status" : {
13+
"name" : "To Do",
14+
"description" : "",
15+
"statusCategory" : {
16+
"name" : "To Do",
17+
"key" : "new",
18+
"colorName" : "blue-gray",
19+
"id" : 2,
20+
"self" : "<jira instance>/rest/api/2/statuscategory/2"
21+
},
22+
"iconUrl" : "<jira instance>/images/icons/status_generic.gif",
23+
"id" : "10000",
24+
"self" : "<jira instance>/rest/api/2/status/10000"
25+
},
26+
"creator" : {
27+
"active" : true,
28+
"self" : "<jira instance>/rest/api/2/user?username=admin",
29+
"displayName" : "[email protected]",
30+
"avatarUrls" : { ... },
31+
"timeZone" : "Etc/UTC",
32+
"name" : "admin",
33+
"emailAddress" : "[email protected]",
34+
"key" : "admin"
35+
},
36+
"aggregatetimespent" : null,
37+
"resolution" : null,
38+
"issuelinks" : [],
39+
"summary" : "my summary",
40+
"aggregatetimeoriginalestimate" : null,
41+
"assignee" : {
42+
"self" : "<jira instance>/rest/api/2/user?username=admin",
43+
"active" : true,
44+
"displayName" : "[email protected]",
45+
"avatarUrls" : {
46+
"16x16" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=16",
47+
"48x48" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=48",
48+
"24x24" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=24",
49+
"32x32" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=32"
50+
},
51+
"timeZone" : "Etc/UTC",
52+
"name" : "admin",
53+
"key" : "admin",
54+
"emailAddress" : "[email protected]"
55+
},
56+
"resolutiondate" : null,
57+
"fixVersions" : [],
58+
"subtasks" : [
59+
{
60+
"id" : "10449",
61+
"fields" : {
62+
"priority" : {
63+
"iconUrl" : "<jira instance>/images/icons/priorities/medium.svg",
64+
"name" : "Medium",
65+
"id" : "3",
66+
"self" : "<jira instance>/rest/api/2/priority/3"
67+
},
68+
"summary" : "asd",
69+
"status" : {
70+
"statusCategory" : {
71+
"colorName" : "blue-gray",
72+
"self" : "<jira instance>/rest/api/2/statuscategory/2",
73+
"id" : 2,
74+
"key" : "new",
75+
"name" : "To Do"
76+
},
77+
"iconUrl" : "<jira instance>/images/icons/status_generic.gif",
78+
"description" : "",
79+
"name" : "To Do",
80+
"self" : "<jira instance>/rest/api/2/status/10000",
81+
"id" : "10000"
82+
},
83+
"issuetype" : {
84+
"id" : "10000",
85+
"self" : "<jira instance>/rest/api/2/issuetype/10000",
86+
"iconUrl" : "<jira instance>/images/icons/issuetypes/subtask_alternate.png",
87+
"subtask" : true,
88+
"name" : "Sub-task",
89+
"description" : "The sub-task of the issue"
90+
}
91+
},
92+
"self" : "<jira instance>/rest/api/2/issue/10449",
93+
"key" : "TEST-351"
94+
}
95+
],
96+
"issuetype" : {
97+
"avatarId" : 10318,
98+
"self" : "<jira instance>/rest/api/2/issuetype/10001",
99+
"id" : "10001",
100+
"description" : "A task that needs to be done.",
101+
"name" : "Task",
102+
"subtask" : false,
103+
"iconUrl" : "<jira instance>/secure/viewavatar?size=xsmall&avatarId=10318&avatarType=issuetype"
104+
},
105+
"aggregateprogress" : {
106+
"total" : 0,
107+
"progress" : 0
108+
},
109+
"components" : [],
110+
"timeestimate" : null,
111+
"progress" : {
112+
"progress" : 0,
113+
"total" : 0
114+
},
115+
"watches" : {
116+
"isWatching" : true,
117+
"self" : "<jira instance>/rest/api/2/issue/TEST-2/watchers",
118+
"watchCount" : 1
119+
},
120+
"project" : {
121+
"self" : "<jira instance>/rest/api/2/project/10000",
122+
"id" : "10000",
123+
"avatarUrls" : {
124+
"16x16" : "<jira instance>/secure/projectavatar?size=xsmall&avatarId=10324",
125+
"48x48" : "<jira instance>/secure/projectavatar?avatarId=10324",
126+
"24x24" : "<jira instance>/secure/projectavatar?size=small&avatarId=10324",
127+
"32x32" : "<jira instance>/secure/projectavatar?size=medium&avatarId=10324"
128+
},
129+
"key" : "TEST",
130+
"name" : "TEST"
131+
},
132+
"workratio" : -1,
133+
"aggregatetimeestimate" : null,
134+
"priority" : {
135+
"name" : "Medium",
136+
"iconUrl" : "<jira instance>/images/icons/priorities/medium.svg",
137+
"self" : "<jira instance>/rest/api/2/priority/3",
138+
"id" : "3"
139+
},
140+
"reporter" : {
141+
"active" : true,
142+
"self" : "<jira instance>/rest/api/2/user?username=admin",
143+
"displayName" : "[email protected]",
144+
"avatarUrls" : {
145+
"24x24" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=24",
146+
"32x32" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=32",
147+
"16x16" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=16",
148+
"48x48" : "http://www.gravatar.com/avatar/4279de4b6038eb9a5318b296dc8e1c51?d=mm&s=48"
149+
},
150+
"timeZone" : "Etc/UTC",
151+
"name" : "admin",
152+
"emailAddress" : "[email protected]",
153+
"key" : "admin"
154+
},
155+
"created" : "2017-10-24T00:32:32.000+0000",
156+
"environment" : null,
157+
"votes" : {
158+
"hasVoted" : false,
159+
"self" : "<jira instance>/rest/api/2/issue/TEST-2/votes",
160+
"votes" : 0
161+
}
162+
},
163+
"id" : "10100",
164+
"self" : "<jira instance>/rest/api/2/issue/10100",
165+
"expand" : "operations,versionedRepresentations,editmeta,changelog,renderedFields",
166+
"key" : "TEST-2"
167+
}
168+
],
169+
"startAt" : 0,
170+
"total" : 1,
171+
"expand" : "names,schema",
172+
"maxResults" : 50
173+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
my @newMatchers = (
2+
# Error information that appears in the middle of junit tests:
3+
#
4+
# [junit] Testcase: test_add_failed_port took 0.717 sec
5+
# [junit] Testcase: test_checkForTimeouts took 10.43 sec
6+
# [junit] FAILED
7+
# [junit] 10218 < 1000
8+
# [junit] junit.framework.AssertionFailedError: 10218 < 1000
9+
# [junit] at com.electriccloud.http.xxx(HTTPDispatcherTest.java:128)
10+
#
11+
# [junit] Testcase: testExecute_ok took 0.321 sec
12+
#
13+
# OR...
14+
#
15+
# [junit] Testcase: testBufferProblem took 5.827 sec
16+
# [junit] Caused an ERROR
17+
# [junit] Read timed out
18+
# [junit] java.net.SocketTimeoutException: Read timed out
19+
# [junit] at java.net.SocketInputStream.socketRead0(Native Method)
20+
# [junit] at java.net.SocketInputStream.read(SocketInputStream.java:129)
21+
# [junit]
22+
# [junit] Testcase: testHttpHttps took 0.328 sec
23+
24+
{
25+
id => "junitFailureCreateDefect",
26+
pattern => q{^\s*\[junit\]\s*(FAILED|Caused an ERROR)},
27+
action => q{PostPMatchFound();},
28+
},
29+
);
30+
push @::gMatchers, @newMatchers;
31+
32+
#-------------------------------------------------------------------------
33+
# PostPMatchFound
34+
#
35+
#-------------------------------------------------------------------------
36+
sub PostPMatchFound() {
37+
debugLog("PostPMatchFound\n");
38+
39+
# First, scan back to find the "Testcase" line, and extract the
40+
# name of the test case.
41+
42+
my $testSuiteName = "";
43+
my $testCaseName = "";
44+
my $log = "";
45+
46+
my $first = backTo('\[junit\]\s+Testcase:');
47+
my $line = logLine($first + $::gCurrentLine);
48+
if ($line =~ m/\[junit\]\s*Testcase:\s*([^\s]+)/) {
49+
$testCaseName = $1;
50+
51+
# Now scan back even further to find the name of the test suite.
52+
53+
my $offset = backTo('\[junit\]\s+Testsuite:', $first-1);
54+
$line = logLine($offset + $::gCurrentLine);
55+
if ($line =~ m/\[junit\]\s+Testsuite:.*\.([^.\s]+)/) {
56+
$testSuiteName = $1;
57+
}
58+
}
59+
60+
#$log = logLine($first + forwardTo(
61+
# q{(\[junit\] Test)|^(?!.*junit)}) - 1);
62+
63+
#$first = 0 unless defined($first);
64+
my $last = forwardTo(
65+
q{(\[junit\] Test)|^(?!.*junit)}) - 1;
66+
67+
# Convert the range to actual line numbers and handle boundary conditions.
68+
69+
$first += $::gCurrentLine;
70+
$last += $::gCurrentLine;
71+
if ($first <= $::gDiagLastLine) {
72+
# Don't output lines before the beginning of the log file.
73+
# In addition, don't output lines that are before the current
74+
# line and have already been output.
75+
76+
if ($::gDiagLastLine < $::gCurrentLine) {
77+
$first = $::gDiagLastLine + 1;
78+
} elsif ($first < $::gCurrentLine) {
79+
$first = $::gCurrentLine;
80+
}
81+
}
82+
if ($last < $first) {
83+
# Make sure we output at least 1 line.
84+
85+
$last = $first;
86+
}
87+
88+
# Limit the length of diagnostic messages.
89+
90+
if (($last + 1 - $first) > $::gMaxLines) {
91+
# Too many lines. In truncating the message, try to retain
92+
# the current line.
93+
94+
my $half = $::gMaxLines/2;
95+
if (($last - $::gCurrentLine) <= $half) {
96+
$first = $last - ($::gMaxLines-1);
97+
} elsif (($::gCurrentLine - $first) <= $half) {
98+
$last = $first + ($::gMaxLines-1);
99+
} else {
100+
$first = $::gCurrentLine - $half;
101+
$last = $first + ($::gMaxLines-1);
102+
}
103+
}
104+
105+
# Collect the log lines for the new diagnostic record.
106+
107+
my $message = "";
108+
my $current = $first;
109+
while ($current <= $last) {
110+
my $line = logLine($current);
111+
if (defined($line)) {
112+
$message .= $line;
113+
} else {
114+
# End of file: ignore anything past the end of the file.
115+
116+
$last = $current - 1;
117+
last;
118+
}
119+
$current++;
120+
}
121+
122+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/stepName", "$::gJobStepName");
123+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/stepId", "$::gStepId");
124+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/testSuiteName", "$testSuiteName");
125+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/testCaseName", "$testCaseName");
126+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/testCaseResult", "Error");
127+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/log", "$message");
128+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/defectId", "");
129+
setProperty("/myJob/ecTestFailures/Step$::gStepId-$testCaseName/defectResult", "");
130+
}

0 commit comments

Comments
 (0)