Skip to content

Commit 42f8271

Browse files
author
Aravindhan Palanisamy
committed
update test constant
1 parent 82de1be commit 42f8271

File tree

5 files changed

+129
-18
lines changed

5 files changed

+129
-18
lines changed

examples/test_plan/test_plan_templates.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
from nisystemlink.clients.test_plan import TestPlanClient
33
from nisystemlink.clients.test_plan.models import (
44
CreateTestPlanTemplateRequest,
5+
Dashboard,
6+
Job,
7+
JobExecution,
8+
ManualExecution,
59
QueryTestPlanTemplatesRequest,
610
)
711

@@ -18,7 +22,34 @@
1822
CreateTestPlanTemplateRequest(
1923
name="Python integration test plan template",
2024
template_group="sample template group",
21-
workspace="YourWorksapceId",
25+
product_families=["FamilyA", "FamilyB"],
26+
part_numbers=["PN-1001", "PN-1002"],
27+
summary="Template for running integration test plans",
28+
description="This template defines execution steps for integration workflows.",
29+
test_program="TP-INT-002",
30+
estimated_duration_in_seconds=86400,
31+
system_filter="os:linux AND arch:x64",
32+
execution_actions=[
33+
ManualExecution(action="boot", type="MANUAL"),
34+
JobExecution(
35+
action="run",
36+
type="JOB",
37+
jobs=[
38+
Job(
39+
functions=["run_test_suite"],
40+
arguments=[["test_suite.py"]],
41+
metadata={"env": "staging"},
42+
)
43+
],
44+
systemId="system-001",
45+
),
46+
],
47+
file_ids=["file1", "file2"],
48+
# workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa",
49+
properties={"env": "staging", "priority": "high"},
50+
dashboard=Dashboard(
51+
id="DashBoardId", variables={"product": "PXIe-4080", "location": "Lab1"}
52+
),
2253
)
2354
]
2455

examples/test_plan/test_plans.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
from nisystemlink.clients.test_plan import TestPlanClient
33
from nisystemlink.clients.test_plan.models import (
44
CreateTestPlanRequest,
5+
Dashboard,
6+
Job,
7+
JobExecution,
8+
ManualExecution,
59
QueryTestPlansRequest,
610
ScheduleTestPlanRequest,
711
ScheduleTestPlansRequest,
@@ -18,7 +22,38 @@
1822

1923
create_test_plans_request = [
2024
CreateTestPlanRequest(
21-
name="Python integration test plan", state="NEW", partNumber="px40482"
25+
name="Python integration test plan",
26+
# template_id="Python Sample Id",
27+
state="NEW",
28+
description="Test plan for verifying integration flow",
29+
assigned_to="[email protected]",
30+
# work_order_id="Sample-Work-Order",
31+
estimated_duration_in_seconds=86400,
32+
properties={"env": "staging", "priority": "high"},
33+
part_number="px40482",
34+
dut_id="Sample-Dut_Id",
35+
test_program="TP-Integration-001",
36+
system_filter="os:linux AND arch:x64",
37+
# workspace="IntegrationWorkspace",
38+
file_ids_from_template=["file1", "file2"],
39+
dashboard=Dashboard(
40+
id="DashBoardId", variables={"product": "PXIe-4080", "location": "Lab1"}
41+
),
42+
execution_actions=[
43+
ManualExecution(action="boot", type="MANUAL"),
44+
JobExecution(
45+
action="run",
46+
type="JOB",
47+
jobs=[
48+
Job(
49+
functions=["run_test_suite"],
50+
arguments=[["test_suite.py"]],
51+
metadata={"env": "staging"},
52+
)
53+
],
54+
systemId="system-001",
55+
),
56+
],
2257
)
2358
]
2459

nisystemlink/clients/test_plan/models/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
from ._order_by import OrderBy
1313
from ._test_plan import TestPlan
1414
from ._state import State
15-
from ._execution_definition import ExecutionDefinition
15+
from ._execution_definition import (
16+
ExecutionDefinition,
17+
ManualExecution,
18+
JobExecution,
19+
NoneExecution,
20+
NotebookExecution,
21+
Job,
22+
)
1623
from ._schedule_test_plans_request import ScheduleTestPlansRequest
1724
from ._schedule_test_plan_request import ScheduleTestPlanRequest
1825
from ._schedule_test_plans_response import ScheduleTestPlansResponse

nisystemlink/clients/test_plan/models/_test_plan_templates.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,10 @@
33

44
from nisystemlink.clients.core._uplink._json_model import JsonModel
55

6+
from ._dashboard import Dashboard
67
from ._execution_definition import ExecutionDefinition
78

89

9-
class Dashboard(JsonModel):
10-
"""Contains information about a reference of a dashboard linked to test plan template."""
11-
12-
id: Optional[str] = None
13-
"""The globally unique id of the dashboard."""
14-
15-
variables: Optional[Dict[str, str]] = None
16-
"""Dictionary of variables set on the dashboard.
17-
These will be appended to the URL as query parameters.
18-
Each key will be prefixed with "var-" and the value will be the value of the variable.
19-
"""
20-
21-
2210
class TestPlanTemplateBase(JsonModel):
2311
"""Contains information about a test plan template."""
2412

tests/integration/test_plan/test_test_plan_client.py

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
CreateTestPlansPartialSuccessResponse,
1010
CreateTestPlanTemplatePartialSuccessResponse,
1111
CreateTestPlanTemplateRequest,
12+
Dashboard,
13+
Job,
14+
JobExecution,
15+
ManualExecution,
1216
PagedTestPlanTemplates,
1317
QueryTestPlansRequest,
1418
QueryTestPlanTemplatesRequest,
@@ -93,9 +97,44 @@ def _create_test_plan_templates(
9397
@pytest.mark.enterprise
9498
class TestTestPlanClient:
9599

100+
_dashboard = Dashboard(
101+
id="DashBoardId", variables={"product": "PXIe-4080", "location": "Lab1"}
102+
)
103+
104+
_execution_actions = [
105+
ManualExecution(action="boot", type="MANUAL"),
106+
JobExecution(
107+
action="run",
108+
type="JOB",
109+
jobs=[
110+
Job(
111+
functions=["run_test_suite"],
112+
arguments=[["test_suite.py"]],
113+
metadata={"env": "staging"},
114+
)
115+
],
116+
systemId="system-001",
117+
),
118+
]
119+
96120
_test_plan_create = [
97121
CreateTestPlanRequest(
98-
name="Python integration test plan", state="NEW", part_number="px40482"
122+
name="Python integration test plan",
123+
# template_id="Python Sample Id",
124+
state="NEW",
125+
description="Test plan for verifying integration flow",
126+
assigned_to="[email protected]",
127+
# work_order_id="Sample-Work-Order",
128+
estimated_duration_in_seconds=86400,
129+
properties={"env": "staging", "priority": "high"},
130+
part_number="px40482",
131+
dut_id="Sample-Dut_Id",
132+
test_program="TP-Integration-001",
133+
system_filter="os:linux AND arch:x64",
134+
# workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa",
135+
file_ids_from_template=["file1", "file2"],
136+
dashboard=_dashboard,
137+
execution_actions=_execution_actions,
99138
)
100139
]
101140
"""create test plan request object."""
@@ -104,7 +143,18 @@ class TestTestPlanClient:
104143
CreateTestPlanTemplateRequest(
105144
name="Python integration test plan template",
106145
template_group="sample template group",
107-
workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa",
146+
product_families=["FamilyA", "FamilyB"],
147+
part_numbers=["PN-1001", "PN-1002"],
148+
summary="Template for running integration test plans",
149+
description="This template defines execution steps for integration workflows.",
150+
test_program="TP-INT-002",
151+
estimated_duration_in_seconds=86400,
152+
system_filter="os:linux AND arch:x64",
153+
execution_actions=_execution_actions,
154+
file_ids=["file1", "file2"],
155+
# workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa",
156+
properties={"env": "staging", "priority": "high"},
157+
dashboard=_dashboard,
108158
)
109159
]
110160
"""create test plan template request object."""

0 commit comments

Comments
 (0)