Quote Originally Posted by Roel Westhoff [W4] View Post
Q: I would like to know if automated testing is actually used in conjunction with Dataflex? What tools are being used?
Hi Roel,

I had the same question some time ago. So I ended up writing a tool or two myself. This is discussed in greater detail mostly in this thread. I also gave a presentation at EDUC 2016.

Here is a brief overview of automated testing for DataFlex, as I see it and use it.

Unit tests are extremely fast tests that test smaller portions of your own code. Each unit test verifies one particular expected behaviour of your code. These tests do not access the database, the file system or any network. They need to be extremely fast and test small portions of your own code. The majority of your tests should ideally be unit tests. At least for new code... Because unit tests put certain requirements on your code - you need to keep program logic and external dependencies (such as database access) separate. We use DFUnit to run our unit tests.

When you have an existing application, that is not an easy task. So you need to refactor your code to separate smaller pieces of functionality that can be run as unit tests. But in order to safely refactor your code (so you don't break existing functionality), you need regression test. These tests run larger portions of your program in the "normal" way, accessing the database and everything. I use DFUnit also for such tests, and I run a database restore script before every test run (so the tests can run on the same data every time). Then I need to decide what the results are, so I can compare it when running the same tests again after I refactor.

To make automated testing really useful, it needs to be part of an automated build process. This is part of what is called Continuous Integration (CI). Whenever a code change is checked into source control, the CI server will compile code and run the automated tests. If the compile fails or any of the tests fail, you will get feedback quickly. DFUnit can export the test results into "JUnit format" so that a CI server can interpret the test results and present them in a pretty way.

There are several categories of automated tests, and each category has its merits. But knowing what they are helps you to decide which ones are the most useful in your particular situation. But like Marco said, for new code, it's good to write your code in such a way that you can unit test it (run tests that are small, extremely fast, and do not talk to the database).

Let me finish with a comment about Selenium. This is a tool to automate the browser (UI testing, testing the app through the user interface). So that can be very useful to test the most important parts of your web app. You can write Selenium tests in any of the more common languages to test your DataFlex based web app.

UI testing of Windows apps require more manual coding, but it can be done. I am doing this in some cases for my regression tests.

I'm happy to discuss the topic further