Forum Post: RE: ABL Unit Test case in a called .p

  • Thread starter Thread starter Sanjeev Reddy
  • Start date Start date
Status
Not open for further replies.
S

Sanjeev Reddy

Guest
Hi, When you run any ABL file as ABLUnit application, it only considers code inside life cycle methods(@Before, @After, @Setup, @TearDown) and Test methods(@Test). It won’t consider any other code. So, if you want to access input variable in your code then you have use that variable in any particular Test method or in Life cycle methods. I have modified your code a little bit to run as ABLUnit application, Now you can run this as OpenEdge Application or ABLUnit Application: BLOCK-LEVEL ON ERROR UNDO , THROW . USING OpenEdge.Core.Assert FROM PROPATH . @Setup. PROCEDURE setUp: /*------------------------------------------------------------------------------ Purpose: Notes: ------------------------------------------------------------------------------*/ DEFINE INPUT PARAMETER p-char_in AS CHARACTER NO-UNDO . END PROCEDURE . DEFINE VARIABLE vout AS CHARACTER NO-UNDO . RUN stringcat ( OUTPUT vout). PROCEDURE stringcat: DEFINE OUTPUT PARAMETER vout AS CHARACTER NO-UNDO . DEF VAR x AS CHAR NO-UNDO . DEF VAR vAcctExtXSD AS CHAR NO-UNDO INITIAL "qwerty" . x = 'AccountExtract ' + vAcctExtXSD. vout = x . DISPLAY x VIEW-AS EDITOR SIZE 60 BY 40 . END PROCEDURE . @Test. PROCEDURE teststringcat: DEFINE VARIABLE strcat AS CHARACTER NO-UNDO . RUN stringcat( OUTPUT strcat). ASSERT:Equals(strcat, "dafasdsa" ). END . By the way, it’s always better to separate actual code and unit tests. Hope this helps, Sanjeev. From: TrueDon [mailto:bounce-TrueDon@community.progress.com] Sent: 27 May 2015 PM 10:05 To: TU.OE.Development@community.progress.com Subject: RE: [Technical Users - OE Development] ABL Unit Test case in a called .p RE: ABL Unit Test case in a called .p Reply by TrueDon Thanks Rama, So from what I understand with my example: a.p --calls-- b.p --calls-- c.p(ablunit @Test), There is no way to run the test in c.p from a.p without using the @TestSuite which will exclude any business logic in b.p. In the example I mentioned, the test case wasn't parameterized the procedure c.p contained the input parameter. See Highlighted below. The error is when we add @TestSuite(procedures="C:\Dev\MyTestProject\src\test\c.p") to a.p file and c.p has the input parameter below. Am I correct is assuming that in this case there is no way to run the test in c.p (below)?

Continue reading...
 
Status
Not open for further replies.
Back
Top