RhoSimulator lets you run your RhoMobile applications on a simulated device, so that you can see how it looks, test and debug it. RhoSimulator builds and runs your application much faster than other emulators, making it useful for rapid testing and debugging.
Once your application is running under RhoSimulator, you can make changes to your source files and just press ‘Refresh’ to see your changes live, i.e. generally no RhoSimulator restart is required. The restart of RhoSimulator is required only if a model was added/modified or some code was changed in the AppApplication
class.
Note: As the name implies, RhoSimulator simulates not emulates different platforms. This difference is significant, it means that, while your application will generally act as if it was running on the selected platform, you should not expect all features to work exactly as they will on a real device. The use of RhoSimulator is encouraged for testing and debugging, but you still need to test on a physical device (or, at the very least, the platform’s native emulator) to make sure your application behaves as you expect
Ensure that your application is configured properly and successfully runs in RhoSimulator from the command line
Note: Windows Mobile and Windows CE apps that use the webkit will not be able to run in the RhoSimulator because of the limitations of the memory in the simulator.
The below screenshot shows run configuration for RhoSimulator for the iPhone platform
The below screenshot shows the RhoSimulator mimicking an iPhone
The below screenshot shows the Web Inspector provided by the RhoSimulator
RhoSimulator has two windows, one is where your application runs and the other is the Web Inspector, a powerful debugging aid that allows you to inspect the web interface for your application and try out certain changes live on your HTML and CSS.
In the ‘Elements’ tab of Web Inspector you can examine the DOM tree structure of the HTML page that is currently visible.
You can select and examine individual elements in the DOM tree by using one of the following methods:
Click on the ‘Magnifying glass’ icon in the bottom toolbar
In the device window, click on the HTML element you want to inspect
In the inspector window, the selected element is highlighted
In the ‘Elements’ tab search box, you can enter text to match any of the attributes, content or even tag name of the element. All the matching elements will be highlighted.
You can also navigate directly to the required HTML element by expanding/collapsing the tree using the disclosure arrows to the left of all tags with children
The Web Inspector lets you modify your page and styles live. This provides a quick way to try out HTML and CSS changes to see how they look without having to go back to RhoStudio (or other IDE), providing you with very fast feedback and avoiding the tedious edit-save-refresh cycle.
Note: These changes are only temporarily applied to the page inside RhoSimulator. To make them permanent you must actually update your HTML/CSS files.
The following changes can be made live:
For example, edit the CSS class attribute.
For example, the ‘Login’ button name is changed to ‘Sign in’.
For example, change ‘text-align’ to ‘right’
For example, disable ‘text-align’
For example, add a new ‘border-style’
The ‘Resources’ tab allows you to see the resources being loaded and used by the current page.
This includes assets like:
as well as cookies, if your application uses them
The ‘Network’ tab allows you to see the HTTP requests your application makes and how long they take to fetch.
The ‘Scripts’ tab allows you to set breakpoints and inspect variables in your JavaScript code.
When the application is paused at a breakpoint or by pressing the ‘Pause’ button, you can inspect the values of JavaScript variables.
The ‘Console’ tab allows you to view log messages and also to execute and debug your JavaScript.
The console can also be accessed as part of any of the other tabs by using the ‘Show console’ button at the bottom left corner of the other tabs.
The Console logs messages from the system and also from your application code.
To generate log messages from your application (JavaScript) code, call the console.log() method
console.log("Hello, world");
This output is not visible by the end user, and is very useful for debugging.
The console allows fully interactive JavaScript usage.
You can:
Run one of the following commands inside the application folder, depending on the platform you want to simulate:
Android
rake run:android:rhosimulator
iOS
rake run:iphone:rhosimulator
Windows Phone 8
rake run:wp8:rhosimulator
Windows Mobile
rake run:wm:rhosimulator
Windows (desktop)
rake run:win32:rhosimulator
You can use RhoSimulator along with RhoStudio debugger to debug the Ruby code in your RhoMobile application.
Ensure that your application is configured properly and successfully runs in RhoSimulator from the command line
RhoStudio will, by default, switch to the ‘Debug’ perspective, and it will establish a connection with RhoSimulator so that you can: