Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lwjTest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
王萌
lwjTest
Commits
4a947b59
Commit
4a947b59
authored
Jun 14, 2022
by
wangmeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default Changelist
parent
2e2f0b00
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
11 deletions
+17
-11
apps/apiTest/serializers.py
apps/apiTest/serializers.py
+1
-0
lwjTest.ini
lwjTest.ini
+1
-1
utils/testGenerateManySuite.py
utils/testGenerateManySuite.py
+5
-3
utils/testManySuite.py
utils/testManySuite.py
+5
-3
utils/testSingleSuite.py
utils/testSingleSuite.py
+5
-4
No files found.
apps/apiTest/serializers.py
View file @
4a947b59
...
...
@@ -96,6 +96,7 @@ class ApiSerializer(serializers.ModelSerializer):
instance
.
data
=
validated_data
.
get
(
'data'
,
instance
.
data
)
instance
.
description
=
validated_data
.
get
(
'description'
,
instance
.
description
)
instance
.
expect_code
=
validated_data
.
get
(
'expect_code'
,
instance
.
expect_code
)
instance
.
headers
=
validated_data
.
get
(
'headers'
,
instance
.
headers
)
instance
.
expect_content
=
validated_data
.
get
(
'expect_content'
,
instance
.
expect_content
)
instance
.
save
()
# 删除api的全局参数和用例API的响应参数提取再新增
...
...
lwjTest.ini
View file @
4a947b59
[uwsgi]
chdir
=
/app
wsgi-file
=
fusion
Test/wsgi.py
wsgi-file
=
lwj
Test/wsgi.py
master
=
True
processes
=
4
harakiri
=
7200
...
...
utils/testGenerateManySuite.py
View file @
4a947b59
...
...
@@ -18,7 +18,7 @@ BASE_PATH=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# import django
# django.setup()
import
datetime
def
get_discover
():
report_time
=
time
.
strftime
(
"%Y-%m-%d-%H-%M-%S"
,
time
.
localtime
())
test_suite
=
unittest
.
defaultTestLoader
.
discover
(
"utils"
,
pattern
=
'testGenerateManyCase.py'
)
...
...
@@ -36,6 +36,8 @@ def get_discover():
)
curpath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
# 获取文件当前路径
yamlpath
=
os
.
path
.
join
(
curpath
,
"case.yaml"
)
# 获取yaml文件地址
today
=
datetime
.
datetime
.
now
().
replace
(
microsecond
=
0
)
times
=
today
-
datetime
.
timedelta
(
days
=
0
)
data
=
{
"project_name"
:
"fusion_report-{}"
.
format
(
report_time
),
"project_host"
:
"staging"
,
...
...
@@ -43,9 +45,9 @@ def get_discover():
"case_all"
:
result
.
testsRun
,
"case_pass"
:
result
.
success_count
,
"case_fail"
:
result
.
failure_count
,
"start_time"
:
result
.
begin_time
,
"start_time"
:
str
(
times
)
,
"run_time"
:
result
.
fields
[
'totalTime'
],
"report_details"
:
HOST
+
"/report/fusion_http_report-{}.html
/
"
.
format
(
report_time
)
"report_details"
:
HOST
+
"/report/fusion_http_report-{}.html"
.
format
(
report_time
)
}
with
open
(
yamlpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
yaml
.
dump
(
data
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
...
...
utils/testManySuite.py
View file @
4a947b59
...
...
@@ -7,7 +7,7 @@ from BeautifulReport import BeautifulReport
from
lwjTest.settings
import
*
BASE_PATH
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
import
os
import
datetime
# if not os.environ.get('DJANGO_SETTINGS_MODULE'):
# os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo3.settings')
...
...
@@ -33,6 +33,8 @@ def get_discover():
)
curpath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
# 获取文件当前路径
yamlpath
=
os
.
path
.
join
(
curpath
,
"case.yaml"
)
# 获取yaml文件地址
today
=
datetime
.
datetime
.
now
().
replace
(
microsecond
=
0
)
times
=
today
-
datetime
.
timedelta
(
days
=
0
)
data
=
{
"project_name"
:
"fusion_report-{}"
.
format
(
report_time
),
"project_host"
:
"staging"
,
...
...
@@ -40,9 +42,9 @@ def get_discover():
"case_all"
:
result
.
testsRun
,
"case_pass"
:
result
.
success_count
,
"case_fail"
:
result
.
failure_count
,
"start_time"
:
result
.
begin_times
,
"start_time"
:
str
(
times
)
,
"run_time"
:
result
.
fields
[
'totalTime'
],
"report_details"
:
HOST
+
"/
lwjTest/templates/
report/fusion_http_report-{}.html"
.
format
(
report_time
)
"report_details"
:
HOST
+
"/report/fusion_http_report-{}.html"
.
format
(
report_time
)
}
with
open
(
yamlpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
yaml
.
dump
(
data
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
...
...
utils/testSingleSuite.py
View file @
4a947b59
...
...
@@ -7,7 +7,7 @@ from BeautifulReport import BeautifulReport
from
lwjTest.settings
import
*
BASE_PATH
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
import
os
import
datetime
# if not os.environ.get('DJANGO_SETTINGS_MODULE'):
# os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo3.settings')
...
...
@@ -32,7 +32,8 @@ def get_discover():
)
curpath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
# 获取文件当前路径
yamlpath
=
os
.
path
.
join
(
curpath
,
"case.yaml"
)
# 获取yaml文件地址
logger
.
info
(
result
.
begin_times
)
today
=
datetime
.
datetime
.
now
().
replace
(
microsecond
=
0
)
times
=
today
-
datetime
.
timedelta
(
days
=
0
)
data
=
{
"project_name"
:
"fusion_report-{}"
.
format
(
report_time
),
"project_host"
:
"staging"
,
...
...
@@ -41,9 +42,9 @@ def get_discover():
"case_pass"
:
result
.
success_count
,
"case_fail"
:
result
.
failure_count
,
# "start_time":result.begin_times,
"start_time"
:
"2022/5/23 10:00:00"
,
"start_time"
:
str
(
times
)
,
"run_time"
:
result
.
fields
[
'totalTime'
],
"report_details"
:
HOST
+
"/
lwjTest/templates/
report/fusion_http_report-{}.html"
.
format
(
report_time
)
"report_details"
:
HOST
+
"/report/fusion_http_report-{}.html"
.
format
(
report_time
)
}
with
open
(
yamlpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
yaml
.
dump
(
data
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment