I've been trying to play with the ABL Unit and I've wondering if I'm using the ABL Unit correctly.
I've opened a ABL Unit Type Project and have 3 .p's in this simple project.
a.p - that calls b.p
b.p - displays hello message and calls c.p
c.p - that contains a procedure(with message statement), the procedure call and a test case procedure.
My issue is that is when I attempt to run a.p in the Studio the option isn't there to run as a "Progress ABLUnit Application". Also when I run a.p using ant or as an "Progress OpenEdge Application", the message is displayed from b.p and c.p but the test case in c.p isn't run. Note, I can run c.p directly as "Progress ABLUnit Application" and the test case runs.
Now if I add to a.p:
@TestSuite(procedures="C:\Dev\MyTestProject\src\test\c.p").
the run as "Progress ABLUnit Application" is available for a.p and only the procedure c.p is run along with the test case (simple ASSERT:Equals statement) which is as documented but if c.p takes in an input parameter then a runtime error is displayed in the results for the unit test.
How can I run a test case in c.p from a.p with all the logic in-between?
Are test cases suppose to be in .p's that do not have any input parameters when using the @TestSuite annotation?
Also is there any more documentation out there that anyone has discovered (besides chapter 6 of the Developer Studio manual)?
The Run as "Progress ABLUnit Application" option won't be available for plain .p or .cls files. The files must at least contain a single test case with ABL annotations. Then only run as ABLUnit Application option will get enable. As the c.p contains, a test case procedure the option is shown for you. And as soon as you add @TestSuite(procedures="C:\Dev\MyTestProject\src\test\c.p") to a.p file, the option got enabled for you as you have added the ABLUnit test case (with ABLUnit annotation).
And as far as I know, the ABLUnit test cases won't support parameterized test cases. I am not sure of this.
Thanks,Rama.
[collapse]I've been trying to play with the ABL Unit and I've wondering if I'm using the ABL Unit correctly.
I've opened a ABL Unit Type Project and have 3 .p's in this simple project.
a.p - that calls b.p
b.p - displays hello message and calls c.p
c.p - that contains a procedure(with message statement), the procedure call and a test case procedure.
My issue is that is when I attempt to run a.p in the Studio the option isn't there to run as a "Progress ABLUnit Application". Also when I run a.p using ant or as an "Progress OpenEdge Application", the message is displayed from b.p and c.p but the test case in c.p isn't run. Note, I can run c.p directly as "Progress ABLUnit Application" and the test case runs.
Now if I add to a.p:
@TestSuite(procedures="C:\Dev\MyTestProject\src\test\c.p").
the run as "Progress ABLUnit Application" is available for a.p and only the procedure c.p is run along with the test case (simple ASSERT:Equals statement) which is as documented but if c.p takes in an input parameter then a runtime error is displayed in the results for the unit test.
How can I run a test case in c.p from a.p with all the logic in-between?
Are test cases suppose to be in .p's that do not have any input parameters when using the @TestSuite annotation?
Also is there any more documentation out there that anyone has discovered (besides chapter 6 of the Developer Studio manual)?
Flag this post as spam/abuse.
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)?
--------------------------------------------------------------------------------------
USING Progress.Lang.*.
USING OpenEdge.Core.Assert.
BLOCK-LEVEL ON ERROR UNDO, THROW.
DEFINE INPUT parameter p-char_in as character no-undo.
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:
ASSERT:Equals(vout,"dafasdsa").
END.
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)?
[/collapse]
Thanks for the reply Sanjeev,
I"m going to take your advice on seperating code from unit tests.
I'm trying to see how I can use the ABL unit testing in our existing code. In some cases we want to add a test case to an existing .p with an input parameter so it is the other way around where I want to keep the parameter in that procedure and be able to run the test case using the @TestSuite annotation so it doesn't cause the run-time error showing up in the results; because the ABLunit is looking at the input parameter that is outside the Life cycle methods you mentioned.
Also following up on what you mentioned that the ABLUnit only considers code inside life cycle methods(@Before, @After, @Setup, @TearDown) and Test methods(@Test) but in my example above the "RUN stringcat" gets called outside of any Testing annotation when I run the ABL Unit, the code in the entire procedure gets run, some times multiple times.
If I run the below code I get the following messages, "xxx" "IN HERE" "xxx" "IN HERE" "setup" "xxx" "IN HERE" "setup".
Should the two 'xxx' and any 'IN HERE' messages have been displayed since that code is outside any @ annotations?
USING OpenEdge.Core.Assert.
BLOCK-LEVEL ON ERROR UNDO, THROW.
DEFINE VARIABLE vout AS CHARACTER NO-UNDO.
DEFINE VARIABLE vhere AS CHARACTER NO-UNDO.
@Setup.
PROCEDURE Setup:
MESSAGE "setup" VIEW-AS ALERT-BOX.
END.
RUN runproc(OUTPUT vout).
vhere = "IN HERE".
MESSAGE vhere VIEW-AS ALERT-BOX.
@Test.
PROCEDURE testcase1:
ASSERT:Equals("aaa","bbb").
END.
@Test.
PROCEDURE testcase2:
ASSERT:Equals(vout,"xxx").
END.
PROCEDURE runproc:
DEFINE OUTPUT PARAMETER pout AS CHARACTER NO-UNDO.
pout = "xxx".
MESSAGE pout VIEW-AS ALERT-BOX.
END.
Thanks for the reply Sanjeev,
I"m going to take your advice on seperating code from unit tests.
I'm trying to see how I can use the ABL unit testing in our existing code. In some cases we want to add a test case to an existing .p with an input parameter so it is the other way around where I want to keep the parameter in that procedure and be able to run the test case using the @TestSuite annotation so it doesn't cause the run-time error showing up in the results; because the ABLunit is looking at the input parameter that is outside the Life cycle methods you mentioned.
Also following up on what you mentioned that the ABLUnit only considers code inside life cycle methods(@Before, @After, @Setup, @TearDown) and Test methods(@Test) but in my example above the "RUN stringcat" gets called outside of any Testing annotation when I run the ABL Unit, the code in the entire procedure gets run, some times multiple times.
If I run the below code I get the following messages, "xxx" "IN HERE" "xxx" "IN HERE" "setup" "xxx" "IN HERE" "setup".
Should the two 'xxx' and any 'IN HERE' messages have been displayed since that code is outside any @ annotations?
USING OpenEdge.Core.Assert.
BLOCK-LEVEL ON ERROR UNDO, THROW.
DEFINE VARIABLE vout AS CHARACTER NO-UNDO.
DEFINE VARIABLE vhere AS CHARACTER NO-UNDO.
@Setup.
PROCEDURE Setup:
MESSAGE "setup" VIEW-AS ALERT-BOX.
END.
RUN runproc(OUTPUT vout).
vhere = "IN HERE".
MESSAGE vhere VIEW-AS ALERT-BOX.
@Test.
PROCEDURE testcase1:
ASSERT:Equals("aaa","bbb").
END.
@Test.
PROCEDURE testcase2:
ASSERT:Equals(vout,"xxx").
END.
PROCEDURE runproc:
DEFINE OUTPUT PARAMETER pout AS CHARACTER NO-UNDO.
pout = "xxx".
MESSAGE pout VIEW-AS ALERT-BOX.
END.
Flag this post as spam/abuse.