Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Authentication Overhaul - Convert All Existing Tests

Gambit
Gambit Posts: 28

My organization is overhauling how customer sign in is performed.

  • Currently a customer authenticates, then initiates a session which generates unique cookies that follow the customer as they navigate the website.
  • In the near future we will have two NEW endpoints to sign in, which will generate a token which will be used by the customer to navigate the website.

As you can imagine this will be a massive undertaking to manually update our existing .tst's to remove and replace the sign in tests, as well as update the headers for all test cases. So my question is: Is there a way to automate the conversion?

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    It looks like you can search (and replace) HTTP header names and values using Parasoft Search (CTRL+H):

  • Gambit
    Gambit Posts: 28

    Hi Benken,

    I think this is what I'm looking for, but I can't get it to work.

    The search portion appears to be working as expected, finding all REST Clients containing HTTP Headers.

    But the replacement doesn't actually do anything. I'm guessing this is because the headers are different from test to test. Any suggestions?

  • Gambit
    Gambit Posts: 28

    I've been trying to follow the steps outlined in the documentation but it doesn't account for my particular situation so I'm totally blocked.
    https://docs.parasoft.com/display/SOA9108/_Updating+Tool+Values+with+Search+and+Replace#id-_UpdatingToolValueswithSearchandReplace-Tutorial

  • jakubiak
    jakubiak Posts: 795 admin

    It is working for me, with multiple REST Clients that contain different values for the same header. In the Parasoft Search, when you choose "HTTP Headers" and use the regular expression that you specified, it is finding both the header name and header value. So you will either need to specify a regular expression that only finds the header values, or you will need to manually select just the header values in the search results. Once I do that and I choose "Replace Selected..." or "Replace All...", the values do get updated for me. If the editor of the test is open when you do the replacement, the update will not be visible until you close and reopen the editor.

  • goofy78270
    goofy78270 Posts: 133

    Is there possibly a way to search the Literal HTTP Headers? I did not see such an option, but thought it would be a great addition if not.

    I believe the issue above is due to the headers being replaced are not 1 to 1 so each Name and Value has to be manually evaluated and changed.

    Plus there does not appear to be a way to remove or add a header using the current HTTP Headers field type in search. Querying the literal header fields would allow such changes.

  • Gambit
    Gambit Posts: 28