使用下面的命令查看生成的模型:
"d:\Program Files\NModel\bin\mpv.exe" /r:TrainMode.dll TrainMode.WebSiteModel.CreateLoginModel
生成的模型应该如下图所示:
下图是放大后的结果:
如果查看模型以后,觉得没有问题,就可以生成测试用例了,这里先生成手工的测试用例,下一篇再介绍如何生成自动化的测试用例。
"d:\Program Files\NModel\bin\otg.exe" /r:TrainMode.dll /f:scenario.txt TrainMode.WebSiteModel.CreateLoginModel
下面是生成的测试用例:
TestSuite( TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Correct")), Login_Start(User("Administrator"), Password("Incorrect")), Logout(User("Authenticated")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Correct")), Login_Start(User("Authenticated"), Password("Correct")), Logout(User("Administrator")), Logout(User("Authenticated")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Incorrect")), Login_Start(User("Authenticated"), Password("Incorrect")) ), TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Incorrect")), Login_Start(User("Administrator"), Password("Correct")), Logout(User("Administrator")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Incorrect")), Login_Start(User("Authenticated"), Password("Correct")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Correct")), Login_Start(User("Authenticated"), Password("Incorrect")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Correct")), Logout(User("Administrator")), Login_Start(User("Authenticated"), Password("Correct")) ), TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Correct")), Logout(User("Authenticated")), Login_Start(User("Administrator"), Password("Correct")) ), TestCase( Initialize(), Login_Start(User("Administrator"), Password("Correct")), Logout(User("Administrator")), Login_Start(User("Authenticated"), Password("Incorrect")) ), TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Correct")), Login_Start(User("Administrator"), Password("Correct")), Logout(User("Authenticated")), Logout(User("Administrator")) ), TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Incorrect")), Login_Start(User("Administrator"), Password("Incorrect")) ), TestCase( Initialize(), Login_Start(User("Authenticated"), Password("Correct")), Logout(User("Authenticated")), Login_Start(User("Administrator"), Password("Incorrect")) ) ) |
原文转自:http://www.uml.org.cn/Test/201005051.asp