Want to use Script recorded for OFT(OATS) in OLT(OATS) module.Any suggestions on how? - openscript

I am currently working on Open Script(OATS) Version: 12.3.0.1 Build 376.
Scenario is that I have written/recorded multiple scripts using
Functional Testing (Browser/GUI Automation) Web Module but now I want to
run the same scripts on Load Testing (Protocol Automation) Web/HTTP
module.
To be more clear thing is like that when we record scripts using
Functional testing modules, during playback browser opens up and re-runs
your script on a machine.
But unfortunately now i want those scripts to be ran on EM Machines
where no browsers are there.More precisely scripts run in silent mode
without any browser getting launched.
Problem with Load modules scripts is that they run on HTTP protocol and
same doesn't gives you lot of customization option as functional module
scripts give you as they work on DOM structures and same is supported in
webdom module.
In open source community(Selenium) scenarios like this are handled
through HtmlUnitDriver.
I tried with the same in open script by adding external jars as an asset
in the script but that gave me the linkage error.
Any suggestions on how we can achieve the above task would be
appreciated.
Regards
Ankur shrivastava

You can use htmlunit as an asset in your loadtest script, however there are some conflicts with xml/html parsing libraries used by htmlunit with the ones openscript uses (for reporting). Two options:
Remove the xerces/xalan libs from your htmlunit.jar, thus making htmlunit depending on the openscript libs. This might cause issues with versioning or some htmlunit functions break.
Remove the xerces/xalan libs from openscript script; just remove oracle.oats.jagent.lib3rdparty from the script MANIFEST.MF. This ensures htmlunit uses its own libs. However loadtest reporting will break.

Related

Ruby/Sinatra: Load additional code without restarting web app

I want to build a plugin system for a web app I'm writing. I don't want to have to restart the application every time a plugin is added/removed/enabled/disabled. Also I won't know the names of the plugins or even how many there are (I want to make it 'infintely' expandable).
The obvious way would be to reload the app on every request (as in this question, the Sinatra FAQ, and with Sinatra-Contrib). Reloading on every request would have poor performance for a production environment, especially a popular app.
I have read an article about Kernel#load and that it reloads the file when called multiple times and Kernel#autoload which only loads the code if needed. But both methods require the name of the module/class to be hard-coded in.
Jenkins CI and WordPress imply they can do this. Jenkins says "1000+ community contributed Jenkins plugins" and WordPress says "48,492 plugins". So I imagine it must be possible, but maybe only in Java or PHP.
I am working with Ruby 2.2, Rack 1.6.5, and Sinatra 1.4.7. I'm developing on Windows and I plan to deploy to Linux. If what I want is impossible to do on Windows (annoyingly some things are :P) I will set up a dev server with Linux.
Thanks!
EDIT: I will also need to be able to unload plugins. I'm not aware of any unload/un-require methods

Must I use Shim in RequireJS for all non-AMD js lib in an app?

Right now our app has scripts that are loaded the old fashion way and a part of the app are all RequireJS & Backbone views/models. We are having some RequireJS script loading error on live (through frontend onError collection via ajax) which are not reproducible in dev.
We suspect it's the way some scripts are loaded in the old fashion way while the others are using shim and requireJS. Could this be the problem? What shall one do? Shall we add every non-AMD JS files (e.g. jquery plugins) into Shim?
What would be the benefit of loading everything in Shim? I can see many of our old script will need to be modified to require certain scripts from RequireJS.
You need to use shims only for non-AMD code that you want to load with RequireJS. It is quite fine to load non-AMD code using <script> tags, so long as you don't expect RequireJS to recognize this code as a module. I've actually done it. No problem whatsoever.
What would be the benefit of loading everything in Shim?
The answer to this depends on the specific of your application and the specifics of what you want to load. In my applications there would be absolutely no benefit whatsoever to loading every single piece of non-AMD code using shims.
If your library is 1) not AMD and 2) attaches to window, you can pull that library in using requirejs and just not expect to use its export.
So, for instance, the latest jquery attaches to the window. Lets pretend that is isn't already AMD compliant.
define(['someview', 'jquery'], function(someview) {
$('body').append(someview());
});
requirejs will load jquery and evaluate it before executing the callback. The fact that it is not AMD compliant is irrelevant. This is very appropriate and I think it is more appropriate than putting script tags in your page. Your code should declare all of its dependencies whether those dependencies export or are AMD compliant or not. Just put them as the last entries in the dependencies array.

Passing arguments to OSGi application

I'm in a team that is converting a suite of Java applications to use OSGi. Previously, we used our own home-brew class loader system that has some similarities to OSGi, but it was nothing but trouble; we expect that by moving to using a system like Apache Felix we can have a system that works better while requiring less overall effort on our part to support.
We have been converting the modules that make up the applications into OSGi bundles, a largely painless affair with the use of Spring DM.
However, we — well, I as it's my responsibility in the team — need some way to reliably produce applications from this via a tool like Maven (or Jenkins); having a redistributable application installer that will install everything for the user is an absolute requirement. (We know our userbase fairly well; they want a simple install that won't download extra things after installation, well, not unless they decide to install extra plugins, but that's another story.) We do not wish to have to build the application manually at a console, or by using a GUI, as manual processes are too likely to run into silly human errors; we want to get it right and debugged once.
Moreover, some of the applications in our suite have to take command line arguments “like a conventional application”. (The application in question does significant processing internally, and sometimes needs to be invoked from other processes, such as web portals.) I know this causes some issues with the default Felix main, which only allows command line arguments for its own purposes instead of providing a way by default to export those to the bundles. (I know we could wrap things with a shell script so as to pass them in as properties, but… ewwww… there's got to be a better way. I suspect that making a custom main that exports a service providing access to the command line arguments is the best method.)
So, my question is what is a recommended way of building whole OSGi applications automatically, and am I using a reasonable approach to provide the command line arguments?
I'm guessing your best option is to write your own main that does specifically what you want. Since OSGi R4.2 the launching API is standard and pretty straightforward. You can just start from Felix' Main since it is already generic (i.e., it can launch any R4.2 framework, such as Felix or Equinox) and change it how you wish.
If the command line args represent configuration properties, you could just push them into Config Admin. Otherwise, just expose them how you see fit.
The Apache Sling Maven Launchpad Plugin generates a finished OSGi app from a list of bundles to include, and the Sling installer can be used to include initial configurations as well.
Even though they come from the Sling project, those module do not require your app to use the Sling app model, they are just used to build, launch and configure it.
For your arguments, use metatype. It will allow your bundles to load with default values and when the user configures the bundle via the web console or config files, metatype will inject the values into your variables. An installer would also be able to set these values at install time via the config files.

Selenium store result of web service/AJAX call

Is it possible to store the result of a web service/AJAX call into the store element, so that its value can be used in multiple locations.
The reason for this is we would like to have an automated test suite that uses data defined in a database. This would make it much easier to change bulk data in the tests (instead of searching through all of our test cases to change the data).
I understand that we can create a test case at the beginning of our test suite that defines all of this data however, we would like to easily switch between data sets without having to re-type each value.
I'm not sure how you can do what you're asking. It would be cool to learn. But let me give you a different approach which is very easy. I can answer any questions you may have. Create 3 different commands in your Selenium IDE to start things off, where your target for the open command is the path of the page you're automating.
Command: open
Target: --path--
Value:
Command: storeExpression
Target: 123
Value: var_number
Command: type
Target: TextBox1
Value: ${var_number}
Then use the export option in Selenium IDE as Java code (or another language). You won't have the Options > Format > options unless you turn on "Enable Experimental Features" in options. Choose "JUnit 4 (Remote Control or RC)"--Selenium 1. I'm not familiar with "JUnit 4 (WebDriver)"--Selenium 2 yet, but it's a bit newer, and not as much documentation. Then download Eclipse Classic, the Java JDK, the Selenium client driver for Java (on the Selenium site)--dll #1, and download JUnit 4--dll #2. Import both of those dll files into the Library tab (in Eclipse classic) after creating a new project in the project wizard, and open your export code that was exported using the Selenium IDE format export. Eclipse should be configured to automatically compile your code by default. Then just create an loop in the Java code and repeat the commands above. Then connect to your database from Java (with some simple SQL connection code), and read your data from the result set inside of your loop. Then right click in the Eclipse file explorer and choose JUnit on your unit test to launch a Mozilla Firefox instance to have it automate your loop. Or you can launch any other browser to run your JUnit test.. just change "*chrome" (aka Mozilla not Google Chrome) to "*iexplore" (Internet Explorer) or "*googlechrome" (Google Chrome), etc... for a browser of your choice in the Java code.
Pardon my jargon on "dll files". I meant to write assemblies or libraries. In Java, the correct term would be a *.jar. I'm use to writing in .NET code. If you choose to run your unit tests in .NET, then you will need to repeat most of what I have above, but instead download NUnit and use Visual Studio rather than Eclipse. The documentation is much better for JUnit, so that's why I went that route. That statement might not be correct. That's just what I found to be true from observation when I did a proof of concept for my company.
Oh, and because you're using client drivers, you need to have the Java (JUnit Test) program connect to your Selenium Remote Control Server. So you must download the Selenium server also. Then call the Jar from the command line in Windows. It must be running before running your JUnit test. This server won't run unless the JDK is installed on your machine!
java -jar selenium-server-standalone-2.0rc3.jar
The contributed user extension: http://wiki.openqa.org/display/SEL/global makes use of the global array globalStoredVars which you should be able to use.
I started recently to test a multilanguage website using Selenium with javascript, see Testing-a multilanguage website with selenium

Problem about running php test suite and test case using Selenium RC

I need a php test case and how can i test a php test case using selenium RC. Already i have set up Selenium RC in my computer.Not only that, i need a test suite. What is the purpose of test suite and test case? Is the test suite and test case same thing?
It would be very helpful helpful for me if any one post a solution in the blog as early as possible.
The Recorded test scripts can be than exported to PHP language and with the help of these you can create a library which contains all the functions/tests which has to be performed on the application
Now create the suites for different libraries which will call the functions in the libraries and executes it on application.
Start the Selenium RC using the command “java –jar selenium-server. jar”
On the new command prompt enter the specific directory location of the file and enter “phpunit xyz.php”
Selenium is a tools that let you automate visits to a site and test for conditions; mostly presense of text on page or in html controls. The selenium server needs to be running which will enable you to control a browser (firefox by default) to do you automation tasks.
Starting the server could be something like
"javaw.exe" -jar selenium-server-standalone-2.0b2.jar"
where javaw.exe is part of your java runtime, most likely in C:\Program Files (x86)\Java\jre6\bin\ or C:\Program Files\Java\jre6\bin\.
You also have the possibility of installing a Selenium IDE as a plugin to firefox which lets you record, edit and playback tests.
The most likely usage would though be to implement tests in a test runner like nunit or a php program. The IDE has export functionality for this.

Resources