How to set QT_QPA_PLATFORM for test - cmake

I have some Qt tests that pop up a window when run. Therefore i want to add possibility to disable their rendering.Can I set in cmake environment variable QT_QPA_PLATFORM to offscreeen only for test?

Related

Teamcity: Update env variable from pop up

I am trying to update an environmental variable in team city through a build's plan pop up (when you press run it pops up a window to set some var).
So far i the given value remain only for the specific build and then it discards.
Does anyone has any idea?
thank you
Yes, that is the intended functionality: when using that popup, you are only modifying the parameter for that one run. For a permanent change, you need to open the project settings instead and go to the Parameters page.

How to see output from multiple File Watchers in JetBrains IDE

I'm using JetBrains GoLand IDE however I assume the answer would be common for any JetBrains IDE such as IntelliJ etc.
I've configured file watchers for:
go fmt, golint and go test
go fmt does not have output so it works fine.
golint and go test both have output. If I enable just one of them I see that output. If I enable both I see the output of golint for only a split second then it is replaced by the output of go test So I will never actually be able to read the output of golint
For now I solved this by making go test only display output on error, if it errors I figure I do not yet care about the output of golint but thought I'd ask anyway.
You don't need to enable go test as a File Watcher as the default test runner can execute on file changes.
To enable this feature, you can enable the Toggle test auto-rerun feature, which is the third button from top to bottom on the left side of the run test window. You can also configure the interval after which the tests run via the cog wheel.
Here's a reference for how to do this in IntelliJ IDEA, which is the same as in GoLand https://twitter.com/intellijidea/status/807239309992591361?lang=en
Known issue, please vote for WEB-14387 to be notified on any progress with it

How to do I control which CMake options appear only in "advanced mode"?

I use CMake 3.x in (more than) one of my projects. When I ccmake ., I get a terminal screen with various options to configure - supposedly, the ones a user might want to set manually before building. If I press t I enter "advanced mode", and numerous other options are visible.
Great, right? Except that some options in the non-advanced mode are such which I feel would be a better fit for the advanced mode and not be visible always (in my case it's the results of FindCUDA.cmake).
How can I make certain options only appear in advanced mode?
For make CACHE variable to be appeared in GUI (like ccmake) only in advanced mode, use command mark_as_advanced:
mark_as_advanced(my_cache_var)
Normally, mark_as_advanced is called by the script, which creates the variable. E.g. "Find" script marks as advanced some of variables obtained via find_path or find_library.
But it is correct to mark as "advanced" a variable created by some other script.

Run unit tests in IntelliJ IDEA from multiple modules together

How can I run all tests from two or more IDEA modules at once?
I'm using many modules and it is important to run all of the unit tests often and when I choose more than one folder to run, there's no 'run' option on the context menu any more.
Best way way: (edit after 3 years)
There is even a better way to achieve this. From the JetBrains JUnit Run Configuration docs:
Select menu "Run" → "Edit Configurations...". Click green plus in left top corner and select JUnit.
Select "Test kind" to "Pattern" and enter this regexp exactly as you see it: ^(?!.*IT$).*$ (it starts with caret ^ and ends with dollar $). This regexp says: all tests that do not finish with IT in their name.
Note: The regexp will match against the qualified file names, making it easy to exclude by module/packages as well. If your integration tests are grouped in a package com.me.integrationtests, the regex to match everything not in this package would be ^(?!.*com\.me\.integrationtests.*).*$.
Select "Search for tests" to "In whole project". Working directory should be set to top module working directory (it should be set by default).
Enter a Name for your test like "All Unit tests". I also prefer to mark "Share" option so this configuration won't disappear later. Click Apply and OK.
You can experiment with this regexp to fit your needs.
Original answer:
It is doable, although it's not comfortable.
Select first module, right-click on test/java directory and "Run All Tests". It creates test configuration.
Select "Edit configurations" and check "Share" on newly created configuration so it will be saved.
Select second module, "Run All Tests" on it, and check "Share" on this configuration as well.
In "Before launch" section, click "+" and select "Run Another Configuration" and then select first module's configuration.
This way you run configurations in a sequence and every configuration gets a new tab. Still, better than nothing.
Select all modules, right-click them and choose to run all tests. This will create a configuration called "Whole Project" which you can run again at any time.
I found this better than the accepted answer because this runs the unit tests separately for each module. If your test cases use module-specific resources during its run-time then the accepted answer's best way won't work.
Select all modules
Right click and choose to run all tests
Get a new run configuration
You have to create a "Run Configuration":
Go to the dropdown on the top, at the right hand of the "Make" button and click on it
Select "Edit Configurations"
Now click on the "+" button to add a new run configuration and select JUnit
Then, when configuring the "Run Configuration", you'll find a "Test Kind" dropdown, select "All classes in directory"
Select the directory you want to use as the root, you can choose the top level directory for your project or any of the directories for your modules.
Select the IntelliJ module from where picking up the classpath (it can be the top level project if it has a classpath)
For me both solutions didn't work or didn't work es expected.
For me I have 3 modules. My modules dependencies look like this
Presentation -> Domain -> Data
I just wanted to execute all tests together. So I came up with the 'Across module dependencies' approach
My Settings look like this:
This worked for me for a project with multiple modules.
Create a new JUnit run/debug configuration.
Test kind: 'All in package'
Search for tests: 'Whole project'
You will have to specify a working directory as well.
Another not so obvious case is when code coverage is needed on more than one project. The naive solution would be to select multiple projects and run all unit tests in them at once. As it turns out, unit tests may fail if the classpath changes and IntelliJ has exactly one classpath entry per run configuration. In this case, running unit tests on projects sequentially is actually sufficient. That's because at the end of each run IntelliJ (2017.2.5 Community Edition) asks if the collected coverage should replace or should be added to previously collected coverage stats.
If you use Gradle and have multiple modules, you can do it that way:
make sure IntelliJ is set to use Gradle to run the tests (Settings/Build, Execution, Deployment/Build Tools/Gradle -> Run tests using: Gradle)
right click over a module in the Project navigator and select Run test in [module name]
once done, left click on the configuration that was created in the top toolbar and select Edit Configurations...
in the Run field, simply add more modules just after the first one, for example, if you want to run tests in modules foo, bar and baz: :foo:test :bar:test :baz:test --tests *
rename the configuration, for example Test Foo + Bar + Baz
Now you can just run the configuration to perform the tests you need.

How to change the memory to test eclipse plug-in

I'm trying to test my plug-in, but it always comes up with only 40MB and I keep getting out of memory error. If I change the setting, it doesn't take it. It creates a brand new one with default value as shown below.
I think what you are asking is that you want some default arguments to be populated automatically for each new PDE launch configuration.
You can do this:
Go to preferences -> Plug in development -> Target platform
Select the target platform you are using and click edit
Click on the arguments tab
Add your program and vm arguments and these will be applied to all new launch configurations for that target platform
Here's a screenshot of the preferences page: