1. Arnaud Bailly
  2. PowerBuilder
  3. Tuesday, 17 March 2020 06:58 AM UTC

Everything is in the title but let me expand on this a little bit. I am new in PowerBuilder, working on a legacy application that we are in the process of porting to PB2019. As we are working on refactoring this application, I will direly need the ability to write unit tests. I have searched on Google and found PBunit and PowerUnit but both projects seem mostly to be abandonware. 

What are the current options for writing such tests for PowerScript code in PB2019?

Accepted Answer
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 17 March 2020 14:52 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Arnaud,

Those are the only options I am aware of at this point.  Although they haven't been updated for quite some time they are still largely workable solutions.  

However, the issue you will run into is that it's likely your application's business logic is not well partitioned.  So even if there was a well-maintained unit testing framework for PowerScript you wouldn't really be able to take advantage of it.

If you will go through the effort to partition your business logic, I would recommend convert the business logic to C# Web APIs utilizing the automated conversion tools of PowerBuilder 2019 R2.  Once the business logic is converted to C#, you can unit test with xUnit.

Regards,
Armeen

Comment
  1. Arnaud Bailly
  2. Wednesday, 18 March 2020 08:25 AM UTC
Hi Armeen,

The application we have is pretty large and involved, so I am unsure how the conversion tool will cope with such a large codebase. Are there any limitations you are aware of? Is this tool available free of charge as part of the PB license?
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Wednesday, 18 March 2020 14:50 PM UTC
Hi Arnaud, It supports non-visual code only. If you have non-visual code encapsulated in NVO then it can convert the entire NVO instead of converting function by function. It is included free of charge with a PowerBuilder CloudPro subscription (formerly called PowerBuilder Universal). I wouldn't recommend doing this purely for the reason to do unit testing... you would have to desire a Web API architecture for your apps.
  1. Helpful
There are no comments made yet.
Stefan Tischner Accepted Answer Pending Moderation
  1. Thursday, 28 May 2020 09:43 AM UTC
  2. PowerBuilder
  3. # 1

Hi Arnaud,

by accident I bumped into your question. I took PBUnit quite some years ago when it was not less abandoned than it is now. I adjusted some parts to fit my context. It's anything but cool or nice, but it has been working for testing nonvisual objects ever since and has survived all PB upgrades so far.

Regards,

Stefan

Comment
  1. Arnaud Bailly
  2. Thursday, 28 May 2020 09:50 AM UTC
Thanks Stefan. We ended up writing something in-house because it's simpler than having to deploy/learn yet another tool.



  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 17 March 2020 14:52 PM UTC
  2. PowerBuilder
  3. # 2

In my humble opinion, the answer is: "You don't". It's less work to just test everyting manually.

I know, this doesn't help much, sorry.

Comment
  1. Miguel Leeuwe
  2. Tuesday, 17 March 2020 15:48 PM UTC
Totally agree.
  1. Helpful
  1. Arnaud Bailly
  2. Wednesday, 18 March 2020 08:28 AM UTC
Thanks for your answers.

I am pretty familiar with TDD, having developed exclusively doing it for the past 10-12 years or so (in Java, Haskell, C/C++, Clojurescript, scala and now C#). Thing is unit tests are not only useful for designing an application but also for refactoring it: When one wants to refactor part of system, it's a good idea to try to write tests first which obviously forces one to refactor the code (through safe transformations) to be testable.
  1. Helpful
  1. Arnaud Bailly
  2. Wednesday, 18 March 2020 08:29 AM UTC
Michael Feather's classical book (https://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052) is treasure-trove of resources on how to restructure such legacy monsters using tests.
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.