Testing framework

Andrew2009

Well Known Member
I'm wondering if there's any testing framework for JDE out there? How do you test JDE apps, business functions ....etc? For example in Java, there are plenty of testing framework to perform unit test and you can create suite of test cases to run to make sure you don't break anything whenever you make changes to the code.


Are there anything similar to that for JDE and if not, how do you unit test your apps and business functions? Any strategy you recommend?


Thanks
 

BOster

Legendary Poster
I don't know of anything official. As a quick and dirty proto type I created a BSFN unit tester modeled after JUnit (I called it BFUnit). I did it as a proof of concept with the idea to come back later and "do it right". That was seven years ago and I have been using this proto-type for creating BSFN unit tests ever since and its worked pretty well. The "test runner" is just an APPL that runs as a non-Web APPL. It works like what you might expect in with JUnit in Eclipse or JDeveloper - lists all the tests with a pass/fail. You can view into the details of the test to see the JDE error stack, the details of the test, etc.

Example BFUnit APIs:
Code:
m_acmebfu_assertTrue(pTest, szAssertDesc, szErrMsg, bTest, bClearErrorStack)
m_acmebfu_assertNoErrorID(pTest, szAssertDesc, szErrMsg, szErrorID, bClearErrorStack)
m_acmebfu_assertHasErrorID(pTest, szAssertDesc, szErrMsg, szErrorID, bClearErrorStack)
m_acmebfu_assertNoErrors(pTest, szAssertDesc, szErrMsg, bWarnOk, bClearErrorStack)
m_acmebfu_assertStrSame(pTest, szAssertDesc, szErrMsg, str1, str2, bClearErrorStack)
m_acmebfu_assertMathSame(pTest, szAssertDesc, szErrMsg, pmn1, pmn2, bClearErrorStack)

Example test
Code:
m_acmebfu_GetTests(B59U9999)
{
	m_acmebfu_AddTest(I59U9999_bfu_GetAuditInfo_01, _J("Get Audit Info"), GetAuditInfo); 
}


/**************************************************************************
 I59U9999_bfu_GetAuditInfo_01
 **************************************************************************/
JDEBFRTN(void) I59U9999_bfu_GetAuditInfo_01
(LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPACMEBFU_TEST pTest)
{
	DSD9800100		dsGetAuditInfo={0};


	jdeCallObject(	_J("GetAuditInfo"), (LPFNBHVR)NULL, lpBhvrCom, lpVoid,
						&dsGetAuditInfo, (CALLMAP *)NULL, 0, (JCHAR *)NULL, (JCHAR *)NULL, 0);


	/* check error stack */
	m_acmebfu_assertNoErrors(pTest, 
		_J("Check Error Stack:  GetAuditInfo"), 
		_J("Errors Found"), 
		TRUE, TRUE);

	/* check name is returned */
	m_acmebfu_assertTrue(pTest, 
		_J("Check Non-Blank Name"), 
		_J("Name is blank"),
		!IsStringBlank(dsGetAuditInfo.szUserName),
		TRUE);
}



Might be a good candidate as some type of open source project to "do it right".
 
Last edited:
Top