Have XCode start web server before running tests - ios

I have an iphone app that uses a rails backend to grab data from. Is it possible to have a before start hook for tests that start the rails server?

Why not use the pre-action in the Test command? You'll need to hit that + and add the New Run Script Action.
The only drawback is you can't abort the test if you cannot start the test. You can see a thread about that here: Is it normal for Xcode not to detect if a pre-action failed?

Related

Electron build timing out on CircleCI

I am trying to get CircleCI to work with my electron app but I can't understand how to stop the timeout error.
You can look at the app here: https://github.com/sauravyash/OutFlux
It fails on the npm test stage of the build with:
> outflux#1.0.0 test /home/ubuntu/OutFlux
> electron .
Xlib: extension "RANDR" missing on display ":99".
Xlib: extension "RANDR" missing on display ":99".
command ((npm :test)) took more than 10 minutes since last output
I'm new to the whole idea of CI so bear with me if the answer is obvious.
In case anyone sees this, you must understand that running electron by itself isnt testing anything, which is the point of CI. You should use something like Spectron to test if your app is successful in headless testing (testing without a real display).
https://github.com/electron/spectron

How to work with angular 2 profile for grails

it's great news that Grails 3.2.1 now comes with an Angular2 profile, but I don't know how to use it.
The profile description tells me that there should be the standard command like create-domain-class, but when I create an app through
grails create-app test-ng --profile angular2
I get a working angular2 project, but it even seems that this project is not recognized as grails app. When I enter the grails cli, I only get the commands like create-app which are available outside of projects.
What am I doing wrong?
your grails create-app test-ng --profile angular2
command should have created three folders in your test-ng-project-folder:
client
gradle
server
change to server and start grails command
now you should have the wellknown grails project.
but i am still on the first steps of examining the new grails-profile. so i hope i could help you.
Nowadays this layout is called "multi-project". Separate 4 the client and server applications. To make things easier, the tasks test, integrationTest, and bootRun have been created in the client application to make executing those tasks easier across the whole application.
Since Gradle executes tasks synchronously, and the bootRun task will never finish, it is important to execute it in parallel. At the root of the project:
./gradlew bootRun --parallel
Opening things also separately by 2 instances of your IDE or preferred text processor.
see the docs
grails list-profiles
show list of available profiles, I suggest you use this because for example now angular2 profile is angular and angular1 is angularJS.

How to debug browser tests with the new test package

browser tests need to be run from command line like pub run test -pdartium. Is there a way to debug such tests.
The Dart team is working hard to make tests with the new test package debuggable. Until the related issues are fixed you can use this workaround:
To run browser tests with the new test package, for example from WebStrom, including debugging, just replace the <x-test-dart ...> tag with a normal Dart script tag pointing to your test file and run it like any Dart browser application from WebStorm.
This also works for Polymer tests. Ensure you run await initPolymer(); or the appropriate initialization necessary for the used Polymer version.
I usually create a copy of the test entry page file where I can keep the replaced script tag.
pub run test -pdartium --pause-after-load
starts the test only after I click a "play" button on the test page. This gives me time to open up Dev Tools in Dartium and set breakpoints. I can also open up the Observatory and do stuff there.

Is there a way to get JUnit code coverage when running in the browser?

We are currently working on getting better code coverage for one of our JS libraries. I have the The Intern up and running, and can run tests in the browser. However, our libraries create DOM elements in some of their functions, making it so we can't run JUnit from the terminal because Node.js doesn't allow for DOM construction in tests. Is there a way we can get JUnit code coverage on the html and console output we get when we run The Intern in the browser?
I found the answer. From this link: https://theintern.github.io/intern/#local-selenium
Using ChromeDriver (Chrome-only)
If you’re just looking to have a local environment for developing functional tests, a stand-alone ChromeDriver installation works great.
1. Download the latest version of ChromeDriver
2. Set tunnel to 'NullTunnel'
3. Run chromedriver --port=4444 --url-base=wd/hub
4. Set your environments capabilities to [ { browserName: 'chrome' } ]
5. Run the test runner
Once you have that setup and running, you can run
node_modules/intern/bin/intern-runner.js config=tests/intern reporters=JUnit filename=junit.xml
This will allow the tests to run in a chrome instance, and then output the results to a report that can then be upload somewhere.

Execute a Script When XCode Runs My App

I have an iOS application that relies on a web server to keep track of information like players and games. Is there some way I can have XCode restart the server every time I start the app in the simulator? I am using Django so starting the server involves one terminal command.
Go to you target settings and add a Build Phase.
You can set an arbitrary script that runs at every build.
Here's an example taken from one of my projects:
Simply click on the Add Build Phase icon on the bottom right and select Add Run Script.
As you can easily find out by yourself, you can specify the shell to run the script into, as well as other handy options.
In your specific case a simple oneliner
python manage.py runserver
would probably do the trick

Resources