Coded UI Test with Teamcity - wpf

I run MSTest to test WPF application (Coded UI Test) on a VM using Teamcity. I already installed test agent as interactive process but i keep getting this error in Teamcity log
Error calling Initialization method for test class Squarebit.Apms.Terminal.Wpf.Test.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=255012)
If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=254735)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
Can you help me resolve this problem or recommend some ways to run Coded UI Test using Teamcity?

Coded UI tests (CUIT) can't run from a service account since they need access to Desktop Windowing API set.
Please refer Installing the teamcity build agent section in http://jake.ginnivan.net/teamcity-ui-test-agent/ to setup teamcity agent as a non-service account.

Related

Setting up selenium automation framework to run tests depending on cloud settings

We have about 200 products having the same codebase. Apps are identified by appID and the content/features/feature configs are controlled via CMS. Like Feature 1 is enabled for AppID=1 and AppID=18 but not for AppID=53. Feature 1 can behave different in AppID=1 and AppID=18(again depending configs received from CMS).
We have automated tests based on AppID=1 and run them in CI environment. The picture is whenever we make a change e.g. for AppID=1 it affects to other apps as well so we want to test all apps to make sure nothing is broken.
Actually we can get the config from CMS for the AppID, but we don't know how should we proceed with it.
Can someone share his experience/solution if any?

rails 5 run script only after server start

I want to run a ftp listener class only when the server starts and not when console, generators, dbconsole, test, destroy, runner and rake commands run.
I've found some people doing same thing with rails 3 and 4 using checks like defined? Rails::Generators but I can't get it working in rails 5, I do not get any return with the defined check.
The config.ru file is only used by web servers and not loaded by the console script, rake tasks or even your test suite. What you put there is only executed when a server instance launches.
Web servers themselves have also ways to do this. When you use Puma for instance, there are hooks like on_worker_boot or after_worker_boot, which may come to help (http://www.rubydoc.info/github/puma/puma/Puma/Configuration/DSL).
However, I'd recommend integrating this into your deployed server environment and out of the Rails app.

Idea doesn't upgrade sources while in local debug for appEngine app

I created Spring Boot + Google App Engine application. For development purpose I use IntelliJ IDEA and Google Cloud Tools plugin. I'm currently using only localDebug, which means I don't deploy anything on Google cloud. The configuration for debug is below:
I created a simple service to be sure if my code is updated on change or not:
static int i = 10;
#GetMapping(value = "/test")
public String test() {
return Integer.toString(++i);
}
Unfortunately when I change my code (e.g. from i = 10 to i = 100) and restart the app (I mean press on Rerun (Ctrl+F5) or Stop (Ctrl+F2) + Run my code doesn't apply on server, which means Idea doesn't rebuild the sources on server start. As you see on the screenshot above I even tried to add Build Project step to Before launch, which didn't work.
So to apply changes I need to execute from command line mvn appengine:run -> press Ctrl+C to stop it, switch to IDEA and start debug again which is a pain in the ass.
Another option is to use Hot Reload (Update application, Ctrl+F10). It recompiles only changed classes and reloads resources. This is a cool feature, but unfortunately it doesn't work in a lot of cases which makes me unable to use it as a reliable reload.
Is there anything I can do to force IDEA compile my sources? Is it a bug I should report to plugin developer. Or maybe appengine uses some additional remote sources that require explicit call of maven?
I finally found a solution. As I understood the Google cloud plugin just complies the classes into target/classes but when it starts the appEngine, the engine expected unpacked .war to be present under target/demo-0.0.1-SNAPSHOT.
E.g. if because if I delete both directories I get the error below:
To solve the issue I needed to compile those sources:
In toolbar Run -> Edit configuration
Select Google App Engine Standard Local server
In before launch add Build Artifact -> demo:war exploded where demo is the name of your App.

How can I setup my environment to use h2 for tests and mysql for development?

I'm using the default configuration for the yo jhipster generator except that I'm using mysql as my "dev" database. When I run mvn test my tests succeed with no failures.
However, I found that if I ran tests a second time, the suite would fail since it would run against the "dev" database...that wasn't 'rolled back' or 'reset' after the previous test run. I would rather have expected it to run against an in-memory h2 database as configured in src/test/resources/config/application.yml that would be reset after each run.
How can I setup my environment with h2 for tests and mysql for development?
Thanks
I'm not sure if this is the "right" way to solve this but I was able to get my tests to pass on repeated runs by creating a new profile "test".
I then had to do 2 things:
1) change spring.profile in src/test/resources/config/application.yml to "test" instead of "dev" (to make the test application.yml different from the dev one)
2) use #ActiveProfiles("test") instead of #ActiveProfiles("dev") in my tests
The test application.yml uses an h2 database and is reset between runs as desired.
Note: I also had some success with successive test runs without creating a new profile by annotating my test classes with:
#Transactional
#TransactionConfiguration(defaultRollback = true)
as...
At the end of the test the transaction will be rolled back and the data discarded leaving a fresh environment for the next test to execute.
see https://spring.io/guides/tutorials/data/3/

Is there a way in phpunit to use the database extension together with the selenium extension?

Basically, I want to run selenium tests that allow the database to be setup to a define status before each Selenium test. How would I do this?
Given that Selenium just calls url's you could simply use the setUp() and tearDown() methods to get your database into a specific state. Transaction rollback is one approach to keeping the database consistent.
Then call url's mapping into the project under test (and your test database) e.g.:
$this->open('http://testing.example.org/system/under/test.php');
I have written my own database setup and teardown routines which I added to a child of selenium testcase

Resources