Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
227583a1
Commit
227583a1
authored
8 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-3505: creating targets/test-results/TEST-integration.xml
SVN: 36277
parent
c3e6500c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
integration-tests/test.py
+26
-5
26 additions, 5 deletions
integration-tests/test.py
with
26 additions
and
5 deletions
integration-tests/test.py
+
26
−
5
View file @
227583a1
...
@@ -11,7 +11,9 @@ import time
...
@@ -11,7 +11,9 @@ import time
import
settings
import
settings
from
systemtest.util
import
printAndFlush
,
renderDuration
from
systemtest.util
import
printAndFlush
,
renderDuration
startTime
=
time
.
time
()
startTime
=
time
.
time
()
testCases
=
[]
failedTestCases
=
{}
numberOfTestCases
=
0
numberOfTestCases
=
0
numberOfFailedTestCases
=
0
numberOfFailedTestCases
=
0
for
f
in
sorted
(
os
.
listdir
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))):
for
f
in
sorted
(
os
.
listdir
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))):
...
@@ -20,18 +22,37 @@ for f in sorted(os.listdir(os.path.dirname(os.path.abspath(__file__)))):
...
@@ -20,18 +22,37 @@ for f in sorted(os.listdir(os.path.dirname(os.path.abspath(__file__)))):
moduleName
=
splittedFileName
[
0
]
moduleName
=
splittedFileName
[
0
]
fileType
=
splittedFileName
[
1
]
fileType
=
splittedFileName
[
1
]
if
moduleName
.
startswith
(
'
test_
'
)
and
fileType
==
'
py
'
:
if
moduleName
.
startswith
(
'
test_
'
)
and
fileType
==
'
py
'
:
numberOfTestCases
+=
1
testCases
.
append
(
moduleName
)
try
:
try
:
__import__
(
moduleName
)
__import__
(
moduleName
)
except
:
except
:
numberOfFailedTestCases
+=
1
failedTestCases
[
moduleName
]
=
sys
.
exc_info
()
renderedStartTime
=
time
.
strftime
(
'
%Y-%m-%dT%H:%M:%S
'
,
time
.
localtime
(
startTime
))
renderedDuration
=
renderDuration
(
time
.
time
()
-
startTime
)
testResultsFolder
=
'
targets/test-results
'
if
not
os
.
path
.
exists
(
testResultsFolder
):
os
.
mkdir
(
testResultsFolder
)
with
open
(
'
targets/test-results/TEST-integration.xml
'
,
'
w
'
)
as
out
:
out
.
write
(
'
<?xml version=
"
1.1
"
encoding=
"
UTF-8
"
?>
\n
'
)
out
.
write
(
"
<testsuite name=
'
integration
'
tests=
'
%s
'
failures=
'
%s
'
errors=
'
0
'
timestamp=
'
%s
'
time=
'
%s
'
>
\n
"
%
(
len
(
testCases
),
len
(
failedTestCases
),
renderedStartTime
,
renderedDuration
))
for
testCase
in
testCases
:
if
testCase
in
failedTestCases
:
out
.
write
(
"
<testcase name=
'
%s
'
>
\n
"
%
testCase
)
out
.
write
(
"
<failure>
\n
"
)
out
.
write
(
"
%s
\n
"
%
failedTestCases
[
testCase
][
1
])
out
.
write
(
"
</failure>
\n
"
)
out
.
write
(
"
</testcase>
\n
"
)
else
:
out
.
write
(
"
<testcase name=
'
%s
'
/>
\n
"
%
testCase
)
out
.
write
(
"
</testsuite>
\n
"
)
printAndFlush
(
'
=====================================
'
)
printAndFlush
(
'
=====================================
'
)
printAndFlush
(
"
%d test cases executed in %s
"
%
(
numberOfT
estCases
,
renderDuration
(
time
.
time
()
-
startTime
)
))
printAndFlush
(
"
%d test cases executed in %s
"
%
(
len
(
t
estCases
)
,
render
ed
Duration
))
if
numberOfFailedTestCases
==
0
:
if
numberOfFailedTestCases
==
0
:
printAndFlush
(
"
no test case failed
"
)
printAndFlush
(
"
no test case failed
"
)
exit
(
0
)
exit
(
0
)
if
numberOfFailedTestCases
==
1
:
if
numberOfFailedTestCases
==
1
:
printAndFlush
(
"
1 test case failed
"
)
printAndFlush
(
"
1 test case failed
"
)
else
:
else
:
printAndFlush
(
"
%d test cases failed
"
%
numberOfF
ailedTestCases
)
printAndFlush
(
"
%d test cases failed
"
%
len
(
f
ailedTestCases
)
)
exit
(
1
)
exit
(
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment