Esempio n. 1
0
 def run(self):
     sys.path.insert(0, os.path.join(root_dir, package_dir))
     sys.path.insert(0, os.path.join(root_dir, test_dir))
     os.chdir(test_dir)
     import all_tests
     t = TextTestRunner(verbosity=2)
     t.run(all_tests.suite())
Esempio n. 2
0
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

# This module is used for version 2 of the Google Data APIs.

__author__ = '[email protected] (Jeff Scudder)'

import unittest
import all_tests
from gdata.test_config import settings

settings.RUN_LIVE_TESTS = False


def suite():
    return unittest.TestSuite((atom_tests.core_test.suite(), ))


if __name__ == '__main__':
    unittest.TextTestRunner().run(all_tests.suite())
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.


# This module is used for version 2 of the Google Data APIs.


__author__ = '[email protected] (Jeff Scudder)'


import unittest
import all_tests
from gdata.test_config import settings


settings.RUN_LIVE_TESTS = True
settings.CACHE_RESPONSES = True
settings.CLEAR_CACHE = True


def suite():
  return unittest.TestSuite((atom_tests.core_test.suite(),))


if __name__ == '__main__':
  unittest.TextTestRunner().run(all_tests.suite())
import all_tests
import HTMLTestRunner
import time




now_time = time.strftime("%Y-%m-%M-%H_%M_%S", time.localtime(time.time()))
reportPath = r"/Users/chenhang/Desktop/pythonFile/python/untitled/practice/pyhton-unittest-jenkins/report/"
filename = reportPath + now_time + 'requort.html'
fp = open(filename, 'wb')



runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title=u'测试整合报告', description=u'用例执行情况')
runner.run(all_tests.suite())



'''发送邮件'''

# 创建email_content容器
email_content = {}


# 读取最新报告路径
reportPath2 = newFile(reportPath)
email_content['reportPath'] = reportPath2
print("测试报告路径:"+"\n" + reportPath2)

# 读取最新报告内容