Activity Unit Testing holding visual results - android-activity

I'm trying to test an Activity. This Activity houses a fragment which contains a listview. I am passing in a object (which is generated from the database) to be displayed within the listview.
I would like to perform this as a test so that I can fill the database with dummy data and just hand off the object to be displayed to the Activity. My problem is that Unit tests aren't really setup to let me play with and visually inspect my fragment with the dummy data. The tests just run and close the app right away.
Can anyone make any recommendations about how they would go about testing this? Or is my only option to create a test database and just use this database in the application, i.e. not using the testing framework.

I suggest that you look at a UI testing frameworks like Robotium which lets one test that UI elements have certain values - for example that a TextEdit contains certain text.

Related

Realtime datatable with asp.net core web app , EF core and SignalR

I want to retrieve data from Sqlserver database with EntityFramework core and do crud operations and show data table to client without refreshing the page (Realtime) , is there any source or example in this case ?
Not sure there is a definitive source for this, but it's not that hard to build yourself.
It should be relatively straight forward. In general you'd need
A model for the grid that defines the properties to show and edit, and also which row is selected.
An HTML Helper to change the rows from read-only to editable
A view to display the table.
An [edit] action link for each row enables you to select a row by ID for editing, and after clicking it, reloads the page and then the view can respond accordingly to change the type of the row from read-only to editable.
You could use Blazor or maybe Ajax to change a row from read-only to editable without refreshing the page, but I'm not sure if you need to meet certain requirements that discard using either of them.
John Ciliberti has written a recipe for a book, that works just like I described, find it on his Github page to get some ideas of what's involve.
If you need a more out-of-the-box solution, perhaps consider wiring up DataTables.js.

Testing ionic elements using UFT 12.02 in IE 11

I am rather new to using automated testing tools, and as a practical learning exercise, I have been trying to test a small web application using HP UFT 12.02(I updated to 12.51, but am now running into the same issue). The web app was created using the Ionic mobile development framework. I have run into a roadblock and haven't been able to find an answer or similar experience recorded anywhere.
I am not certain whether the problem I have is with UFT, the browser, or with the actual application itself.
I am using IE 11 to test the application. The UFT plugin for Firefox has been disabled at our site, and Chrome is not supposed to be installed on our machines, so I may have some awkward technical constraints.
I've tried recording my actions, and the only success I've had is using the "Insight Recording" mode. In order to make the test readable, I have to do a lot of manual inspection of the objects and renaming. Unfortunately, it seems there is a limitation to what I can select or inspect using UFT's tools.
Using the Object Spy, it seems that I can only select top-level web elements, and for the most part, it seems to work OK. But here is the blocker:
In the app, there is a form that contains a series of pop-up selectors that allow me to select a building, a floor, and a date to reserve a space on that building's floor.
Selector Screen from office reservation application
In IE, if I click the first selector (the Site), nothing happens--regardless of whether I have pop-ups blocked or not. I get the same result performing a manual test on any of those selectors outside of UFT.
If I perform a manual test in Firefox, I get an ion-alert object that contains a series of radio buttons and OK/Cancel
If I inspect the element with Object Spy, I get a "Web Element" that includes the entire contents of the
This includes the form title, all the ion-select elements and labels, etc (way too long to include in this question).
Object Spy view of the site selector object
Is it possible to select an individual element within the form without resorting to x,y coordinates on the screen or window? If so, how? I cannot guarantee who will be running the test in future, nor how their screen or browser dimensions will be set.

AB testing in Test and Target

Using Adobe Test and Target, I know I can setup mboxes and push various pieces of content into them for testing purposes. But how do I test two seperate versions of a homepage against one another? Is this something that can be test in test and target?
Do I just make one big mbox that holds the whole homepage?
You can create an mBox that 'redirects' to the versions of your homepage. You can do this by setting up separate experiences, and splitting your campaign based on a traffic split, or via some other metric.
For example, you can simply have one mbox that has two offers pointed to it. The first "offer" could simply do a default content - which would be your control.
The second "offer/experience" could simply be a java-script redirect to your alternative homepage.
You can then add multiple experiences/offers all posted to the same box that do similar tings to have a ABCD type of test.
I would avoid putting too much code in an mbox, as its loaded dynamically and can have performance impacts. I think a simple redirect to a static HTML page is a better way to go.

Best approach to test GWT localization?

I have a set of GWT UIs, some created directly in Java and others created using UI Binder ui.xml files.
I localized them following the official GWT guidelines (e.g. creating interface extending Messages interface).
I now wonder if there is an easy way to write a unit test to validate that message keys get replaced by the corresponding values from property files?
I guess I could do that using GWTTestCase, but actually I don't need a browser to render the page. Instead, it would be enough to get the raw string output and check with some regex that the messages are present.
Is that possible? Or is it better to test such things in running application like using Selenium?
Just a note. Besides the important things you are trying to validate, one of the critical points in my project during messages localization tests is to see: if the translated text fits the allocated space. If it's a box of fixed size, overlapping texts don't look nice. And this cannot be checked with unit tests. That's why the manual review is in to-do list when new locale is added or certain labels/messages are changed.
I'd recommend Selenium. Checking that the messages are present could be tricky, because in that case you should know the place where the label is located, in which tags. In my opinion, using GWTTestCase makes sense when it comes to testing controllers' behavior. Simple search by value guarantees only presence but not correct placement.
I think, it also makes sense to use those translation properties in the tests, so the strings are not duplicates in the tests.

Intercepting form submission and displaying results in cakephp without JS

In my Manager controller's add action I want to intercept the form submission, perform a search using the submitted data, and (if the query returns any results) display a list of results to the user.
My question is: what is the best way to display the results to the user? Should I just redirect to a different action (say search), or is there a nice way to display the data while remaining in the add action (session flash maybe)?
I know this can easily be done with the ajaxHelper and I am approaching this from that angle too, but I also need this functionality for my non-javascript users.
Any ideas appreciated!
badp,
you could just have a look at one of the generated (by cake bake controller ..., resp. cake bake view) controller methods named edit and look at the dataflow there.
It should be easy to adept it to your needs from there, as you can compare the dataflow and its outcome visually.