Unit testing for TMS Web Core

Dear TMS Software Team & TMS Web Core Users,

We are looking at migrating a rather large VCL DataSnap application to TMS Web Core. In the VCL application we have used DUnit against all server modules and client-side datamodules. This was more like an integration test project as the DUnit test classes used the client-side datamodules to talk to the DataSnap server.

What would be a good testing framework for TMS Web Core modules? There are quite a few JavaScript testing frameworks out there (see also here) but I don't know which one would handle our future TWebDataModules best?

Thanks for a short answer in advance.

Salut,
Mathias

We have such tool (inspired by DUnitX) for internal use.
It will require some more polish to make this a publicly usable tool though.
We will discuss this internally.

This repository is intended to be an up-to-date version of DUnit plus improvements: https://github.com/wlandgraf/dunit. It's Web Core compatible. I was able to migrate lots of existing DUnit tests I have to Web Core using this approach.

By default it outputs to the console, but it can be integrated with TestInsight so you can get your results and select the tests to be run directly from Delphi IDE.

Hello Bruno & Wagner,

Thanks for your replies.

I will have a look at the DUnit project of Wagner and see how it compares to our existing test cases. Fro what I can see at first glance it is very much a port from DUnit. So is this the same project or rather an earlier incarnation of unit testing and you have now decided to better move to a DUnitX style using attributes rather than class inheritance?

Thanks for a short answer in advance.

Salut,
Mathias

1 Like

It's just two different frameworks. I personally use DUnit in all my tests here. Never used DUnitX. In the end it paid off because it was much easier to port tests to Web Core and FPC, for example.

Hello Wagner,

I have pulled the project from GitHub to my development machine with TMS Web Core installed. I can see all your changes to support Pas2JS in the commit from 23rd April 2021. But all the example projects still use VCL.

How would a test project for a TWebDataModule look like? Does it need to be a Miletus application? Could you please add a sample project to your repository showing how to test a TWebXXX class?

Thanks for a short answer in advance.

Salut,
Mathias

The syntax is similar to a regular Delphi DUnit project. You can just create a TMS Web Core application and use this in dpr, for example:

begin
{$IFDEF TESTINSIGHT}
  TestInsight.DUnit.RunRegisteredTests;
{$ELSE}
  TextTestRunner.RunRegisteredTests;
{$ENDIF}
end.