• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python script.Test类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中net.grinder.script.Test的典型用法代码示例。如果您正苦于以下问题:Python Test类的具体用法?Python Test怎么用?Python Test使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Test类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __call__

 def __call__(self):
     grinder.statistics.delayReports = 1
     error = grinder.logger.error
     log = grinder.logger.output
         
     twitterTest = Test(201, "REST twittersoek")
     twitterRequest = twitterTest.wrap(HTTPRequest(url=baseUrl))
     
     profilbildeTest = Test(202, "REST profilbilder")
     profilbildeRequest = profilbildeTest.wrap(HTTPRequest())
     
     try:
         log("Soek etter 'Grinder' paa twitter og henter JSON-resultater")
         twitterJson = twitterRequest.GET("search.json?q=" + sokeord).text
         twitterObjekt = JSONObject(twitterJson)
         twitterResultater = twitterObjekt.getJSONArray("results")
         for i in range(0,twitterResultater.length()):
             enkeltTweet = twitterResultater.getJSONObject(i)
             brukerID = enkeltTweet.getString("from_user_id_str")
             log("Henter profilbilde for bruker:" + brukerID)
             profilbildeUrl = enkeltTweet.getString("profile_image_url")
             profilbildeRequest.GET(profilbildeUrl)
     except JSONException, ex:
         grinder.statistics.forLastTest.setSuccess(0)
         error("EXCEPTION HENDTE:")
         error(str(ex))
开发者ID:Espenhh,项目名称:Grinder-eksempel,代码行数:26,代码来源:t002json.py


示例2: __call__

 def __call__(self):
     try:
         test = Test(TestID.PTG_ASYNC, "StoRM ptg-async without release or file transfer")
         test.record(do_prepare_to_get)
         do_prepare_to_get(self.SRMclient)
     except Exception:
         error("Error executing ptg-async: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:7,代码来源:ptg_async.py


示例3: __init__

    def __init__(self, partition):
        grinder.logger.output('Selected dataset %s' % dataset_url)

        self.test = Test(Instrumented.next_test, 
                         'Partition into %d slices' % partition)

        self.test_tot = Test(100 + Instrumented.next_test,
                             'Total for %d slices' % partition)
        Instrumented.next_test += 1

        self.requests = generate_subset_requests(variable, {'time': partition})

        # Create a fresh callable to instrument
        def f(req):
            return req()
        self.test.record(f)
        self.f = f

        def f2():
            for req in self.requests:
                grinder.logger.output('Requesting %s' % req)
                data = self.f(req)
                grinder.logger.output('Data returned of shape %s' % data.shape)

        self.test_tot.record(f2)
        self.f2 = f2
开发者ID:cedadev,项目名称:dapbench,代码行数:26,代码来源:ramp_slices.py


示例4: __call__

 def __call__(self):        
     
     test = Test(1, "StoRM srmLs")
     
     client = SRMClientFactory.newSRMClient(SRM_ENDPOINT, PROXY_FILE)
     
     surl_range = range(1, random.randrange(NUM_FILES))
     surls = []
     
     for i in surl_range:
         surls.append(SURL_PREFIX + "/f" + str(i))
     
     test.record(client)
     
     log("Listing %d surls..." % surl_range[-1])
     
     res = client.srmLs(surls,
                         MAX_WAITING_TIME_IN_MSEC)
     
     log("List result: %s: %s" % (res.returnStatus.statusCode, 
                                 res.returnStatus.explanation))
     
     statuses = res.getDetails().getPathDetailArray()
     
     for s in statuses:
         log("%s -> %s" %(s.getPath(),
                          s.getStatus().getStatusCode()))
开发者ID:valerioventuri,项目名称:grinder-load-testsuite,代码行数:27,代码来源:test.py


示例5: __call__

    def __call__(self):
    # Turn off automatic reporting for the current worker thread.
    # Having done this, the script can modify or set the statistics
    # before they are sent to the log and the console.
        grinder.statistics.delayReports = 1

    # Creates a Test Suite.
    	suite = TestSuite(VoCardRequestServiceTest().getClass());
    	suite.addTestSuite(ElectoralRollRegistrationRequestServiceTest().getClass());
    	suite.addTestSuite(RequestServiceTest().getClass());
    	suite.addTestSuite(DocumentServiceTest().getClass());
    	suite.addTestSuite(FakeExternalServiceTest().getClass());
    	suite.addTestSuite(LocalReferentialServiceTest().getClass());
    	suite.addTestSuite(CategoryServiceTest().getClass());
    	#suite.addTestSuite(HomeFolderModificationRequestServiceTest().getClass());
        
    # Returns the tests as an enumeration.
        tests = suite.tests();

    # Iterate over the tests.
        testNumber = 0
        for test in tests:
            testNumber += 1
            testCase = Test(testNumber, test.getName()).wrap(suite)

            testResult = TestResult()
            testCase.runTest(test, testResult)

        if testResult.errorCount() > 0:
            grinder.statistics.success = 0
        elif testResult.failureCount() > 0:
            grinder.statistics.success = 0
开发者ID:CAP-TIC,项目名称:capdemat-sources,代码行数:32,代码来源:model.py


示例6: __call__

    def __call__(self):

        test = Test(TestID.ATLAS_RENAMING, "Atlas renaming")
        test.record(atlas_renaming)

        debug("WEBDAV_ENDPOINT: %s" % WEBDAV_ENDPOINT)

        atlas_renaming(HTTP_CLIENT)
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:8,代码来源:atlas-renaming.py


示例7: __call__

    def __call__(self):
        try:
            test = Test(TestID.MIX_DAV, "StoRM Mix WebDAV test")
            test.record(mix_dav)
            mix_dav(self.HTTP_Client, self.local_file_path)

        except Exception, e:
            error("Error executing mix-dav: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:8,代码来源:mixdav.py


示例8: __call__

 def __call__(self):
     try:
         test = Test(TestID.TXFER_OUT, "StoRM file-transfer OUT")
         test.record(file_transfer_out)
         file_transfer_out(self.SRMclient, self.HTTPclient, self.local_file_path, self.target_file_surl, self.transfer_protocol)
         cleanup(self.SRMclient, self.target_file_surl)
     except Exception, e:
         error("Error executing file-transfer-out: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:8,代码来源:ftout.py


示例9: __call__

 def __call__(self):
     if (self.isFirstRun()):
         self.initBarrier.await()
     try:
         test = Test(TestID.PUT_DAV, "StoRM PUT WebDAV test")
         test.record(put_dav)
         put_dav(self.remote_URL)
     except Exception, e:
         error("Error executing put-dav: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:9,代码来源:putdav.py


示例10: __call__

 def __call__(self):
     if (grinder.runNumber == 0):
         self.initBarrier.await()
     try:
         test = Test(TestID.GET_DAV, "StoRM GET WebDAV test")
         test.record(get_dav)
         get_dav(random.choice(FILE_URLS))
     except Exception, e:
         error("Error executing get-dav: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:9,代码来源:getdav.py


示例11: __init__

 def __init__(self):
     url_file = open(url_file_path)
     self.tests = []
     for num, url in enumerate(url_file):
         url = url.strip()
         test = Test(num, url)
         request = test.wrap(HTTPRequest())
         self.tests.append((request, url))
     url_file.close()
开发者ID:Espenhh,项目名称:jz13,代码行数:9,代码来源:test1.py


示例12: __init__

 def __init__(self):
     url_file = open(url_file_path)
     self.requests = []
     for num, line in enumerate(url_file):
         url, description = line.split(' ', 1)
         test = Test(num, description.strip())
         request_fn = request_factory(url)
         wrapped_request_fn = test.wrap(request_fn)
         self.requests.append(wrapped_request_fn)
     url_file.close()
开发者ID:kvalle,项目名称:grinder-workshop,代码行数:10,代码来源:task2-extras.py


示例13: __call__

	def __call__(self, url, client):

		test = Test(TestID.DELETE, "DELETE")
		test.record(delete)

		try:
			return delete(url, client)
		except Exception:
			error("Error executing DELETE: %s" % traceback.format_exc())
			raise
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:10,代码来源:delete.py


示例14: __call__

	def __call__(self, src_url, dest_url, client):

		test = Test(TestID.MOVE, "MOVE")
		test.record(move)

		try:
			return move(src_url, dest_url, client)
		except Exception:
			error("Error executing MOVE: %s" % traceback.format_exc())
			raise
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:10,代码来源:move.py


示例15: __call__

    def __call__(self):
        try:
            test = Test(TestID.RM_MULTI, "StoRM srmRm multiple calls")
            test.record(rm_files)

            surls = setup(SRM_CLIENT, TEST_NUMFILES)
            rm_files(SRM_CLIENT, surls)

        except Exception, e:
            error("Error executing rm-multi: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:10,代码来源:rm_multi_files.py


示例16: __call__

	def __call__(self, url, client):

		test = Test(TestID.MKCOL, "MKCOL")
		test.record(mkcol)

		try:
			return mkcol(url, client)
		except Exception:
			error("Error executing MKCOL: %s" % traceback.format_exc())
			raise
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:10,代码来源:mkcol.py


示例17: __init__

 def __init__(self):
     url_file = open(url_file_path)
     self.tests = []
     for num, url in enumerate(url_file):
         url = url.strip()
         test = Test(num, url)
         request = test.wrap(HTTPRequest())
         self.tests.append((request, url))
     url_file.close()
     grinder.statistics.setDelayReports(True)
开发者ID:kvalle,项目名称:grinder-workshop,代码行数:10,代码来源:task3.py


示例18: __call__

 def __call__(self):    
     
     (ks,cert,key) = get_random_certificate()
     log("Cert: %s" % ks)
     grinder.SSLControl.setKeyStoreFile(ks,KEYSTORE_PASSWORD)
     
     test  = Test(1, "Admin legacy connector request")
     req = HTTPRequest()
     test.record(req)
                      
     url="https://"+HOST+":"+str(PORT)+"/generate-ac"
      
     req.GET(url)
      
     req2= HTTPRequest()
     test2 = Test(2, "Admin 8443 connector request")
     test2.record(req2)
      
     url2="https://"+HOST+":8443/voms/mysql/generate-ac"
     req2.GET(url2)
     
     legacy = LegacyVOMSRequestResponse(HOST,PORT,"mysql")
     test3 = Test(3, "Admin legacy request")
     test3.record(legacy)
     
     output = legacy()
     log("legacy response: %s" % output)
开发者ID:dandreotti,项目名称:stress-testsuite,代码行数:27,代码来源:admin_test.py


示例19: __call__

    def __call__(self):
        try:
            test = Test(TestID.PTP_SYNC_PD, "StoRM PTP Sync test")
            test.record(ptp_sync)

            file_name = ptp_sync(SRM_CLIENT)
            cleanup(SRM_CLIENT, file_name)

        except Exception, e:
            error("Error executing ptp-sync: %s" % traceback.format_exc())
            raise
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:11,代码来源:ptp-sync.py


示例20: __call__

	def __call__(self):
		try:
			if (SETUP_ONCE != "yes"):
				self.target_file_surl = setup(self.SRMclient)
			test = Test(TestID.TXFER_IN, "StoRM file-transfer IN")
			test.record(file_transfer_in)
			file_transfer_in(self.SRMclient, self.HTTPclient, self.target_file_surl, TRANSFER_PROTOCOL)
			if (SETUP_ONCE != "yes"):
				cleanup(self.SRMclient, self.target_file_surl)
		except Exception, e:
			error("Error executing file-transfer-in: %s" % traceback.format_exc())
开发者ID:italiangrid,项目名称:grinder-load-testsuite,代码行数:11,代码来源:ftin.py



注:本文中的net.grinder.script.Test类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python grinder.sleep函数代码示例发布时间:2022-05-27
下一篇:
Python http.HTTPPluginControl类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap