JMeter - IBM BPM - different HTML and response data - jmeter

I need to retrieve info I see on the HTML rendered by IBM BPM but it doesn't appear on the Response Data tab on JMeter. this is ther html:
<div class="outputTextLabel">
<label class="text controlLabel" dir="ltr"></label>
</div>
<span class="text">
196360
</span>
and I need to retrieve the "196360", BUT the response data on JMeter reads:
<div class="outputTextLabel">
<label class="text controlLabel"></label>
so there's no way to retrieve the number since JMeter is not capturing the rendered HTML
any help please?
thanks

JMeter is unlikely to work for you to test IBM BPM. Quoting from the JMeter site -
In particular, JMeter does not execute the Javascript found in HTML pages.
The new IBM BPM control framework relies heavily on using DoJo to update the control after initial rendering to fully populate all the information. A test tool that cannot run the client side JS is unlike to work. I strongly recommend you look at Selenium or a similar browser based testing tool.
(Note: I don't think Selenium recommends you use them for performance testing)
Basically what JMeter is returning to you is what is initially sent down the wire before all the client side JS executes to fully populate the UI.

Related

Jmeter: I can't get the response that I needed for assertion

I have been working on this project and I can't get the response that I needed for assertion because the response body in Jmeter only says "Your browser does not support framing. Please update your browser", but Im using the latest version of Firefox (image 2). I also manually execute the request in the real browser, same as what browser Im using in Jmeter, and didn't encounter the said message. Can someone please tell me whats going on? Thank you for your help
Response Body
HTTP header Manager
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
Most probably the value you're looking for lives inside an iframe is being loaded using some JavaScript function which is not being kicked off by JMeter as it doesn't evaluate JavaScript.
So you need to invoke the relevant request manually using another HTTP Request sampler which would load the required page. You can figure out the necessary request URL by looking into page source using your favorite browser developer tools or by recording your test scenario using JMeter's HTTP(S) Test Script Recorder.
Also be aware that due to asynchronous nature of JavaScript calls it is better to wrap it (and other JavaScript calls, if any, in Parallel Controller
You can install Parallel Controller and Sampler via JMeter Plugins Manager

AngularJS first(landing page) with dynamic content

I am a complete newbie to AngularJS. I want to check the feasibility of using it in my new Project which is a web application. I already have a few pages created in project using Struts2 Spring and hibernate. To convert these following are points I understand:
Convert server side API to REST style which returns JSON data
Question: Can I use dynamic HTML to load using AngularJS. I guess yes. not sure how?
Currently I use velocity Templates on server side to populate data in HTML templates and send it as response in AJAX? What would change if i try to use AngularJS?
I have a landing page which is used to show some images and data associated with it which is stored in DB. How can I show it using AngularJS?
Question: Shall I load the HTML template which contains only one div tag when I hit website URL(mysite.com) and then fire AJAX requests to load the dynamic HTML?
If I use AndularJS does it invalidate use of Struts2 altogether if I choose to implement my Data API as REST with JSON? I guess not as I will still need to load dynamic HTML views which will be generated on Server correct?
How to maintain HTTP session state on server side if I use REST data API with AngularJS on client?
I know I can search and read about answers to above questions on net somewhere. I just need them at one place so that I can carry discussion and other questions that arise from it.
I may answer some of your questions:
1) Convert server side API to REST style which returns JSON data
Yes
Question : Can I use dynamic HTML to load using AngularJS. I guess
yes. not sure how?
Currently I use velocity Templates on server side to populate data in HTML templates and send it as response in AJAX? What would change
if i try to use AngularJS?
If I understood you right, you want to generate templates on server-side. In this case - you just don't need AngularJs - your views are prepopulated on server and browser recieves static content (from client-side point of view). If you want to use AngularJs, then your templates will become static content (from server-side point of view) and they will be populated by angular via REST services.
2) I have a landing page which is used to show some images and data
associated with it which is stored in DB. How can I show it using
AngularJS?
Question : Shall I load the HTML template which contains
only one div tag when I hit website URL(mysite.com) and then fire AJAX
requests to load the dynamic HTML?
Not exactly. One div would be enough for jQuery-based approuch (you would use something like $.ajax and then appended data in imperative way). In case of Angular you will need to return template. It may look like this:
<ul ng-controller="MyCtrl">
<li ng-repeat="item in data">
<img ng-src="item.image.src">
<span>{{item.data.someTextProperty}}</span>
</li>
</ul>
And some AngularJs controller that will fire request to REST service (via your AngularJs service, probably) and autmatically fill template with results
function MyCtrl($scope, $http) {
$http.get('/rest/data').success(function(result) {
$scope.data = result;
});
}
3) If I use AndularJS does it invalidate use of Struts2 altogether if
I choose to implement my Data API as REST with JSON? I guess not as I
will still need to load dynamic HTML views which will be generated on
Server correct?
I think it will only invalidate use of View of MVC in Struts, since AngularJS will just replace it. Also it will make you to use something like RESTful controllers (not quite familliar with Struts, but I think there is something like this)
4) How to maintain HTTP session state on server side if I use REST
data API with AngularJS on client?
This is not short answer, but basically there is following pattern. AngualrJs provides http interceptors, that may intercept requests and responses. If response with code 401 (which is unauthorized) is intercepted, you may provide your user with a login form to restore session and after this action will be completed, retry last request. Also, here you may find another aspect of this question.
I hope my answer helped you.

parsley remote validation - include more data in request

I have started using parsley.js for for validation and it is working great, just added more advanced validation that needs remote data, and got an issue. parsley-remote works fine, but it only send the data of that specific field to the server (title). In order to do my validation, I need also the data stored in the hidden field name="mcid". Can I manage this with parsley? Ideally a general approach that I can use for my entire application (large application, so keeping page specific code to a minimum).
My form (simplified):
<form>
<input type="text" name="title" required="required" parsley-validation-remote="/Admin-Category/validateMainCategoryTitle/" data-validation-remote-method="POST"/>
<input type="hidden" name="mcid" value="2060"/>
</form>
I don't believe that there is an easy way to do it with the built-in Parsley remote validator - any possible solution would be a complicated workaround and you would be better off going with straight JavaScript to do it.
How is the value in the hidden field set? If I were doing this in Java, I would put the hidden field in the DTO or in the UpdateController so the value would be available to the validateMainCategoryTitle method. Is that possible with your application?
Alternatively, since you have both the values available on the form, can you write a custom parsley validation routine to check them, or do you need to go back to the server for some reason?
Just a follow up on my own question. Parsley is now release in v.2 and the new parsley remote plugin has standard support for sending more parameter. Problem solved!

Using ASP.NET MVC3 and with AngularJS

I've just started developing a completely new site using ASP.NET MVC3 framework and #razor.
I would like to use in the client side the angular JS framework, but the use of both is a bit confusing.
How do I loop an array?
In ASP.NET MVC I'll write the following HTML:
<ul>
#foreach (var item in this.Model)
{
<li>
#item.Name
</li>
}
</ul>
In Angular I would write the following HTML:
<ul>
<li ng-repeat="item in list">
{{item.name}}
</li>
</ul>
Which of the two is the most correct way to do that?
There is literally no difference between the two as far as the end result is concerned and you can, if you so desire, use either or both. The difference is in what procedure the code is generated.
In MVC, the final HTML is generated on the server side using data made available on the server side. You create and populate the data in the model on the server, use the MVC to format the data into a structured html code segment, and then the final html is sent back in the response to the client browser.
In AngularJs, an html template is passed back to the client web browser as well as logic for obtaining the data that will be used in partnership with the template. Usually the data is retrieved via AJAX from a web service or api of some sort. Then the JavaScript engine in that browser, using the AngularJs framework, will take that template, retrieve the data and reformat it into a web page on the client end of things.
They literally both provide the same end result. It's generally just a choice between how and where you want the data formatting to occur. With most devs I have talked to who are combining MVC and AngularJs, a list is a good example of something that is usually passed off to AngularJs to handle client-side, reserving MVC only for that functionality that AngularJs isn't as well suited for, like security.

Meteor: account login link takes time to load

I have started a meteor application using the accounts packages for facebook, twitter, github and auth accounts. For UI, I am using the bootstrap package. Whenevee I load my site projectx.meteor.com, the login links take some time
I have everything static on the HTML page, except for the link to login:
client/x.html:
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li>{{loginButtons}}</li>
</ul>
</div>
There is no JS on the client side and I have called the startup method on the server.
Server/startup.js:
Meteor.startup(function () {
});
Also, when I visit the above URL from IE 9 on my Windows Phone 7.5, it doesn't show the login link at all.
Update: After the comment below, I modified my code to remove packages and additional HTML. The packages now included are:
preserve-inputs
accounts-ui
accounts-password
accounts-facebook
accounts-twitter
accounts-github
I have removed bootstrap and the only thing on my template now is {{loginButtons}}, It still loads the login link after a delay. Is this the default behavior of the accounts package ?
The reason why the buttons take so long to load is because Meteor has to ask the server-side for the necessary configuration information (located in a collection in your Mongo instance) before it can render the login buttons for each of the external services you want to use. I think the best solution (and the solution I use) is to simply build the buttons client-side if you want faster results or tweak the login buttons template to allow for data ported in from the client-side using a JSON object with all the OAuth keys it needs.
As you say, this is the default behavior.
There is no problem about bootstrap or js in your code.
I cant explain exactly why but it works that way.

Resources