1. Armando Rogerio Brandão Guimarães Junior
  2. PowerBuilder
  3. Thursday, 23 January 2020 19:22 PM UTC


I would like to know how you are doing unit tests with the PowerBuilder Classic. Using PBUnit? Using PowerUnit?

Is there any forecast of being released by Appeon something that will facilitate our life as developers?

How MVPs are doing unit tests on their Classic PowerBuilder applications.


Thanks a lot.

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 21:12 PM UTC
  2. PowerBuilder
  3. # 1

For PowerBuilder projects using PowerScript language, we have some customers successfully using PBUnit.  But this is not something that we integrated so we don't provide technical support for it.

For PowerBuilder projects using C# language, we have integrated xUnit and provide technical support for this combined solution.  And since it is standard C# you can actually use any unit testing framework for .NET in case you don't want to use xUnit.  We have some customers using NUnit for example.

There are no comments made yet.
Armando Rogerio Brandão Guimarães Junior Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 21:37 PM UTC
  2. PowerBuilder
  3. # 2

Hi Armeen,
Thank you very much for the quick response, but we are migrating old projects in PowerBuilder 10 for PowerBuilder 2019, and what we need are unit tests in PowerBuilder Classic.
Is Appeon planning to have some integration of unit tests and thus support unit testing?


Thanks in advance.

  1. Armeen Mazda @Appeon
  2. Thursday, 23 January 2020 21:45 PM UTC
No plans right now but send your ideas to our product management team by emailing product@appeon.com. If we see enough demand we will consider to add. A lot of the product roadmap is driven by customer/market situation.
  1. Helpful
  1. Armando Rogerio Brandão Guimarães Junior
  2. Thursday, 23 January 2020 21:53 PM UTC
  1. Helpful
There are no comments made yet.
Aron Cox Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 05:22 AM UTC
  2. PowerBuilder
  3. # 3

I have used PBUnit in the past.

I customised it a fair bit to do some things I wanted, but most of our business logic is not in non-visual objects, and it would just take too much time to move it it. For the few we did use it for it worked pretty well at the time.

For C# code I am using nunit at the moment, but will be happy to take a look a xunit in the future.

  1. Armeen Mazda @Appeon
  2. Friday, 24 January 2020 06:10 AM UTC
Thanks for sharing your experience, and good point about most PB apps not well-suited to unit testing because business logic not properly partitioned.
  1. Helpful
  1. Armando Rogerio Brandão Guimarães Junior
  2. Friday, 24 January 2020 14:35 PM UTC
Thx Aron! ;)
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 13:37 PM UTC
  2. PowerBuilder
  3. # 4

Hi Armando, Reflecting on Aaron and Armeen's replies >

PBUnit is a worthy attempt to provide unit testing framework for PowerScript code. I'm not aware of successful competitors - except writing your own test framework tailored to your environment.


However - a word of caution before you design your first unit test but find it hard to find the "unit" to be tested >

Unless testability + high cohesion + "no accidental coupling" were always center stage during prior software design + coding - - - well, then you probably have code that is very hard to unit-test!

It has nothing to do with PowerScript. I have seen such behavior in every language I've touched (and I've touched quite a few). And it is the same problem in web-apps, stored procedures, distributed systems, mobile apps, main-frame software, and client/server.

You will probably need to invest in significant refactoring to enable unit-testing. If all your existing code is already in a structure that is easily unit-testable => Praise yourself lucky.

EXAMPLE: ItemChanged on DataWindow control in a window with embedded SQL => Mix-up of user-interface, business-logic, and data persistence.

EXAMPLE: Clicked on menu item gets data from one window, calls response window; then takes results from that response window and updated the a third window. The response window itself uses DataWindows and embedded SQL to process data. It also imports data from a text file and validates that data. => Again mix of every layer and interface imaginable.

How do you unit-test that when you fix a null object reference? It is SO HARD to start unit-testing such code. Not because code is faulty. Not because PowerScript or DataWindow is bad. No, it is caused by testability not being a focus when code was originally written.

I ALWAYS encourage a "think testing/usage first" mentality. But it may be costly to enable unit-testing due to existing code base.

HTH /Michael





  1. Miguel Leeuwe
  2. Saturday, 25 January 2020 11:56 AM UTC
FWIW, I've tried using pbunit in the past and found it much easier to just test things the "old fashion" way by executing things myself and by looking at specifications. In the end, it saves you time doing so, though you do miss all the stress-tests, memory-leaks, etc. Before you set up pbunit, you've done all your tests "manually".
  1. Helpful
  1. Michael Kramer
  2. Saturday, 25 January 2020 18:05 PM UTC
Miguel, I reflected on your comment and this Q&A in general. Soon (in a few days if not later tonight) I will create a new "Advice" thread to expose how test first has impacted my way of writing PowerScript code. Much too often I meet code implementing anti-patterns to unit-testing; and that is sad to watch when code is written now instead of 20+ years ago.

Simple stylistic changes to APIs make functions, events, and even full classes far easier to unit test.

Stay tuned.
  1. Helpful
  1. Ankur Patel
  2. Saturday, 13 February 2021 04:59 AM UTC
Hey Michael, did you get around to create that "Advice" thread? If so can you please post the link here?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.