I have created an utility class to capture HTTP Traffic (to get some querystring key/value pair) by using Telerik HTTP PROXY class, triggered by launching a URL. This part is more complicated but it's done.
I need to capture the same traffic by clicking on any link on a page; all I know is the link element user clicked, but I won't know the exact URL. This test has to be done from Test Studio as the QA tester is not as technical, most likely with data binding to a set of link elements.
I am new to Test Studio, thought this should be pretty straightforward. Can anyone help?
Thanks,
Terri
8 Answers, 1 is accepted
The link element is:
<a class="nav-item-link-primary" onclick="PartnerLink('nx','invneeds_'+s.prop2+_global', ",this); href="/destination/">
My delima is, I need to capture the http traffic starting at the onclick event, before reaching the href destination. I don't have an URL at that point. Not sure if I can use ActiveBrowser.url to retrieve the url and pass to my utility function.
Can anyone help?
Thanks
It is possible to pass the browser object to another method, but I believe that you class needs to inherit the BaseTest class.
You can see and example that I did with the framework a while back in a stackover flow answer. http://stackoverflow.com/questions/6987181/does-the-webaii-framework-support-a-page-class-structure-in-the-way-that-watin-d/7029320#7029320
I also played a little with the HTTP proxy - this is how I ended up structuring that call.
[CodedStep(@
"Click 'Bulk Reports link'"
)]
public
void
TradeList_CodedStep3()
{
ResponseListenerInfo li =
new
ResponseListenerInfo(GetFileFromHeaderInfo);
Manager.Http.AddBeforeResponseListener(li);
//Click Bulk reports link
Pages.TamaracIncCom7.Find.ById<HtmlAnchor>(
"ctl00_ContentPlaceHolder_rwDldFiles_C_lbGenerateBulkReport"
).Click(
false
);
Manager.Http.RemoveBeforeResponseListener(li);
string
fileName = (
string
)GetExtractedValue(
"acctTradeFile"
);
string
fullPath = @
"C:\temp\SmokeTestDownloads\"
+ fileName;
SetExtractedValue(
"fullPath"
, fullPath);
}
I hope that helps.
Looks like you have stumbled with the issue I am encourting already. Thanks for your answer. I see you had an old thread on Nullreference to the http object issue, I had tried to reply to that thread but failed.
To get around the Test Studio doesn't work with http Proxy issue, could you share how exactly you did by adding a test settings file to the project and enabling it ... I have tried to add an app.config file and it doesn't seem to work.
Thank you very much for your help.
I am working with the visual studio plugin of Test Studio so this is how I did it.
1. I added a settings file to my project:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/test-execution/test-list-settings.aspx
2. Under the web tab in the Telerik section of that file you can turn on the HTTP proxy.
3. Because you have the settings file now you will also need to go the deployment section and check the Enable Deployment button.
4. I have to run this then by debugging a given test (not quick executing.) You can do this by opening the Test View. In VS, Test -> Windows -> Test View. Then select the test in the list and select the test you want to debug and right click it and debug the selection.
Do you require further assistance after following Daniel's suggestions?
@Daniel
Thank you for assisting another user. I updated your Telerik points accordingly.
Regards,
Anthony
the Telerik team
Test Studio Trainings
Yes, I do have more questions, thanks for following up. I followed Daniel's instruction and get to the point I wanted, THANKS Daniel!
However, my goal is to develop a process for QA folks to execute my test in Test Studio. I need to use the ArtOfTest.Runner.exe to generate .aiiresult file on a shared drive so later we can copy that file to our local result folder to be included in the matrix report.
Questions:
1. This is the MSTest and Telerik Test related question - when I create a test list for the test in VS-plugin, the list is in the .vsmdi file, and I have noway to execute it from the ArtOfTest.Runner.exe, can only execute on the test. Is this right?
2. On the original thread,
http://www.telerik.com/automated-testing-tools/community/forums/test-studio-express/general-discussions/null-reference-exception-when-trying-to-use-the-http-proxy.aspx, I don't quite understand the get around. Any document on the RunHelper?
Thanks,
Terri
1. ArtOfTest.Runner can execute a test file (.tstest or .aii) or a Test Studio Test List (.aiilist). Visual Studio Test Lists must be executed with MSTest and won't generate an .aiiresult file. This is because it's using Microsoft's execution engine and not Test Studio's.
2. RunHelper wraps test execution so it can be called from third party apps. Here is our documentation on it (albeit minimal).
The work-around is a parent test that contains a single coded step. That code turns the HttpProxy on (which cannot be done through the UI for Quick Execution) and then executes the target test via RunHelper.
The HttpProxy setting can be toggled through the UI for Test Lists, however, so if you execute that way the work-around won't be needed.
Anthony
the Telerik team
Test Studio Trainings