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

Hi,

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.

Who is viewing this page
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 13:37 PM
  2. PowerBuilder
  3. # 1
0
Votes
Undo

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

 

 

 

 

Comment
Trust me, Armando. Your code is very typical of code written in 1990s.

XP (Extreme Programming) introduces TDD and the concept of unit-testing. XP is published in 1999. So: Unit-testing wasn't a thing in the 1990s!

In early 2000s my project was XP inspired but customer wouldn't accept automated unit-testing and pair-programming. So we continuously peer reviewed everything: Docs + Data Models + Test Scripts + Code. And we always wrote test scripts before writing software. = "Test driven without automation". As long as we kept delivering on-time, on-budget no body complained - and customer learned the test-first mentality for future projects.
  1. Michael Kramer
  2. Friday, 24 January 2020 15:28 PM
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. Miguel Leeuwe
  2. Saturday, 25 January 2020 11:56 AM
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. Michael Kramer
  2. Saturday, 25 January 2020 18:05 PM
There are no comments made yet.
Aron Cox Accepted Answer Pending Moderation
  1. Friday, 24 January 2020 05:22 AM
  2. PowerBuilder
  3. # 2
0
Votes
Undo

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.

Comment
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. Armeen Mazda @Appeon
  2. Friday, 24 January 2020 06:10 AM
Thx Aron! ;)
  1. Armando Rogerio Brandão Guimarães Junior
  2. Friday, 24 January 2020 14:35 PM
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
  2. PowerBuilder
  3. # 3
0
Votes
Undo

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.

Comment
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. Armeen Mazda @Appeon
  2. Thursday, 23 January 2020 21:45 PM
thx
  1. Armando Rogerio Brandão Guimarães Junior
  2. Thursday, 23 January 2020 21:53 PM
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 21:12 PM
  2. PowerBuilder
  3. # 4
1
Votes
Undo

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.

Comment
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.