![]() |
OpenWeave มีสคริปต์ Python จำนวนหนึ่งสำหรับทดสอบการทำงานของ Weave บนโทโพโลยี Happy จำลอง กรณีทดสอบเหล่านี้ช่วยให้แน่ใจว่าโทโพโลยีได้รับการกำหนดค่าอย่างเหมาะสมสำหรับการเชื่อมต่อเครือข่ายและการปรับใช้ Weave
พบสคริปต์กรณีทดสอบในที่เก็บ OpenWeave ที่ /src/test-apps/happy/tests
การทดสอบมีสองประเภท:
- บริการ - ทดสอบการเชื่อมต่อกับบริการ
- แบบสแตนด์อโลน - การทดสอบที่ทำงานบนโทโพโลยีเฉพาะที่
วิ่ง
- ติดตั้ง OpenWeave ดูคำแนะนำใน OpenWeave Build
- ติดตั้ง Happy ดูคำแนะนำในคู่มือ Happy Setup
- ไปที่ไดเร็กทอรีที่มีกรณีทดสอบเป้าหมาย ตัวอย่างเช่นในการเรียกใช้กรณีทดสอบโปรไฟล์ Echo:
cd <path-to-openweave-core>/src/test-apps/happy/tests/standalone/echo
python test_weave_echo_01.py
Change test topology
OpenWeave test cases run against the sample Happy topologies found in
/src/test-apps/happy/topologies/standalone
.
To use your own custom Happy topology in a test case:
- After constructing your custom topology, save it in JSON format. This saves
the topology state file in the
$HOME
directory:happy-state -s my_topology.json
In the test case script, locate the topology file being used. Topologies in test cases are typically assigned to the
self.topology_file
variable. For example,test_weave_echo_01.py
uses the following topology for a default OpenWeave build:self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \ "/../../../topologies/standalone/three_nodes_on_thread_weave.json"
อัปเดตพา ธ โทโพโลยีเพื่อชี้ไปยังไฟล์สถานะโทโพโลยีที่คุณกำหนดเอง:
self.topology_file = "~/my_topology.json"
หรืออีกวิธีหนึ่งคือวางไฟล์สถานะโทโพโลยีที่กำหนดเองของคุณในตำแหน่งเดียวกับที่มาพร้อมกับ OpenWeave:
self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \ "/../../../topologies/standalone/my_topology.json"