Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Unit testing
Forum Update on Monday, May 27th 2025

Unit testing

Scheduled Pinned Locked Moved Unsolved Brainstorm
1 Posts 1 Posters 208 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #1

    Over at How to unit test with functions loaded from win32 api? OP wants to unit test "some functions that use calls to functions derived form win32 api and securitybaseapi, specifically LogonUserW and ImpersonateUser." And the basic solution is to provide an "abstraction" substitute for those functions when testing.

    I don't get this. The side-effects of and intentions when using LogonUserW/ImpersonateUser are so "enormous" that I cannot imagine how any "abstraction" substitute would lead to any meaningful continuation from or behaviour in the code? Why would these be in the code in the first place? Because, say, the very next line/rest of the function has to run as the new user to do anything or produce required behaviour, or perhaps the whole of future code must be running as the desired user from then on or for a while. How would a substitute which essentially does nothing or does not change the user prove anything in a test? It might check the parameters but that's about it.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved