3

My team hosts a set of central web pages that is used by many different organizations. These pages change their look and feel (fonts, images, etc.) based on which organization calls the page. This is determined by a custom HTTP Request Header: "organization". I am building a test site to test the look and feel of ALL of the different organizations.

My plan was to have a web site with a drop down where our QA people can choose an Org then click something (button/link) to open the central web pages with the look and feel for that org. Note that when calling these central pages the URL in the browser MUST change to the URL of the page. So far all ideas/samples I can find involve getting the page content from the remote server and displaying it IN the calling page (URL does NOT change). Bottom line is I need to be able to set HTTP Request Headers then open a new URL with those headers.

I can use JavaScript, ASP Classic, Java and/or other similar technologies/languages. Any ideas to get me started?

I did find some similar questions to mine but none of them allow the URL to change in the browser so it doesn't work.

EDIT:

OK so it seems to not be possible via code. We cannot use a proxy since corporate has locked our browsers down and we cannot change proxy settings (even on dynamically created browser profiles). So is it possible to add custom HTTP Request Headers in IIS Express? If so I can write java test cases that modify the config files of IIS Express then start the server and load a central test page that redirects to the appropriate pages. Can this be done?

Maverickz
  • 81
  • 1
  • 6
  • You can't set headers if you are loading a completely new page. It could be done using ajax in a single page app. Not hard to research using the history api to change url in a SPA. Or use url instead of header to define paramters – charlietfl Dec 13 '16 at 02:13
  • That is just it though, do the current level of adoption I cannot change the way the central pages work (moving headers to URL) not to mention there are other headers that would be a security breach in the URL. I don't think AJAX loading into the existing page will work since the pages themselves also have to load a bunch of other content and have a workflow of their own. Example: one page is "modify user profile" and as you can guess there is some workflow behind that. – Maverickz Dec 13 '16 at 02:33
  • Then you have an application design flaw. There is no way to open a new url that loads a whole new page and pass headers – charlietfl Dec 13 '16 at 02:35
  • My original answer was about response headers, but you can do the same with IIS to add request headers. Check out this article. http://stackoverflow.com/questions/13590027/adding-a-custom-header-to-arr-requests – Glenn Ferrie Dec 13 '16 at 03:10

1 Answers1

0

I am dying to know how the architect of this solution intended for end users to add headers indicating their organizational membership. Corporate proxy perhaps? Who knows. Seems cray cray. Whatever the intention was, you should be trying to adhere to it, if you want an accurate test.

But if can't do that, and your sole need is to perform testing under the assumption that the headers can be added somehow (just not by you), and you have control over your browser, you can use an add-on, such as Modify Headers for FireFox.

You could also build something separate to act as a proxy and add the headers, such as the solution to this question. Point your browser at the proxy and voila.

Community
  • 1
  • 1
John Wu
  • 50,556
  • 8
  • 44
  • 80
  • Actually we have been using Modify Headers for Firefox to manually test. But our regression test cases have steadily increased in quantity to where we HAVE to automate. The "tool" we were given is Selenium which doesn't allow modification of headers ("It's a browser automation tool, NOT a test automation tool"-Selenium team). I have been pushing for us to get TestComplete but it's too expensive. Are there any full test automation suites that are Open Source? – Maverickz Dec 13 '16 at 15:35
  • Oh to answer your question: The organizations have their Headers set by SiteMinder (SM) which is a third party Authentication/Authorization suite. SM though cannot use dynamic headers, they are static for each Org. So if we used SM for testing with numerous orgs and several header fields that need to be set, our test site would need to have a unique URL and header profile for EACH combination which would likely be in the 1000's. Thus the need to set the headers dynamically. – Maverickz Dec 14 '16 at 20:15
  • Ah OK you are probably using SiteMinder Affiliate Agent, which will read the SiteMinder cookie, communicate with the SiteMinder authentication server, and dynamically add headers prior to the request reaching your web site. (I am surprised it allows the browser to set the header-- seems like a security hole). The way we dealt with this was to add c# code to the web site to spoof the headers when a flag was set in the configuration file. – John Wu Dec 14 '16 at 20:50
  • That sounds like it could work for us as well. Can you provide more details on HOW you used C# to spoof the headers? – Maverickz Dec 14 '16 at 20:58