blob: bc2ce2e4b7e780275041cbfdfd9e101e5aefb6bd [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001'''
2
3 TestON is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7
8 TestON is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with TestON. If not, see <http://www.gnu.org/licenses/>.
15
16
17'''
18class Assert :
19
20 def __init__(self) :
21 self.default = ''
22
23 def CASE1(self,main) :
24
25
26 main.case("Using assert to verify the result")
27 main.step("Using assert_equal to verify the result is equivalent or not")
28 expect = main.TRUE
29 actual = main.TRUE
30 main.log.warn(main.response_parser('<real></real><imag>2</imag><__complex__>true</__complex__>', "json"))
31 utilities.assert_equals(expect=expect,actual=actual,onpass="expect is equal to actual",onfail="expect is not equal to actual")
32
33 main.step("Using assert_matches to verify the result matches or not")
34 expect = "Res(.*)"
35 actual = "Result"
36 utilities.assert_matches(expect=expect,actual=actual,onpass="expect is macthes to actual",onfail="expect is not matches to actual")
37
38 main.step("Using assert_greater to verify the result greater or not")
39 expect = 10
40 actual = 5
41 utilities.assert_greater(expect=actual,actual=expect,onpass="expect is greater than the actual",onfail="expect is not greater than the actual")
42
43 main.step("Using assert_lesser to verify the result lesser or not")
44 expect = 5
45 actual = 10
46 utilities.assert_lesser(expect=actual,actual=expect,onpass="expect is lesser than the actual",onfail="expect is not lesser than the actual")