Is there an easy way to invoke a GWT RPC service endpoint directly from Java code? I mean real Java code, not Java code compiled down into javascript.
I ask because we want to run performance benchmarks/stress tests against a GWT RPC interface. I would like to write the test harness in Java and run it in a JVM (as opposed to javascript running in a browser).
I figure there must be a way to do this because I assume GWT Hosted mode requires such functionality. However, I can't really find any code in the GWT runtime that demonstrates how to cleanly do this. I've looked at the com.google.gwt.user.client.rpc package but the stuff in there seems to use JSNI which obviously wouldn't be usable by pure Java.
GWT SyncProxy allows you to access GWT RPC services (e.g methods) from pure Java (not JSNI) code. Thus you can use it to test your RPC interface.
See http://www.gdevelop.com/w/blog/2010/01/10/testing-gwt-rpc-services/ for details.
Are you trying to benchmark the business logic of the service, or how well GWT-RPC itself performs? If you are mostly worried about how well your backend code performs, you could just instantiate the class that implements your service directly:
MyServiceImpl impl = new MyServiceImpl();
impl.doSomething();
If you want to test a greater slice of the stack, including the RPC calls, take a look here. There is a section called "running your test in web mode" that has the following line: 'By default, tests run in hosted mode are run as normal Java bytecode in a JVM'. So if you use the described setup, I think you get your tests to run in java by default. Also on that page is info about GWT's built in profiling tools.
You could use a conventional load testing tool like Grinder to replay post requests to your service. That isn't quite what you are asking but it may be a better way to perform load testing on your application. Grinder can simulate many simultaneous users and so on.
Related
What is the advantage of using selenium with Typescript over selenium with Java.
Which type of web applications can be automated with Selenium+Typescript and why these cant be done with selenium+java?
In term of automation -> Type scripts basically used by tools like protractor which actually used javascript itself but provide extension to write scripts in typescript which then converted to javascript and pass further for execution.
The main use of typescript is its oops based so its easy to write maintainable code.
Protractor is a nodejs plug-in which use selenium wedriverjs binding internally
Your second question why typescripts:
Basically Protractor is use on Angular-JS client side websites. still you can automate non-angular websites also using Protractor
Normally selenium do not have the capability to understand if the element is ready due to even after page load completed, JavaScript is still working behind for Anugular/JS based website so Protractor provide wrapper which having additional functionality like waitForAngular
Additionally Protractor provide more locators identify strategy which is not present in normal selenium with java or c#
Refer:
http://www.protractortest.org/#/locators
As Protractor is build on wedriverjs we also need to script for it on JavaScript or typescript. basically even if you code in typescript internally it will convert it into typescript. people prefer typescript as it follows full oops unlike like JavaScript
Source:
http://www.protractortest.org/#/
there are more js based framework is in the market like:
WebdriverIO
Nightwatch
Now java also comes up with many library like JSWaiter etc which claim they can handle js based client side websites with java + selenium as well
No major benefits in my opinion, that's my tl,dr;
I can think of a couple of options you might have though:
You might be able to integrate the test framework with the front-end application repository. This can be useful if you are using a Typescript based framework (like React for example) and you can potentially use that to import the application data (for example stub responses for APIs that the developers are using for their dev work, assuming they are available there... just an example) and use that for testing the front-end code in isolation without the API dependencies.
The other reason I can think of is that if you did the above you can potentially execute your test cases as part of the CI of the front-end code, for example you can run a subset of the test cases with pull requests to make sure all is green before merging in the main branch.
Really you can do all the above with an external repo written in Java (hence, no major benefits)
I really know very less about apex-code and salesforce. But after seeing a few demo I find their class loading per-request really nice. It will really reduce build deploy run cycle time.
So, can I use apex-code in java outside salesforce, lets say in a servlet?
Is these anything in java world close to this?
Next curiosity would be if SOQL and SOSL can run within java?
IMHO this is not feasible, since the Apex compiler / interpreter is only hosted on the SFDC platform. Salesforce does not provide any offline compilers for Apex, as Apex is always supposed to be run inside/on SFDC server.
Further your SOQL queries are tightly bound to your objects - I'm not sure why would you want to do this in Java.
The only way I know of Java running SOQL queries is via web services exposed by SFDC. ( using the query/querymore methods )
I am developing a library that extends Selenium 2 with some custom commands. The library should be usable from Selenium's Java and Python bindings as well as in Selenium IDE. From my research, these three target bindings should cover at least 80% of all Selenium 2 scripts.
In order to implement my custom commands for Selenium IDE, I think I need to write a plugin for it in JavaScript.
My question is this: If I already have an implementation of my custom commands in JavaScript, is it safe to re-use this implementation for the Java- and Python bindings of my library?
I am thinking of an approach that injects the JavaScript implementation of my commands via WebDriver#executeScript. Here is a pseudocode implementation of what I am thinking of.
In Java:
public void fooJava() {
executeScript("Inject code.js");
executeScript("fooJavaScript();");
}
In code.js:
function fooJavaScript() {
// Implementation of command "foo" from Selenium IDE plugin.
}
So, to execute my custom command fooJava() in Java, my library's code.js would be injected into the browser via executeScript. This would contain a JavaScript implementation of foo, say fooJavaScript. In a next executeScript call, this fooJavaScript would then be called.
While this approach would prevent me from having to implement my custom commands three times (Java, Python, Selenium IDE), I have a few concerns:
When I inject my code.js, am I in danger of destroying global state of the web site?
To which extent can I rely on JavaScript? Will it work if an alert dialog is present? In practice, how many of the drivers used with Selenium do not support JavaScript? Eg. HtmlUnit?
Will this work in all major browsers (somewhat recent versions of IE, Chrome, Firefox, Safari)?
Your real-life experiences with this would be much appreciated.
Principle states you should not be using JS as your testing mechanism if you are just delivering a payload with WebDriver.
WebDriver = integration testsJS = if you want unit tests
I don't know your use cases exactly, but:
If you're trying to run integration tests, stick with WebDriver to best simulate user interaction. You also avoid cross-browser JS issues in the future by relying on the WebDriver hooks to interact with the page, as in, you are better off relying on the community to provide reliable basic DOM interaction APIs for each browser. If you can't trigger test conditions with browser interactions, you're getting into unit/code testing territory instead of integration testing.
If you are trying to run the JS for sake of essentially testing a single function or piece of code rather than an integrated interaction, you are trying to run a unit test. Unit tests are best done in JS with something like Jasmine (name any framework here).
Reasoning:
Integration tests should be written to be as implementation independent as possible. You should not need to know a function name to trigger an integration test, since someone might change the function name in the future or restructure the code.
Since you are filling a QE/tester role, you do not want to be responsible for breaking integration tests when code changes - if you use this and are responsible, then you will need to change a test every time there is a code restructure.
Sources: Experience as a QE in 10,000+ employee software co.
Assuming there is a big application built using C++ & others and CORBA as a way of interacting with it, is there any viable way of simulating user interaction, with the goal of running ANY kind of automated testing (the automation is less of an issue)?
The preferred approach would involve using JAVA, but that is also less of an issue.
Google provides almost nothing on this.
I assume that the product offers a CORBA API, and I assume that there is an existing client that interacts with the server using only that API (this is called eating your own dog food).
CORBA is designed to be language agnostic, so you can certainly write a Java client to interact with it.
Given those assumptions then you could feasibly test the server using the CORBA interface, but you will not be able to test the client-side code such as buttons and dialogs etc. You could use UI testing franmeworks for that.
IONA (now owned by Progress) built a product called the Orbix Code Generation Toolkit that does exactly this. It's available in Orbix v3 through v6.
It walks your IDL documents and produces client (or even server) code to completely exercise and call each method available with random but valid values for each parameter, printing them out each time.
You'll need to get Orbix to use it, but maybe you can get an eval license for it to try it out by contacting Progress Software. And don't worry, you can generate client code that can run against any CORBA-compatible server, not just Orbix ones.
we use spring-remoting for a Client-Server-Application. Now we are in doubt how to realize a real load test with serialized objects.
The problem is that many load testing toolkits are based on plain text HTTP communication, so it's very easy to parameterize the http-requests. Because spring-remoting is based on serialized objects we can't easily parameterize the http-communication to the server.
My first idea was to encapsulate the endpoint of spring-remoting and to call the service over client-side service classes. But how can I realize calling the remote-service from multiply clients to gain a real load test scenario?
Are there any solution for wrapping the client-side service in an easy manner?
Has anybody some experiences how to realize it?
Thanks for advice.
There is a discussion on the Spring forums about how to use JMeter to do testing. To use JMeter you'll need to write a custom Sampler. They have examples on the JMeter site.
Alternatively, you could try Grinder. Testing scripts are written using jython but it is arguably easier to create tests for non-standard protocols.
There is a commercial JMeter plugin which allows this, see:
http://www.ubik-ingenierie.com/blog/load-testing-java-serialization-applications-with-jmeter/
To make your tests realistic, you will need to variabilize content in the
serialized objects.
This Java Serialization plugin will allow the following:
Easy recording of traffic with JMeter Proxy Server, a Test Plan using
custom Sampler will be created
Easy variabilization of requests (which will appear as XML) through as
easy syntax as for example ${searchedWord} where searchedWord can come from
a CSV or any user defined variable.
Easy extraction of data from responses using JMeter standard Post
Processors
Easy debugging of Request/Responses through standard JMeter View Results
Tree element
Disclaimer : I am member of the company that distributes this solution