func TestChainedTestCases(t *testing.T) {
	manifest, err := loadManifest("testdata/passAccountId.json")
	require.NoError(t, err)

	rule := manifest.Rules[0] // get the first rule
	executor := &executor{}   // Allows rule testcase execution strategies to be dynamically added to rules
	rulectx := Context{}      // create a context to hold the passed parameters
	tc01 := rule.Tests[0][0]  // get the first testcase of the first rule
	tc01.Validator = schema.NewNullValidator()
	req, err := tc01.Prepare(&rulectx) // Prepare calls ApplyInput and ApplyContext on testcase
	require.NoError(t, err)
	resp, err := executor.ExecuteTestCase(req, &tc01, &rulectx) // send the request to be executed resulting in a response
	assert.NoError(t, err)
	result, errs := tc01.Validate(resp, &rulectx) // Validate checks response against the match rules and processes any contextPuts present
	assert.Nil(t, errs)
	assert.True(t, result)

	tc02 := rule.Tests[0][1] // get the second testcase of the first rule
	tc02.Validator = schema.NewNullValidator()
	req, err = tc02.Prepare(&rulectx) // Prepare
	assert.NoError(t, err)
	resp, err = executor.ExecuteTestCase(req, &tc02, &rulectx) // Execute
	assert.NoError(t, err)
	result, errs = tc02.Validate(resp, &rulectx) // Validate checks the match rules and processes any contextPuts present
	assert.Nil(t, errs)
	assert.True(t, result)
	acctid, exist := rulectx.Get("AccountId")
	assert.True(t, exist)
	assert.Equal(t, "500000000000000000000007", acctid)
	assert.Equal(t, "http://myaspsp/accounts/500000000000000000000007", tc02.Input.Endpoint)
}
/*
As a developer I want to perform a test where I load some json which defines a manifest, rule and testcases
I want the rule to manage the execution of the test that includes two test cases
I want the testcases to communicate parameters between themselves using a context
I want the results of one test case being used as input to the other testcase
I want to use json pattern matching to extract the first returned AccountId from the first testcase and
use that value as the accountid parameter for the second testcase
*/
As a developer I want to perform a test where I load some json which defines a manifest, rule and testcases
I want the rule to manage the execution of the test that includes two test cases
I want the testcases to communicate parameters between themselves using a context
I want the results of one test case being used as input to the other testcase
I want to use json pattern matching to extract the first returned AccountId from the first testcase and
use that value as the accountid parameter for the second testcase
/ * As a developer I want to perform a test where I load some json which defines a manifest rule and testcases I want the rule to manage the execution of the test that includes two test cases I want the testcases to communicate parameters between themselves using a context I want the results of one test case being used as input to the other testcase I want to use json pattern matching to extract the first returned AccountId from the first testcase and use that value as the accountid parameter for the second testcase * /
func TestChainedTestCases(t *testing.T) {
	manifest, err := loadManifest("testdata/passAccountId.json")
	require.NoError(t, err)
	rule := manifest.Rules[0] 
	executor := &executor{}   
	rulectx := Context{}      
	tc01 := rule.Tests[0][0]  
	tc01.Validator = schema.NewNullValidator()
	req, err := tc01.Prepare(&rulectx) 
	require.NoError(t, err)
	resp, err := executor.ExecuteTestCase(req, &tc01, &rulectx) 
	assert.NoError(t, err)
	result, errs := tc01.Validate(resp, &rulectx) 
	assert.Nil(t, errs)
	assert.True(t, result)
	tc02 := rule.Tests[0][1] 
	tc02.Validator = schema.NewNullValidator()
	req, err = tc02.Prepare(&rulectx) 
	assert.NoError(t, err)
	resp, err = executor.ExecuteTestCase(req, &tc02, &rulectx) 
	assert.NoError(t, err)
	result, errs = tc02.Validate(resp, &rulectx) 
	assert.Nil(t, errs)
	assert.True(t, result)
	acctid, exist := rulectx.Get("AccountId")
	assert.True(t, exist)
	assert.Equal(t, "500000000000000000000007", acctid)
	assert.Equal(t, "http://myaspsp/accounts/500000000000000000000007", tc02.Input.Endpoint)
}
func TestChainedTestCases ( t * testing . T ) { manifest , err := loadManifest ( " " ) require . NoError ( t , err ) rule := manifest . Rules [ 0 ] executor := & executor { } rulectx := Context { } tc01 := rule . Tests [ 0 ] [ 0 ] tc01 . Validator = schema . NewNullValidator ( ) req , err := tc01 . Prepare ( & rulectx ) require . NoError ( t , err ) resp , err := executor . ExecuteTestCase ( req , & tc01 , & rulectx ) assert . NoError ( t , err ) result , errs := tc01 . Validate ( resp , & rulectx ) assert . Nil ( t , errs ) assert . True ( t , result ) tc02 := rule . Tests [ 0 ] [ 1 ] tc02 . Validator = schema . NewNullValidator ( ) req , err = tc02 . Prepare ( & rulectx ) assert . NoError ( t , err ) resp , err = executor . ExecuteTestCase ( req , & tc02 , & rulectx ) assert . NoError ( t , err ) result , errs = tc02 . Validate ( resp , & rulectx ) assert . Nil ( t , errs ) assert . True ( t , result ) acctid , exist := rulectx . Get ( " " ) assert . True ( t , exist ) assert . Equal ( t , " " , acctid ) assert . Equal ( t , " " , tc02 . Input . Endpoint ) }
As a developer I want to perform a test where I load some json which defines a manifest, rule and testcases
I want the rule to manage the execution of the test that includes two test cases
I want the testcases to communicate parameters between themselves using a context
I want the results of one test case being used as input to the other testcase
I want to use json pattern matching to extract the first returned AccountId from the first testcase and
use that value as the accountid parameter for the second testcase
As a developer I want to perform a test where I load some json which defines a manifest rule and testcases I want the rule to manage the execution of the test that includes two test cases I want the testcases to communicate parameters between themselves using a context I want the results of one test case being used as input to the other testcase I want to use json pattern matching to extract the first returned AccountId from the first testcase and use that value as the accountid parameter for the second testcase
// get the first rule // Allows rule testcase execution strategies to be dynamically added to rules // create a context to hold the passed parameters // get the first testcase of the first rule // Prepare calls ApplyInput and ApplyContext on testcase // send the request to be executed resulting in a response // Validate checks response against the match rules and processes any contextPuts present // get the second testcase of the first rule // Prepare // Execute // Validate checks the match rules and processes any contextPuts present