How do you tell if you're running in test mode in the Act framework? - actframework

How do you determine if you're running in test mode in the Act framework? The App.instance().mode() variable only returns DEV or PROD.

Whether you're running in test mode is indicated by the profile name. So you can do something like:
boolean isTest = App.instance().profile().equals("test");

Related

How to get job and telescope command on chrome's V8 x64.release version? (No symbol "_v8_internal_Print_Object" in current context)

I'm trying to get chrome's V8 (d8) x64.release version to use the V8 support tools in GDB, specifically for the job and telescope commands (predominantly the former).
My x64.debug version has this implemented and works, but even after building the x64.release version in a similar manner I still cannot get these commands to work in the x64.release version. The output is always as:
gef➤ job 0xd98082f7b51
No symbol "_v8_internal_Print_Object" in current context.
I have set args.gn before, and after building via ninja -C to include v8_enable_object_print = true in my args.gn:
is_debug = false
target_cpu = "x64"
use_goma = false
v8_enable_object_print = true
v8_enable_disassembler = true
I also have my ~/.gdbinit containing:
source ~/Desktop/tools/v8/tools/gdbinit
source ~/Desktop/tools/v8/tools/gdb-v8-support.py
See: https://chromium.googlesource.com/v8/v8/+/refs/heads/main/tools/gdbinit (for the support tool I'm trying to build V8 with).
How can I get my /v8/out.gn/x64.release/d8 to run with compatibility of the job command?
Am I missing something here? If so your help would be very helpful.
EDIT Alternatively how can I disable all x64.debug V8 DCHECKS?
Thanks all, appreciate your time here.
How can I get my /v8/out.gn/x64.release/d8 to run with compatibility of the job command?
I'm not sure. Try adding symbol_level = 1 (or even symbol_level = 2) to your args.gn. That definitely helps with stack traces, and might also be the thing that lets GDB find the _v8_internal_Print_Object function by name.
Alternatively how can I disable all x64.debug V8 DCHECKS?
There is no flag to disable them, but you can edit the source to make them do nothing. See src/base/logging.h.

Cross Browser Testing using Coded UI

I'm trying to run Coded UI tests in chrome. The code is:
BrowserWindow.CurrentBrowser = "Chrome";
BrowserWindow brw = new BrowserWindow();
brw = BrowserWindow.Launch(new System.Uri("http://www.google.com"));
But I am getting run time error: "value cannot be null.
Parameter name windowhandle".
I have VS2012 Ultimate and have also installed 'Selenium components for Coded UI Cross Browser Testing'.
Am I doing something wrong or something else needs to be checked?
Created a new Unit Test Project with all Selenium and Browser Drivers. Now I am able to navigate to the URL and run the application.

Start pairing with the code (Zwave)

I am developping a PoC Zwave using the project "Zwave Adapter Headless Host" and the program provided here
But trying this program, I have one problem and one question:
-When I remove my Zwave dongle, there is no change in the properties I see. Is it a normal behaviour?
-In my program, I would like to start pairing my dongle to another device by the code. Is it a possible thing?
Thank you
To answer your 2nd question :
Executing the function addNode(uint32 const _homeId, bool _doSecurity) make the Z-Wave controller to enter inclusion mode. Once you execute this function, you need to activate inclusion mode (physically) with your module (zwave light/sensor/...).
In other word, you can enter your z-Wave controller into inclusion mode using code and function, however, you need to physically press button on your other z-wave module to make them enter inclusion mode.
Bonus : To remove a module from your z-wave network, use the following function : removeNode(uint32 const _homeId)

View all XCUIElements in current screen

In UI/Automation Testing using Xcode 7, is there a way to list all of the XCUIElements on an app screen? Like in a tree or list, or even something in the Xcode UI? I can record tests for the app under test using clicks, but when I go to run the test, it fails. It fails because it can't find the XCUIElements from the generated code.
You can view it in Xcode hierarchy debugger.
From Apple Docs:
To enter the view debugger, run your app in Xcode and click the Debug View Hierarchy button in the debug bar.
You can debug the state of UI element using,
XCUIElement.debugDescription
It returns a snapshot of UIView in html format with a nice look up into the UI elements state with properties like element type(e.g textField, button), traits like focussed, enabled and values e.g placeholderValue.
You can also use accessibilityInspector app to look into accessibility attributes for the UI Elements on the view and verify that elements have accessibility properties set correctly.
Another handy tool to investigate the view is new hierarchy viewer which can be invoked during recording from debug console toolbar or Debug Navigator filter when you enable breakpoint in your test code.
Xcode 7 also has a nice test reporting under Report Navigator which can help you drill down exact reason with the test failure. e.g
UI Test Activity:
Assertion Failure: Asynchronous wait failed: Exceeded timeout of 10 seconds, with unfulfilled expectations: "Expect predicate `exists == 1` for object "Logout" Button".
Hope this helps.

Scout Eclipse ScoutServerTestRunner on client tests

now I run on new problems with scout testing.
I have Client fragment project for testing and I would like to test some templates I created.
My problem is that this templates contains some SmartFields and I would like to test them. For this I probably need ScoutServerTestRunner, so the server is up and running.
But If I try to add it I get error :
#RunWith(ScoutServerTestRunner.class)
#ServerTest()
I get error :
ServerTest cannot be resolved to a type
, all of my assert imports are deleted and I get error on my package line suggesting me Configure build path.
My guess is that this can't be done because it is client fragment and it can't connect to server.
But how then test smartFields ?
From your question I guess that there is some misunderstanding...
ScoutServerTestRunner and #ServerTest is something similar to ClientServerTestRunner and #ClientTest but for the server. You will need it for tests testing the server.
The classes are located in the org.eclipse.scout.rt.testing.server bundle.
If in a client test you need a server you have two possibilities:
A/ Start a server
You can start a server
This will probably not be the normal server (the one like in production) because you want to control the database or some external services. Authentication might also be slightly different (in order to control it and to have something compatible with your tests)
For the integration in your maven build, the maven-cargo plugin can be used to start your server before executing the client test suite.
B/ Mock the server services
Each of the services call that creates a ProxyService calling the server, can be replaced by mock (client only).
This is the preferred way for unit test, because you do not rely on a deployed server. You can also define for each test what the server answer will be.
This solutions requires probably initially more work, but in my opinion it worth it.
To register an alternative service, you can use:
TestingUtility.registerServices(
<activator instance>,
<priority>,
<service instances>
);
The service with the higher priority will win.
In each test, do not forget to un-register the alternative services you have registered.
SmartFields are using CodeTypes or LookupCalls. In case of a LookupCall, the LookupCall is probably calling the server through a LookupService. In case of a CodeType, the SmartField is internally using the CodeLookupCall class relying on a ICodeService.
In both cases, if you want to run your test without a server, you need to ensure that the client uses alternative implementations of the required services that do requires a server.