Testing an activity 4 clicks deep using Robotium - robotium

I have a home activity ActivityA, which has button that creates an intent, sets up some Extras and calls ActivityB. This in turn calls ActivityC , and in turn calls ActivityD.
I don't want to have to write a test case that opens ActivityA and proceeds to drill through 4 activities to get to the one I want to test. How can I set up the Extras required by ActivityD when it launches to prevent errors in my code. For example before I call the intent that launches activityD it sets up an Extra which ActivityD then uses.
Thanks

Robotium gives you an option to launch an activity with a given intent, you will need to determine the intent that you need in order to launch the activity correctly. If you look in logcat it might give you the details that you need to launch the activity correctly. If you are unsure what to look for post the logcat logs of the time between clicking the element on Activity C and Activity D launching and i can try to look for you.

Related

To Execute multiple Test fragment gradually using multiple module controller in Single thread group

I want to execute multiple Test fragment one by one in single thread group for that I have created multiple test fragment and for each Test fragment I have separate module controller that I am selecting using switch controller, but while executing a test entire thread group duration is getting consumed in one module controller. Others module controllers are not getting window. PFA Jmeter elements structure.
enter image description here
I cannot reproduce your issue using simplified version of test plan:
so my expectation is that something is wrong with your ForEach Controller and/or Switch Controller.
Given the nature of the Ultimate Thread Group I don't think you need to have these 2 guys at all (unless there is a custom complex selection logic which I'm not aware of)
If you need further assistance you need to show
ForEach Controller and Switch Controller configuration
Schematic view of your Test Plan (Tools -> Generate Schematic View)
The values of JMeter Variables used in the ForEach and Switch Controllers for at least 2 iterations (can be obtained using Debug Sampler and View Results Tree listener combination)
jmeter.log file

UI Automation Error: UI TESTING FAILURE-APP failed to quiesce within 30.0s

Since xCode updated i'm having trouble running any ui test case. It gives me this error when its expected to do a simple tapping action for example:
XCUIApplication *app = [[XCUIApplication alloc] init];
XCUIElement *passwordSecureTextField = app.secureTextFields[#"Password"];
[passwordSecureTextField tap];
Anyone have any ideas why am i getting this error? I've searched on google and here but haven't found any solutions.
Thank you.
Make sure you don't have any animations on screen during UI Automation tests. We had a text alert flashing on the login screen for debug/test builds of our app, and it would cause the "failed to quiesce" error until it was removed.
There are some other posts about this error that mention issues with UIRefreshControl, so I would suspect animating that or UIActivityIndicatorView would cause the same problem.
It might help to turn on the "All Exceptions" breakpoint. I used it and I recall getting the same error. It will break at the line with the problematic code and should show you the stack trace of the error with more info.
I had a similar error - as well as the simulator running very slowly. In my case it was fixed very simply by the method given in the accepted answer here: Xcode simulator extremely slow.
To save you a click: The issue was that I had accidentally pressed Cmd + T at some point, enabling "Slow animations".
I had to turn off the "Personal Hotspot" in order to get a working test environment (Because the blue bar in the top apparently disturbed XCTestRunner)
But as some tests need internet connection I can't do testing when being in the wild:-(
Anthony F's answer says it all. Likely something is still animating. The system seems to wait for the app UI to "settle" (go idle) and when that happens, it performs the tap action. However, when the UI constantly runs animations, it will never settle.
Xcode Console Output
Enable the console output in Xcode to see what happens when running the test.
Below is an example of the log, when it works well. The system waits for the app to go idle and when that has happened, it goes to find the button in the hierarchy.
t = 16.95s Tap "#go" Button
t = 16.95s Wait for app to idle
t = 17.00s Find the "#go" Button
t = 17.00s Snapshot accessibility hierarchy for XXX
t = 17.09s Find: Descendants matching type Button
t = 17.09s Find: Elements matching predicate '"#go" IN identifiers'
t = 17.10s Wait for app to idle
t = 17.15s Synthesize event
t = 17.41s Wait for app to idle
Below is an example when it fails. The system waits for the app to settle so that it can look for the button in the hierarchy. Since, it does not settle, it waits "forever" finally running into the timeout.
t = 18.88s Set device orientation to Unknown
t = 18.93s Tap "#go" Button
t = 18.93s Wait for app to idle
t = 79.00s Assertion Failure: UI Testing Failure - App failed to quiesce within 60s
In my case the "failed to quiesce" was caused, because at time t=18.90s, demo data was generated which caused repeated updates of a UIProgressView. From then on the app UI never settled ("quiesced").
("quiesce" as a word is not in my active vocabulary, which certainly has delayed my recognition of what was going on. The console output pushed me into the right direction. I'd bet "idle" rings more bells than "quiesce" for many developers.)

Where do you find the ApplicationId to pass to TileUpdateManager.CreateTileUpdaterForApplication(string) for a background task

I want to update a live tile from a background task (and the lock screen badge, and show toast notifications). I've got code that works when the app is running, and it runs through to completion as a background task, but nothing happens to the live tile/toast/badge. I'm assuming that's because I need to use the overload of TileUpdateManager.CreateTileUpdaterForApplication() that takes a string, but I don't know where to find the string and/or what the format is.
Any ideas?
Package relative app identifier (PRAID)
Edit per comment: Have you tried the Application ID that you specify in the Manifest or the ID you use to create the Secondary Tile?

CAsyncSocketEx + console application ?

I have console applicaiotn that currently uses CAsyncSocket.
I need to implement SSL so after some searching I found this project: http://www.codeproject.com/Articles/3915/CAsyncSslSocketLayer-SSL-layer-class-for-CAsyncSoc
For some reason same simple code that works fine on GUI code does not work in console app.
Has anyone exp. with CAsyncSslSocketLayer ?
Thanks.
CAsyncSocketEx uses a window as a sort of cheap thread to handle the event notifications that come from select(). Unfortunately, if you don't have a message loop, then the window which it creates will not receive these events.
http://support.microsoft.com/kb/90975
This article explains that a call to CreateWindow() needs to be called from a thread which has a message loop. And if you don't, then anything sent via PostMessage() won't get there.
I've recently started to tinker with this -- I want to remove the annoying hidden window and replace it with a normal thread. Their code relies on WSAAsyncSelect() in order to receive socket events... to a window. Yuk!
It's been a while since I had the same problem, but if I remember correctly, to use CAsyncSocket in a console app you need to add something like DECLARE_CONSOLEAPP (first two links shown below) to your console app. This should give your console a message pump to generate the socket notifications (OnReceive, etc.) GUI apps have these pumps but console apps don't, generally. The third (msdn) link below might also apply, it has more info and a different way.
If these still don't work, you should put breakpoints in your socket code and make sure your socket isn't instantiated in a thread or callback other than the main console app (the one that now has the message pump).
I think googling around for 'CAsyncSocket WinApp' or 'CAsyncSocket console app' would show more.
http://www.codeguru.com/cpp/misc/misc/consoleapps/article.php/c243/Console-app-using-MFC.htm
http://troels.knakkergaard.dk/code.htm
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/a6f1b72a-21d8-4046-a3dc-d7d29ece2ef6

Can I use captureScreenshotOnFailure to capture an error not only the failure in selenium RC?

I'm trying to capture the screen whenever something goes wrong, either an error or failure
You can use selenium.captureScreenshot() create a util method which you can call whenever you want to capture the screen shot. However if you are using Testng then you can refer http://satishjohn.wordpress.com/2012/06/04/selenium-testng-error-screenshot-listene/ but this is for failedtest passedtest skipped test. however you can put the capturescreen shot as a helper method in you utilities and call it under the testng method.