Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lde-api-regression-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
lde-api-regression-test
Commits
749c8a23
Commit
749c8a23
authored
6 years ago
by
Hamer Iboshi
Browse files
Options
Downloads
Patches
Plain Diff
Add manager, update license and requirements
parent
ea705e53
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
manage.py
+41
-0
41 additions, 0 deletions
manage.py
regression_test.py
+21
-49
21 additions, 49 deletions
regression_test.py
requirements.txt
+1
-0
1 addition, 0 deletions
requirements.txt
with
63 additions
and
49 deletions
manage.py
0 → 100644
+
41
−
0
View file @
749c8a23
"""
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of lde-api-regression-test.
lde-api-regression-test is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
lde-api-regression-test is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with lde-api-regression-test. If not, see <https://www.gnu.org/licenses/>.
"""
from
manager
import
Manager
from
regression_test
import
RegressionTest
manager
=
Manager
()
@manager.command
def
save
(
route
=
''
):
'''
Save multiple or one CSV route
'''
rt
=
RegressionTest
(
route
)
rt
.
save
()
@manager.command
def
comparison
(
route
=
''
):
'''
Compare multiple or one CSV route
'''
rt
=
RegressionTest
(
route
)
rt
.
comparison
()
if
__name__
==
"
__main__
"
:
manager
.
main
()
This diff is collapsed.
Click to expand it.
regression_test.py
+
21
−
49
View file @
749c8a23
# Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre
#!/usr/bin/env python3
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
"""
Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
This file is part of
simcaq-node
.
This file is part of
lde-api-regression-test
.
# simcaq-node
is free software: you can redistribute it and/or modify
lde-api-regression-test
is free software: you can redistribute it and/or modify
#
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
#
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
#
(at your option) any later version.
(at your option) any later version.
# simcaq-node
is distributed in the hope that it will be useful,
lde-api-regression-test
is distributed in the hope that it will be useful,
#
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
#
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#
GNU General Public License for more details.
GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
# along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
along with lde-api-regression-test. If not, see <https://www.gnu.org/licenses/>.
"""
import
sys
import
sys
import
pandas
as
pd
import
pandas
as
pd
...
@@ -30,6 +33,7 @@ class RegressionTest:
...
@@ -30,6 +33,7 @@ class RegressionTest:
self
.
base_url
=
settings
.
BASE_URL
self
.
base_url
=
settings
.
BASE_URL
self
.
route_list
=
settings
.
BASE_ROUTE_LIST
+
settings
.
SIMCAQ_ROUTE_LIST
self
.
route_list
=
settings
.
BASE_ROUTE_LIST
+
settings
.
SIMCAQ_ROUTE_LIST
if
len
(
route
)
>
0
:
if
len
(
route
)
>
0
:
route
=
[
route
]
self
.
route_list
=
filter
(
lambda
k
:
route
[
0
]
in
k
,
self
.
route_list
)
self
.
route_list
=
filter
(
lambda
k
:
route
[
0
]
in
k
,
self
.
route_list
)
def
save
(
self
):
def
save
(
self
):
...
@@ -59,46 +63,14 @@ class RegressionTest:
...
@@ -59,46 +63,14 @@ class RegressionTest:
try
:
try
:
api_csv
=
pd
.
read_csv
(
url
,
float_precision
=
'
round_trip
'
,
encoding
=
"
utf-8-sig
"
)
#get from api
api_csv
=
pd
.
read_csv
(
url
,
float_precision
=
'
round_trip
'
,
encoding
=
"
utf-8-sig
"
)
#get from api
csv_route
=
pd
.
read_csv
(
'
route_result/
'
+
file_name
+
'
.csv
'
,
index_col
=
0
,
float_precision
=
'
round_trip
'
,
encoding
=
"
utf-8-sig
"
)
#get file
csv_route
=
pd
.
read_csv
(
'
route_result/
'
+
file_name
+
'
.csv
'
,
index_col
=
0
,
float_precision
=
'
round_trip
'
,
encoding
=
"
utf-8-sig
"
)
#get file
#print(np.array_equal(api_csv,csv_route))
if
(
csv_route
.
equals
(
api_csv
)):
#comparing csv
if
(
csv_route
.
equals
(
api_csv
)):
#compare csv
cprint
(
name
+
'
OK!
'
,
'
green
'
)
cprint
(
name
+
'
OK!
'
,
'
green
'
)
else
:
else
:
fail
+=
1
fail
+=
1
cprint
(
name
+
'
FAIL!
'
,
'
red
'
)
cprint
(
name
+
'
FAIL!
'
,
'
red
'
)
print
(
api_csv
)
# print(api_csv)
print
(
csv_route
)
# print(csv_route)
#api_csv.to_csv(name+'2.csv',encoding="utf-8-sig")
#csv_route.to_csv(name+'.csv',encoding="utf-8-sig")
#ne = pd.concat([api_csv, csv_route]).drop_duplicates(keep=False)
#print(ne)
except
Exception
as
ex
:
except
Exception
as
ex
:
cprint
(
str
(
ex
)
+
"
\n
"
+
name
+
'
FAIL!
'
,
'
red
'
)
cprint
(
str
(
ex
)
+
"
\n
"
+
name
+
'
FAIL!
'
,
'
red
'
)
fail
+=
1
fail
+=
1
cprint
(
'
TOTAL FAIL:
'
+
str
(
fail
),
'
red
'
)
cprint
(
'
TOTAL FAIL:
'
+
str
(
fail
),
'
red
'
)
\ No newline at end of file
def
main
(
argv
):
try
:
if
(
argv
[
0
]
==
'
--save
'
):
rt
=
RegressionTest
(
argv
[
1
:])
rt
.
save
()
elif
(
argv
[
0
]
==
'
--compare
'
):
rt
=
RegressionTest
(
argv
[
1
:])
rt
.
comparison
()
else
:
print
(
'
usage: regression_test.py <command>
'
)
print
(
'
commands:
'
)
print
(
'
--save #save in file the current csv response of api
'
)
print
(
'
--compare #compare the current csv response of api with last saved file of response
'
)
print
(
'
[route_name] #optional to test or save specific routes
'
)
# except:
except
Exception
as
ex
:
cprint
(
str
(
ex
)
+
"
\n
FAIL!
"
,
'
red
'
)
print
(
'
usage: regression_test.py <command>
'
)
print
(
'
commands:
'
)
print
(
'
--save #save in file the current csv response of api
'
)
print
(
'
--compare #compare the current csv response of api with last saved file of response
'
)
print
(
'
[route_name] #optional to test or save specific routes
'
)
if
__name__
==
"
__main__
"
:
main
(
sys
.
argv
[
1
:])
This diff is collapsed.
Click to expand it.
requirements.txt
+
1
−
0
View file @
749c8a23
...
@@ -4,3 +4,4 @@ python-dateutil==2.8.0
...
@@ -4,3 +4,4 @@ python-dateutil==2.8.0
pytz
==2019.1
pytz
==2019.1
six
==1.12.0
six
==1.12.0
termcolor
==1.1.0
termcolor
==1.1.0
manage.py
==0.2.10
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