當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DeviceFarm.GetRun方法代碼示例

本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm.GetRun方法的典型用法代碼示例。如果您正苦於以下問題:Golang DeviceFarm.GetRun方法的具體用法?Golang DeviceFarm.GetRun怎麽用?Golang DeviceFarm.GetRun使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm的用法示例。


在下文中一共展示了DeviceFarm.GetRun方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: GetStatusOfRun

// GetStatusOfRun returns status and result of run specified by ARN
func GetStatusOfRun(client *devicefarm.DeviceFarm, arn string) (string, string) {
	params := &devicefarm.GetRunInput{
		Arn: aws.String(arn),
	}
	resp, err := client.GetRun(params)
	errors.Validate(err, "Can't get status of run")
	return *resp.Run.Status, *resp.Run.Result
}
開發者ID:artemnikitin,項目名稱:devicefarm-ci-tool,代碼行數:9,代碼來源:service.go

示例2: runStatus

/* Get Run Status */
func runStatus(svc *devicefarm.DeviceFarm, runArn string) {

	infoReq := &devicefarm.GetRunInput{
		Arn: aws.String(runArn),
	}

	resp, err := svc.GetRun(infoReq)

	failOnErr(err, "error getting run info")
	fmt.Println(*resp.Run.Status)
}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:12,代碼來源:devicefarm-cli.go

示例3: runInfo

/* Get Run Info */
func runInfo(svc *devicefarm.DeviceFarm, runArn string) {

	infoReq := &devicefarm.GetRunInput{
		Arn: aws.String(runArn),
	}

	resp, err := svc.GetRun(infoReq)

	failOnErr(err, "error getting run info")
	fmt.Println(awsutil.Prettify(resp))
}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:12,代碼來源:devicefarm-cli.go

示例4: scheduleRun


//.........這裏部分代碼省略.........
	}

	fmt.Printf("- Creating schedule run\n")
	param := make(map[string]*string)
	seed := "1234"
	throttle := "50"
	event_count := "1500"
	param["seed"] = &seed
	param["throttle"] = &throttle
	param["event_count"] = &event_count

	runTest := &devicefarm.ScheduleRunTest{
		Type: aws.String(testType),
		//TestPackageArn: aws.String(testPackageArn),
		Parameters: param, // test parameters
		//Filter: // filter to pass to tests
	}

	if debug {
		fmt.Println(appArn)
		fmt.Println(devicePoolArn)
		fmt.Println(runName)
		fmt.Println(testPackageArn)
		fmt.Println(testPackageType)
		fmt.Println(projectArn)
	}

	locale := "ja_JP"
	metered := devicefarm.BillingMethodMetered
	latitude := 35.676833
	longitude := 139.770139

	bool_true := true

	configuration := &devicefarm.ScheduleRunConfiguration{
		AuxiliaryApps: []*string{},
		BillingMethod: &metered,
		Locale:        &locale,
		Location: &devicefarm.Location{
			Latitude:  &latitude,
			Longitude: &longitude,
		},
		Radios: &devicefarm.Radios{
			Bluetooth: &bool_true,
			Gps:       &bool_true,
			Nfc:       &bool_true,
			Wifi:      &bool_true,
		},
	}

	runReq := &devicefarm.ScheduleRunInput{
		AppArn:        aws.String(appArn),
		Configuration: configuration,
		DevicePoolArn: aws.String(devicePoolArn),
		Name:          aws.String(runName),
		ProjectArn:    aws.String(projectArn),
		Test:          runTest,
	}

	if debug {
		fmt.Println(awsutil.Prettify(runReq))
	}

	fmt.Println("- Initiating test run")

	resp, err := svc.ScheduleRun(runReq)
	if err != nil {
		return err
	}

	//fmt.Println(awsutil.Prettify(resp))

	// Now we wait for the run status to go COMPLETED
	fmt.Print("- Waiting until the tests complete ")

	runArn := *resp.Run.Arn

	status := ""
	for status != "COMPLETED" {
		time.Sleep(4 * time.Second)
		infoReq := &devicefarm.GetRunInput{
			Arn: aws.String(runArn),
		}

		fmt.Print(".")
		resp, err := svc.GetRun(infoReq)

		if err != nil {
			return err
		}
		status = *resp.Run.Status
	}

	// Generate report
	fmt.Println("\n- Generating report ")
	runReport(svc, runArn)

	return nil

}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:101,代碼來源:devicefarm-cli.go

示例5: runReport

/* Get Run Report */
func runReport(svc *devicefarm.DeviceFarm, runArn string) {

	infoReq := &devicefarm.GetRunInput{
		Arn: aws.String(runArn),
	}

	resp, err := svc.GetRun(infoReq)

	failOnErr(err, "error getting run info")

	fmt.Printf("Reporting on run %s\n", *resp.Run.Name)
	fmt.Printf("Run arn %s\n", runArn)
	//fmt.Println(awsutil.Prettify(resp))

	jobReq := &devicefarm.ListJobsInput{
		Arn: aws.String(runArn),
	}

	// Find all artifacts
	artifactReq := &devicefarm.ListArtifactsInput{
		Arn: aws.String(runArn),
	}

	types := []string{"LOG", "SCREENSHOT", "FILE"}
	artifacts := map[string][]devicefarm.ListArtifactsOutput{}

	for _, artifactType := range types {

		artifactReq.Type = aws.String(artifactType)

		artifactResp, err := svc.ListArtifacts(artifactReq)
		failOnErr(err, "error getting run info")

		// Store type artifacts
		artifacts[artifactType] = append(artifacts[artifactType], *artifactResp)

	}

	respJob, err := svc.ListJobs(jobReq)
	failOnErr(err, "error getting jobs")

	// Find all jobs within this run
	for _, job := range respJob.Jobs {

		fmt.Println("==========================================")
		time.Sleep(2 * time.Second)

		jobFriendlyName := fmt.Sprintf("%s - %s - %s", *job.Name, *job.Device.Model, *job.Device.Os)

		fmt.Println(awsutil.Prettify(job))

		suiteReq := &devicefarm.ListSuitesInput{
			Arn: aws.String(*job.Arn),
		}
		suiteResp, err := svc.ListSuites(suiteReq)
		failOnErr(err, "error getting run info")

		for _, suite := range suiteResp.Suites {
			message := ""
			if suite.Message != nil {
				message = *suite.Message
			}

			debug := true
			if debug {
				fmt.Printf("%s -> %s : %s \n----> %s\n", jobFriendlyName, *suite.Name, message, *suite.Arn)
			}
			dirPrefix := fmt.Sprintf("report/%s/%s", jobFriendlyName, *suite.Name)
			downloadArtifactsForSuite(dirPrefix, artifacts, *suite)
		}

		fmt.Println(awsutil.Prettify(suiteResp))
	}

	params := &devicefarm.ListUniqueProblemsInput{
		Arn: aws.String(runArn), // Required
	}

	problems, err := svc.ListUniqueProblems(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(problems))
	problemsJson, _ := jsonutil.BuildJSON(problems)
	writeFile(problemsJson, "./report/unique_problems.json")
}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:93,代碼來源:devicefarm-cli.go

示例6: runReport

/* Get Run Report */
func runReport(svc *devicefarm.DeviceFarm, runArn string) {

	infoReq := &devicefarm.GetRunInput{
		ARN: aws.String(runArn),
	}

	resp, err := svc.GetRun(infoReq)

	failOnErr(err, "error getting run info")
	fmt.Printf("%s\n", *resp.Run.Name)
	//fmt.Println(awsutil.Prettify(resp))

	jobReq := &devicefarm.ListJobsInput{
		ARN: aws.String(runArn),
	}

	// Find all artifacts
	artifactReq := &devicefarm.ListArtifactsInput{
		ARN: aws.String(runArn),
	}

	types := []string{"LOG", "SCREENSHOT", "FILE"}
	artifacts := map[string][]devicefarm.ListArtifactsOutput{}

	for _, artifactType := range types {

		artifactReq.Type = aws.String(artifactType)

		artifactResp, err := svc.ListArtifacts(artifactReq)
		failOnErr(err, "error getting run info")

		// Store type artifacts
		artifacts[artifactType] = append(artifacts[artifactType], *artifactResp)
		/*
			for _, artifact := range artifactResp.Artifacts {
				fmt.Println(awsutil.Prettify(artifact))
			}
		*/
	}

	respJob, err := svc.ListJobs(jobReq)
	failOnErr(err, "error getting jobs")

	for _, job := range respJob.Jobs {

		fmt.Println("==========================================")
		time.Sleep(2 * time.Second)

		jobFriendlyName := fmt.Sprintf("%s - %s - %s", *job.Name, *job.Device.Model, *job.Device.Os)

		//fmt.Println(awsutil.Prettify(job))

		suiteReq := &devicefarm.ListSuitesInput{
			ARN: aws.String(*job.ARN),
		}
		suiteResp, err := svc.ListSuites(suiteReq)
		failOnErr(err, "error getting run info")

		for _, suite := range suiteResp.Suites {
			message := ""
			if suite.Message != nil {
				message = *suite.Message
			}

			fmt.Printf("%s -> %s : %s \n----> %s\n", jobFriendlyName, *suite.Name, message, *suite.ARN)
			dirPrefix := fmt.Sprintf("report/%s/%s/", jobFriendlyName, *suite.Name)
			downloadArtifactsForSuite(dirPrefix, artifacts, *suite)
		}

		//fmt.Println(awsutil.Prettify(suiteResp))
	}

}
開發者ID:dmreiland,項目名稱:devicefarm-cli,代碼行數:74,代碼來源:devicefarm-cli.go

示例7: scheduleRun


//.........這裏部分代碼省略.........

			if err != nil {
				return err
			}
			devicePoolArn = foundArn
		} else {
			return errors.New("we need a device/devicepool to run on")
		}
	}

	// Try to guess the upload type based on the filename
	/*
		if testType == "" {
			testType, err := guessTestType(testPackageFile)
		}
	*/

	testPackageType, err := lookupTestPackageType(testType)
	if err != nil {
		return err
	}

	// Upload the testPackage file if there is one
	if testPackageFile != "" {

		fmt.Printf("- Uploading test-file %s of type %s ", testPackageFile, testPackageType)

		uploadTestPackage, err := uploadPut(svc, testPackageFile, testPackageType, projectArn, "")
		if err != nil {
			return err
		}
		testPackageArn = *uploadTestPackage.ARN
		fmt.Printf("\n")
	}

	runTest := &devicefarm.ScheduleRunTest{
		Type:           aws.String(testType),
		TestPackageARN: aws.String(testPackageArn),
		//Parameters: // test parameters
		//Filter: // filter to pass to tests
	}

	if debug {
		fmt.Println(appArn)
		fmt.Println(devicePoolArn)
		fmt.Println(runName)
		fmt.Println(testPackageArn)
		fmt.Println(testPackageType)
		fmt.Println(projectArn)
	}

	runReq := &devicefarm.ScheduleRunInput{
		AppARN:        aws.String(appArn),
		DevicePoolARN: aws.String(devicePoolArn),
		Name:          aws.String(runName),
		ProjectARN:    aws.String(projectArn),
		Test:          runTest,
	}

	if debug {
		fmt.Println(awsutil.Prettify(runReq))
	}

	fmt.Println("- Initiating test run")

	resp, err := svc.ScheduleRun(runReq)
	if err != nil {
		return err
	}

	//fmt.Println(awsutil.Prettify(resp))

	// Now we wait for the run status to go COMPLETED
	fmt.Print("- Waiting until the tests complete ")

	runArn := *resp.Run.ARN

	status := ""
	for status != "COMPLETED" {
		time.Sleep(4 * time.Second)
		infoReq := &devicefarm.GetRunInput{
			ARN: aws.String(runArn),
		}

		fmt.Print(".")
		resp, err := svc.GetRun(infoReq)

		if err != nil {
			return err
		}
		status = *resp.Run.Status
	}

	// Generate report
	fmt.Println("\n- Generating report ")
	runReport(svc, runArn)

	return nil

}
開發者ID:jedi4ever,項目名稱:devicefarm-cli,代碼行數:101,代碼來源:devicefarm-cli.go


注:本文中的github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm.GetRun方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。