[ ] s.sName = this.sName
[ ] s.sSex = this.sSex
[-] void printInfo()
[ ] print("{sSex} student {sName} is {iAge} years old")
[ ]
view plaincopy to clipboardprint?
01.[ ] //FileName: TestStudent.t
02.[ ] //Author: Yuetian Zeng from http://blog.csdn.net/yuetian/
03.[ ]
04.[ ] use "People.inc"
05.[ ] // declare 3 Student object
06.[ ] window Student stu1
07.[ ] window Student stu2
08.[ ] window Student stu3
09.[ ]
10.[ ]
11.[-] testcase TestStudent()
12. [ ] // initialize stu1
13. [ ] stu1.setName("Mike")
14. [ ] stu1.setAge(18)
15. [ ] stu1.setSex("Male")
16. [ ] // print stu1 data members
17. [ ] print (stu1.iAge)
18. [ ] print(stu1.sName)
文章来源于领测软件测试网 https://www.ltesting.net/