Jump to content

Wagner Landgraf

Members
  • Content Count

    128
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Wagner Landgraf


  1. Of course no one is forcing me! 🙂  It's just it's a nice tool with several benefits that I'd love to use. I will see what I will do.

     

    My case is different, I also use test inheritance when applicable but as I said, in my case I have hundreds of tests, spread over different TTestCase objects because it makes sense - logical grouping, different setup and teardown mechanisms, etc. Then all of those tests are grouped by decorators to work with different "Setups" - different databases, for example. So they are actually the same test, even double clicking won't solve because they will all point to the same source code.

     

     


  2. 1. This is (almost) a showstopper for me, unless I'm not fully understanding or building my tests wrongly. The thing is TMS Aurelius for example has thousands and thousands of tests. Reason is tests are replicated in several scenarios: for MySQL, for SQL Server, for Oracle, using RemoteDB, not using RemoteDB, etc.. Thus information about hierarchy is a must to understand which tests failed in which situation (the test was a "SaveBlob", but was it with SQL Server or Firebird? Using RemoteDB? Etc.) Not sure if there is an alternative way to do so or TI was not built for such scenario?

     

    2. Ok, I will check it again with more attention.

     

    3. Ok, I will check it also, thanks a lot.


  3. Thanks @Stefan Glienke. I'm not sure if you prefer I open an issue, but I consider this more a discussion, so will ask it here first.

    I'm trying to use Test Insight with my tests as-is, but I'm having some issues which relates to my understanding of how it works. For example:

     

    1. Hierarchy

    My tests have some hierarchical structure that are displayed in the DUnit GUI test runner. I manually use several test decorators to organize it, and sometimes I register test with dots in names to organize it.

    When using TestInsight, the results are not displayed in the same structure, but all test results are displayed in a "flat" layout. Is this known, intentional, or there is something I could do to improve it?

     

    2. Loop

    I understand the tests keep running in a loop? Or at least I can't finalize the test application, which seems to keep running in background. Is this also the normal behavior?

     

    3. Test selection

    I understand that I can select the tests to be executed, but only after one initial execution of all tests are performed. My tests take a lot of time to execute, so that's not a viable option. Is there a workaround to be able to select the tests to be executed before they are actually first executed?

     

    Thanks!


  4. Yes, I'm saying that I had it working considering both type info were equal. Same situation as this. 

     

    The code in point here is JSON serialization. User pass one generic TValue (or an object with lots of properties) and I check the type of the TValue (or property) and serialize it accordingly. So I check if a type is TBytes and serialize it as base64-encoded. As far as I know, this works find with an app using runtime packages and TBytes, just in this application it doesn't. I guess.

     

    So as I said, instead of checking if the value being serialized has the same type info as TBytes, I would have to check if the type name is "TArray<System.byte>" or maybe check if it's an array of type byte. It's a valid solution, although still makes me uncomfortable that such issues might happen with other types.


  5. Thanks @Stefan Glienke. That makes sense, even though I'm (almost) sure I had this working in other applications built with runtime (i.e., having TBytes being recognized as the same type from two different packages). The difference here is that this is an application from a customer and is a huge one - it's an ERP composed of hundreds of packages. 

     

    If that's the case, I suppose there is no workaround using Delphi builtin types, and I would have to create my own type in my library. Or check for the type name instead of type info (which would be slower). In summary, a kludge...


  6. @David Heffernan, thanks, I'm aware of that. The key here is that I don't know what else I'm supposed to do tomake sure that both modules are linking to rtl, as I checked everything I know of (listed above).

     

    @Remy Lebeau, I don't see any option "Enable with runtime packages" for packages. I believe it's implicit? I have added "rtl" to the package requires list, and also to the packages needed by the application. I believe this is enough, but obviously something else is missing. 


  7. Thanks Remy.

     

    3 minutes ago, Remy Lebeau said:

    you have to make sure Package1 and Package2 are linking to it dynamically (ie, you need to ship "rtl240.bpl" alongside your own BPLs) and not statically, otherwise they end up using separate copies of the RTL.

     

    How to link dynamically? Isn't it exactly what "Build with runtime packages" for? I suppose if "rtl" package is required by both Package1 and Pacakge2, and if rtl240.bpl is not present, an error would be raised when the application tries to load the package.


  8. Hi all,

    I'm having a hard type with RTTI info using runtime packages. It looks only related to TBytes type, but I'm not sure. 

    In summary, I do a test like this:

     

      if TypeInfo1 = TypeInfo2 then

     

    Both TypeInfo1 and TypeInfo2 are PTypeInfo values.

    TypeInfo2 is retrieved from a TBytes variable declared in Unit1 which is included in Package1.

    TypeInfo2 is retrieved from a TBytes variable declared in Unit2 which is included in Package2.

    The test above returns false.

     

    I know this situation is typical and requires some checks to be sure it works. But I've been through all that I know, which are:

     

    1. Make sure your application (exe) is compiled with "runtime packages" option checked.

    2. Make sure Package1 and Package2 are included in the list of runtime packages of the application.

    3. Make sure the type being tested is declared in a common package which is required (shared) by both Package1 and Package2. Since the type here is TBytes, there is no need for a shared/common package, and both Package1 and Package2 simply require rtl, which I believe is enough.

     

    Am I missing something obvious here? Does anyone have any hint which I might be looking for? This is Delphi 10.1. Berlin.

     

    Thanks in advance.


  9. 6 hours ago, Andrea Raimondi said:

    Hi!

     

    My guess is that the problem here is that you are trying to force the dataset to do something it wasn't designed for. 

    What you could do is to put a restriction that your users should *also* be using the TMS stuff for record streaming, then you could add some methods such that the server does this and transmits the data to your dataset. 

    Alternatively, you could create a separate query requesting MAX(ID) and using the exact same where and order by and then another one doing a select where the ID is the MAX(ID) you got and finally add this to your current dataset's data. 

    Either way you end up with a mess to maintain though 🙂

    Retrieving data is not my issue. Data will come via Aurelius so it already has a paging mechanism where I can retrieve any page of data.

    My issue is how to make the dataset work with this (the internal buffer mechanism, filtering, etc.).


  10. I wonder if it's possible to have a TDataset that performs fetch-on-demand, but fetching non-contiguous records?

    For example, when view data in a TDBGrid, user could use TDataset.Last and only the last records would be fetched. In this way the first and last records are fetched, but not the intermediate ones.

    I'm not talking about the mechanism for fetching the data itself, but the dataset structure.

     

    1. Does it support such mechanism?

    2. Have anyone tried it, or implemented it? 

    3. Do you have any idea on how complex it is?

     

    Current my dataset does paged fetching, but when user uses TDataset.Last, it fetches moves the dataset forward fetching all records just to get to the last one.


  11. 2 hours ago, Lars Fosdal said:

    I'd like this to be possible, and a compiler switch that bans the old with statements.

    
    with var ref := Some.Array[Index1].Reference, var thing := Function(Index1).Thing
    do begin
      if ref.Value <> thing.Value
      then begin
        ...
      end;
    end;
    // ref and thing are not present

     

    It is, it's called inline variables... 😉

     


  12. 14 minutes ago, Anders Melander said:

    That's not my understanding. As I read it the package cache can be either global or per project.

     

    Regardless I can't see the problem of each project having their own copy of dependent libraries - unless it's the JCL in which case even a single copy is a problem 🙂

    Disk space is cheap. Time is not.

    So, if the package cache can be global, then you can share the library with the 100 projects, right?


  13. 23 minutes ago, Fr0sT.Brutal said:

    OTOH, I think we all have several active projects with full set of tests/CI/auto deployment/doc system etc and much, much more little projects for which using a completely individual set of libraries is overhead. Having 100 copies of JCL only because all 100 projects use a couple of its functions? I don't think it's a good idea

    Why do you assume there will be 100 copies of JCL? It should be one copy shared by all the 100 projects, which will just reference the same library.


  14. 1 hour ago, Darian Miller said:

     

    Well, that's what I was getting at... full support isn't built-in.

     

    Do you test FMX client applications on Android this way?  

     

    I mentioned above, I don't use TestInsight but I use a similar approach which I develop myself for my own use only. That's how I test my code on all platforms.


  15. Just now, Darian Miller said:

    Is there FMX support for client-side testing?  I must have missed something obvious - wouldn't be the first time.  Can you share a simple test project for all platforms?

    The thing here is that you don't have UI for the test runner. You can compile and run all your tests, but to gather information about the results, then you have to use custom output. Well, for Linux you can use the console output. For Android/iOS, I've built a custom one myself where I send test results through TCP to a VCL client in another computer.

    But there are great tools out there, I believe TestInsight from @Stefan Glienke might do the job for you: https://bitbucket.org/sglienke/testinsight/wiki/Home.


  16. Hi all,

     

    Just wanted to let you know I made available an online training course about web development with Delphi: "Introduction to TMS Web Core". Its got a theoretical introduction about web applications, then goes into TMS Web Core and Pas2JS compiler, explaining the idiosyncrasies of both web applications and TMS Web Core specifically.

    Course link: https://courses.landgraf.dev/p/web-applications-with-delphi-tms-web-core

     

    ---

    Wagner Landgraf

    • Like 3
×