Debug a method in eclipse - eclipse

I wanted to know whether you could debug a single method call
Say there's a method called howMany(char c,String str). I want to call it with 'c',"Hello world" and debug it without having to go through every previous code until I reach it
Thank you

You could try using Junit testing. This will allow you to call in a single method.
How to create unit tests easily in eclipse

Related

Is there a possibility to run a particular method only once before the whole set of tests in the .cs file run in Nunit

I am writing UI tests for a mobile app using Xamarin UI test and N-unit frameworks. I want to run a particular method (App initialization) only once before the set of tests began to run. I used [one time setup] annotation but that is also running before each test.Please help me on this.
You can do this by creating a [SetupFixture] outside of any namespace.
See the docs here: https://github.com/nunit/docs/wiki/SetUpFixture-Attribute

Selenium testng xml issue

I am trying to include a method in testng.xml file which is present in #Beforeclass annotation.Is there any way how can I achieve this?In google, all i can see is examples about inluding/excluding methods in #Test annotation ,but i am unable to find how we can include/exclude methods present in other annotations like before class,before method(Other then test annotation).
Well, you cannot control beforeClass, beforeMethod as they trigger automatically. If you want to control your method, you need to add #Test before it and then only you can ignore/include them.
If everytime, you want to execute them then you dont need to include them, they will get triggered always without mentioning them in testNG.xml

How to define on spawn handler for Mojo::Server::Prefork?

I have simple web application written in perl/Mojolicious and running under hypnotoad.
I need to define some handler for the "spawn" event (emited by Mojo::Server::Prefork).
But i dont know, how to insert this hander definitiion in the code of startup method of Mojolicious application. $self->on("spawn"=>sub {}) doesnt work :( And Dumper($self) was not helpful at all: there are no $self->server or $server->prefork ...
Tell me please, how to do it.
Thanks!
Although i still dont know how to define handler fired on process "spawn", i can tell that absolutely the same thing can be done by using
Mojo::IOLoop->singleton->next_tick(sub {
doingSomethingOnProcSpawn()
});
As it described in Mojolicious Cookbook (http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Pre-forking):
During startup your application is preloaded in the manager process,
which does not run an event loop, so you can use "next_tick" in
Mojo::IOLoop to run code whenever a new worker process has been forked
and its event loop gets started.
Hint: As i see in my real application, Mojo::IOLoop->singleton->next_tick and Mojo::IOLoop->next_tick works absolutely identically, so i dont know what is the difference between them.

How to handle unattended mode in custom form components?

I finally created my first custom form component and it works like a charm in GUI mode. Now I have to fullfill a requirement that also the silent installation should work. The documentation said to override the handleUnattended() method. But there is not mentioned which other methods will be called during the lifecycle of the custom form.
I implemented the validation of the user input inside the checkComplete() method and depending on the validation result I set a variable to the installer context and switch to the next screen. Will this method also be called after the handleUnattended() method or is this only a method for the GUI mode installation?
And how to get the "user input" from the varfile-file? I suppose to get the variable from the installer context like context.getVariable("some-input"). Is it correct?
Thanks in advance
Hardie
During my research I can answer some questions by myself:
1) checkComplete() is also called independed of the implementation of handleUnattended()
2) vafile arguments are reachable from the installer context
3) with context.isUnattended() it is possible to check, whether you have to display an error dialog or exit the installer process.
Please correct me, if there are any missunderstandings.

jUnit testing with Google Web Toolkit

I would like to be able to run a set of unit tests by linking to them in my application (e.g. I want to be able to click on a link and have it run a set of jUnit tests). The problem is that GWT and jUnit don't seem to be designed for this capability -- only at build time can you run the tests it seems.
I would like to be able to include my test code in my application and, from onModuleLoad for example, run a set of tests.
I tried to just instantiate a test object:
StockWatcherTest tester = new StockWatcherTest();
tester.testSimple();
but I get:
No source code is available for type com.google.StockWatcher.client.StockWatcherTest;
even though I include the module specifically.
Would anyone know a way to do this? I just want to be able to display the test results within the browser.
If you are trying to test UI elements in GWT using JUnit, unfortunately you may not do so. JUnit testing is limited to RPC and non-UI client-side testing. See this thread for a great discussion on what you can and cannot do with GWT jUnit testing.
If you are not trying to test UI elements, but are instead trying to inject your RPC code or client-side logic with test values (hence why you want to be able to click on a link and run a set of JUnit tests), then you should follow the following guide from testearly.com: Testing GWT with JUnit. In short, you should make sure that the method you are testing does not include any UI elements and if the method you are testing is asynchronous in nature, you must add a timer.
In 2.0, HTMLUnit was added. You may wish to use this instead of firing up a browser each time you wish to test.