กรณีทดสอบ

ดูแหล่งที่มาบน GitHub

OpenWeave มีสคริปต์ Python จำนวนหนึ่งสำหรับการทดสอบฟังก์ชันการทำงานของ Weave ผ่านโทโพโลยี Happy จำลอง กรณีทดสอบเหล่านี้ช่วยให้แน่ใจว่าทอพอโลยีได้รับการกำหนดค่าอย่างเหมาะสมสำหรับการเชื่อมต่อเครือข่ายและการปรับใช้ Weave

สคริปต์กรณีทดสอบที่พบในพื้นที่เก็บข้อมูลที่ OpenWeave /src/test-apps/happy/tests การทดสอบมีสองประเภท:

  • บริการ - การทดสอบที่อินเตอร์เฟซที่มีการให้บริการ
  • แบบสแตนด์อโลน - การทดสอบที่ทำงานบนโครงสร้างท้องถิ่น

วิ่ง

  1. ติดตั้ง OpenWeave ดู OpenWeave รูปร่าง คู่มือสำหรับคำแนะนำ
  2. ติดตั้งแฮปปี้ ดูมีความสุข การติดตั้ง คู่มือสำหรับคำแนะนำ
  3. นำทางไปยังไดเร็กทอรีที่มีกรณีทดสอบเป้าหมาย ตัวอย่างเช่นในการเรียกใช้กรณีทดสอบรายละเอียด 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:

  1. 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
  2. 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"
    
  3. อัปเดตพาธทอพอโลยีให้ชี้ไปที่ไฟล์สถานะทอพอโลยีแบบกำหนดเองของคุณ:

    self.topology_file = "~/my_topology.json"
    
  4. หรือวางไฟล์สถานะทอพอโลยีแบบกำหนดเองของคุณในตำแหน่งเดียวกับที่อยู่ใน OpenWeave

    self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
        "/../../../topologies/standalone/my_topology.json"
    
  5. เรียกใช้กรณีทดสอบ