# Testing activity retries

**URL:** <https://community.temporal.io/t/testing-activity-retries/2137>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [May 14, 2021, 6:08pm UTC](https://community.temporal.io/t/testing-activity-retries/2137 "2021-05-14T18:08:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidL](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@DavidL](https://community.temporal.io/u/DavidL)\
**Post date:** [May 14, 2021, 6:08pm UTC](https://community.temporal.io/t/testing-activity-retries/2137/1 "2021-05-14T18:08:51Z")

</div>

I’m attempting to test that a failed activity is retried. The error returned by the activity is passed back to the workflow leading me to believe the error returned by the activity is intended to be a domain-level error and not a retriable infrastructure error. Having the activity panic also doesn’t trigger the activity to be retried. Is there something akin to activity.ErrResultPending signaling a retriable error? Perhaps I’m I’m not configurations the retry policy correctly?

Thanks again for the help.

```
func Workflow(context workflow.Context) (bool, error) {
	context = workflow.WithActivityOptions(
		context,
		workflow.ActivityOptions{
			StartToCloseTimeout: 10 * time.Second,
			ScheduleToCloseTimeout: 10 * time.Second,
			RetryPolicy: &temporal.RetryPolicy{
				BackoffCoefficient: 2,
				MaximumAttempts: 3,
			},
		})
	activityExecution := workflow.ExecuteActivity(context, Activity)
	var result bool
	err := activityExecution.Get(context, &result)
	return result, err
}

var Attempts = 0

func Activity(context context.Context) (bool, error) {
	if Attempts == 0 {
		Attempts++
		println("attempt", Attempts)
		return false, errors.New("first attempt fails")
	}
	Attempts++
	println("attempt", Attempts)
	return true, nil
}

func (testSuite *MyTestSuite) TestWorkflowWaitingForActivity() {
	testSuite.env.RegisterActivity(Activity)
	testSuite.env.ExecuteWorkflow(Workflow)
	testSuite.NoError(testSuite.env.GetWorkflowError())
	testSuite.True(testSuite.env.IsWorkflowCompleted())
	testSuite.Equal(2, Attempts)
}

```

The NoError check fails with:  
`workflow execution error (type: Workflow, workflowID: default-test-workflow-id, runID: default-test-run-id): activity error (type: Activity, scheduledEventID: 0, startedEventID: 0, identity: ): first attempt fails`

---

<div class="post-metadata">

**Author:** ![Spencer\_Judge](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/spencer_judge/32/529_2.png) [@Spencer\_Judge](https://community.temporal.io/u/Spencer_Judge)\
**Post date:** [May 18, 2021, 12:20am UTC](https://community.temporal.io/t/testing-activity-retries/2137/2 "2021-05-18T00:20:49Z")

</div>

Hi @DavidL,

Looks like retries aren’t working right now in the unit test framework if the `InitialInterval` field isn’t specified in the `RetryPolicy`. If you set that to something, things will work for you. I’ve also made a task for us to fix this in the framework itself.

Thanks!

Spencer
