예제 #1
0
'''
Created on 2015-7-10

@author: chinple
'''

from mtest import model, TestCaseBase, scenario


@model()
class SampleTestCase(TestCaseBase):
    @scenario(param={
        'letter': ['a', 'b', 'c'],
        'number': ['1', '2', '3'],
        'other': ['x', 'y']
    },
              where={'combine': "letter,number,other".split(",")})
    def sampleTest(self, letter, number, other):
        pass

    @scenario()
    def sampleFun(self):
        self.tlog.info("called")
        return "OK"


if __name__ == "__main__":
    from mtest import testing
    testing("-r run ")
예제 #2
0
파일: run.py 프로젝트: opama/mserver
# -*- coding: utf8 -*-
'''
Created on 2010-9-28

@author: chinple
'''
import sys
reload(sys)
eval('sys.setdefaultencoding("utf-8")')
if __name__ == "__main__":
    if len(sys.argv) <= 1:
        print("please type command: server, or direct test arguments.")
    elif sys.argv[1] == "server":
        from cserver import servering
        servering(*sys.argv[2:] if len(sys.argv) > 2 else ("-h", ))
    else:
        from mtest import testing
        testing(*sys.argv[2 if sys.argv[1] == "test" else 1:])
예제 #3
0
'''
Created on 2015-7-10

@author: chinple
'''
from mtest import adapter, model, TestCaseBase, scenario, testing


@adapter()
class TestAdapter(object):
    def callOK(self, a, b="default"):
        print("call ....")
        return ("input args", a, b)

    def printFun(self, i, j):
        print(i)


@model()
class ViewModelTest(TestCaseBase):
    @scenario(param={"letter": ['a', 'b', 'c']}, where={'combine': ['letter']})
    def modelView(self):
        adapter = TestAdapter()
        ret = adapter.callOK(123)
        adapter.printFun(ret[1], ret)
        self.tassert.areEqual(1, ret[2], "Check info")


if __name__ == "__main__":
    testing("-r mtest")
예제 #4
0
from mtest import model, TestCaseBase, scenario, testing
from db.sqllib import SqlConnFactory, Sql
from db.pysql import PymysqlConn
from db.mysqldb import MysqldbConn

@model()
class LibTest(TestCaseBase):

    @scenario()
    def testMysqldb(self):
        
        sqlConfig = {'host':'127.0.0.1', 'port':3306, 'user':'******',
            'passwd':'200123', 'charset':'utf8'}
        # {'passwd': u'200123', 'charset': 'utf8', 'db': u'msg', 'host': u'127.0.0.1', 'user': u'root', 'auto_commit': True, 'port': 3306}
        conn = SqlConnFactory(MysqldbConn, sqlConfig, 1)
        print(conn.executeSql("show tables", dbName='msg'))
        print(conn.getSql("msg", Sql.select).execute())
        
    @scenario()
    def testPymysql(self):
        
        sqlConfig = {'host':'127.0.0.1', 'port':3306, 'user':'******',
            'passwd':'200123', 'db':'msg', 'charset':'utf8', 'auto_commit':True}
        # {'passwd': u'200123', 'charset': 'utf8', 'db': u'msg', 'host': u'127.0.0.1', 'user': u'root', 'auto_commit': True, 'port': 3306}
        conn = SqlConnFactory(PymysqlConn, sqlConfig, 1)
        print(conn.executeSql("show tables"))
        print(conn.getSql("msg", Sql.select).execute())

if __name__ == "__main__":
    testing("-r debug")
예제 #5
0
        gp = CombineGroupParam(
            param, {
                'strategy':
                'product',
                'group': [{
                    'combine': ['letter', 'number'],
                    'strategy': 'product'
                }, {
                    'combine': ['other']
                }]
            }, None)
        self.checkParams(gp, 18)

        gp = CombineGroupParam(
            param, {
                'strategy':
                'product',
                'group': [{
                    'combine': ['letter', 'number'],
                    'strategy': 'add'
                }, {
                    'combine': ['other']
                }]
            }, None)
        self.checkParams(gp, 10)


if __name__ == "__main__":
    testing('-r debug -i ""')
예제 #6
0
                                receiver="@.com",
                                ccReceiver="",
                                isSetFinish=True)

    @scenario(param={}, where={})
    def testDailyReport(self):
        cp = CTestPlanAPi()
        planid = 5
        cp.sendPlandailyEmail(planid,
                              day="2017-06-27",
                              sender="",
                              receiver="@.com",
                              ccReceiver="")

    @scenario(param={}, where={})
    def testGroupReport(self):
        cp = CTestPlanAPi()
        open("testplans.html", "wb").write(
            cp.getPlanReport(ptype="",
                             inStatus=None,
                             outStatus=3,
                             fnid=6,
                             nid1=6))


if __name__ == "__main__":
    from mtest import testing
    os.chdir("..")
    cprop.load("cplan.ini")
    testing("-r run  -i testDailyReport")
예제 #7
0
파일: logTest.py 프로젝트: wanxi3/mserver
    @scenario(param={
        'letter': 'a',
        "number": 1,
        'other': 'ok'
    },
              where={
                  'combine': ['letter', 'number'],
                  'strategy': 'product'
              },
              group=[{
                  "param": {
                      'letter': ['a', 'b', 'c'],
                      'number': ['1', '2', '3']
                  }
              }, {
                  "param": {
                      'other': ['x', 'y'],
                      "test": 1
                  },
                  'combine': ['other'],
                  'strategy': 'product'
              }])
    def testParamGroup(self, letter, number, other):
        self.tlog.step(self.param.getType("letter"))


if __name__ == "__main__":
    from mtest import testing
    testing("-r param ")
예제 #8
0
    @step('C', 'A')
    def CToA(self):
        pass

    @scenario(param={
        'username': '******',
        'password': '******'
    },
              status={
                  "start": "B",
                  "coverage": "condition"
              })
    def StatusModelingSampleAnotherScenario(self):
        pass

    @scenario(param={
        'username': '******',
        'password': '******'
    },
              status={
                  "start": "S",
                  "coverage": "condition"
              })
    def StatusModelingSampleScenario(self):
        pass


if __name__ == '__main__':
    testing("-r mview")