Project structure/methodology fo avoid/remedy xamarin forms.slow build times - xamarin.forms

Ive started my first a xamarin forms project. I have given up all simulators a while ago because of slow ...everything
The app performance itself is another thing, but Im talking about slow build and deploy times. This, in combination with that the app just crashes or gets a timeout when fetching the actual error is just gut-wrenching and I spend half my days waiting... ´nuff ranting right?
Are there specific project structure, for example so you can do most of your code through unit test for example? sadly the most trial and error I do has to do with gui-stuff.
I have trued Gorilla player, but it was harder that I thought to get it running, I have an open case at Gorilla-team..
Any tips to avoiding build->deploy to device is veeeee...extremely welcome.

Since I don't know your hardware setup I am going to propose different solutions. Maybe one of them might help.
Pick the platform that runs the fastest. When developing on a Windows machine, then probably the UWP project builds the fastest (since you cut out the Mac in the daisy build chain).
When using an Android simulator make sure to fully use hardware acceleration Making the Android emulator run faster
Visual studio for Mac beats its Windows counterpart hands down when it come to build times in my experience. I gave up on developing XF Apps on Windows since I was having countless build issues and some builds took forever. The situation improved dramatically when moving to a Mac.
Maybe you could also try using the Live Player which should give you immediate feedback when it comes to you UI https://learn.microsoft.com/en-us/xamarin/tools/live-player/
Adding unit tests might also speed up things considerably. NUnit is a pretty popular framework.

Another answer mentions that building to UWP is fastest, but I don't target UWP ever so I wouldn't know about that. I just do iOS and Android. Android is faster. We also have the question of simulator/emulator vs real devices. Of the full gamut of options out there to run the app, I've found that building to a physical Android device is the fastest way to build/run.
You could also check the project properties to make sure you have all optimizations set up for that, such as (for Android in particular):
Use Shared Runtime
Use Fast Deployment
Linking: None
DISABLE ProGuard
Aside from building all the way to a phone every time to test things, setting up your project for unit testing that incorporates mocks can also get you going faster. That would typically involve dependency injection and a unit testing framework. I have a Xamarin.Forms app that does just that on Github if you want to see how to do that.

Related

Appium or Xamarin UI test - experiences and drawbacks

Not sure if this is the right place to ask this kind of questions because it is also a bit personal favor but what are your experiences with Xamarin UITest and/or Appium. Until now I only had experience with Appium but for our new project we maybe want to use Xamarin UITest.
Wrong answer, with Xamari UI Test framewor you can automate Progressive Mobile Apps, Hybrid apps a Native Apps, on Android and IOS
Some samples here:
[https://www.zuehlke.com/blog/en/mobile-ui-testing/][1]
We have a React Native app that we are currently testing with Xamarin UI Test, and I've spent quite a while comparing these test frameworks. It looks like our team is going to switch to Appium now. Here is what I like about Appium:
Much better documentation, more resources online
More features (which allows you to automate more stuff)
Runs slightly faster on Android (30% faster maybe), not seeing almost any difference with iOS
Bigger, more active community, less chance of framework becoming deprecated
Based on our experience it's more reliable. With Xamarin we kept getting "device port 27753 in use" or smth like that which we couldn't resolve.
More "device farm" options to run tests on. This is very important for us. With Xamarin the only options I've found are BitBar (flakey, adds about 5 minutes overhead to test runs) and Xamarin Test Cloud (expensive). With Appium there are more options (SauceLabs seems to be working great, we are only starting to use it though)
Allows you to choose from a lot of programming languages (our team is most comfortable with TypeScript)
Client-server architecture which allows test code to run on-premises (might not be a benefit to many teams, but it is to us), so the test code is able to access our internal APIs thanks to this
Firstly, SO is usually not the right place for such questions as such questions usually get closed as off-topic and primarily opinion based. Luckily, xamarin.uitest is a very unpopular tag, hence, your question survived :)
For what Xamarin.UITest does, its actually not bad. The biggest issue to consider is that Xamarin.UITest requires your app to be written using Xamarin.Forms and for me, personally, this is the biggest drawback.
Other issues, that I've encountered:
Scrolling is terribly slow
Limited API (Only basic UI properties can be evaluated, see here)
Minimal differences betqeen Android and iOS which can become really annoying, depending on your use case
Other than that, Xamarin.UITest is a pretty solid UI-testframework and if your app is written using Xamarin.Forms, I would recommend you to use Xamarin.UITest.

Flex application automation using PhantomJS

I have to automate a Flex based rich internet application. We have tried out a few options like Ranorex and RIA Test. While the GUI based automation tools (both open source and commercial) do a decent job, the test scripts are hard to maintain and often result in flaky reports. PhantomJS has worked for me in previous projects very well but I am not sure if it works with Flex. Can anyone suggest if PhantomJS works at all with Flex?
I don't know anything about flex, but the tag excerpt suggests that it extensively uses Adobe Flash and Adobe Air. PhantomJS doesn't support Flash or other plugins (anymore). There are forks which enable flash, but they are a little behind with the versions.
Honestly i think this might have as much to do with how you build the automation tests that makes them hard to maintain. For instance with Ranorex instead of building 5 different recordings to test 5 different things build 15 tiny recordings that do only one thing, that can be pieced together in 5 different ways, then to maintain your scripts you just need to maintain those 15 recordings, and if all the scripts break at the same place the maintenance simply becomes ok why did that one tiny recording fail rather than ok let me maintain this suite of 5 recordings it's let me fix this one recording, and that will fix the larger recordings.
Try and use Testcomplete identifies most of the complex Flex controls not need for any compilation of helpers with your application libraries and if you have a team of dedicated automation engineers they should easily be able to create a reusable and maintainable GUI based automation pack around Testcomplete (vbscript)

Advantages of a build server?

I am attempting to convince my colleagues to start using a build server and automated building for our Silverlight application. I have justified it on the grounds that we will catch integration errors more quickly, and will also always have a working dev copy of the system with the latest changes. But some still don't get it.
What are the most significant advantages of using a Build Server for your project?
There are more advantages than just finding compile errors earlier (which is significant):
Produce a full clean build for each check-in (or daily or however it's configured)
Produce consistent builds that are less likely to have just worked due to left-over artifacts from a previous build
Provide a history of which change actually broke a build
Provide a good mechanism for automating other related processes (like deploy to test computers)
Continuous integration reveals any problems in the big picture, as different teams/developers work in different parts of the code/application/system
Unit and integration tests ran with the each build go even deeper and expose problems that would maybe not be seen on the developer's workstation
Free coffees/candy/beer. When someone breaks the build, he/she makes it up for the other team members...
I think if you can convince your team members that there WILL be errors and integration problems that are not exposed during the development time, that should be enough.
And of course, you can tell them that the team will look ancient in the modern world if you don't run continuous builds :)
See Continuous Integration: Benefits of Continuous Integration :
On the whole I think the greatest and most wide ranging benefit of Continuous Integration is reduced risk. My mind still floats back to that early software project I mentioned in my first paragraph. There they were at the end (they hoped) of a long project, yet with no real idea of how long it would be before they were done.
...
As a result projects with Continuous Integration tend to have dramatically less bugs, both in production and in process. However I should stress that the degree of this benefit is directly tied to how good your test suite is. You should find that it's not too difficult to build a test suite that makes a noticeable difference. Usually, however, it takes a while before a team really gets to the low level of bugs that they have the potential to reach. Getting there means constantly working on and improving your tests.
If you have continuous integration, it removes one of the biggest barriers to frequent deployment. Frequent deployment is valuable because it allows your users to get new features more rapidly, to give more rapid feedback on those features, and generally become more collaborative in the development cycle. This helps break down the barriers between customers and development - barriers which I believe are the biggest barriers to successful software development.
From my personal experience, setting up a build server and implementing CI process, really changes the way the project is conducted. The act of producing a build becomes an uneventful everyday thing, because you literally do it every day. This allows you to catch things earlier and be more agile.
Also note that setting build server is only a part of the CI process, which includes setting up tests and ultimately automating the deployment (very useful).
Another side-effect benefit that often doen't get mentioned is that CI tools like CruiseControl.NET becomes the central issuer of all version numbers for all branches, including internal RCs. You could then enforce your team to always ship a build that came out of the CI tool, even if it's a custom version of the product.
Early warning of broken or incompatible code means that all conflicts are identified asap, thereby avoiding last minute chaos on the release date.
When your boss says "I need a copy of the latest code ASAP" you can get it to them in < 5 minutes.
You can make the build available to internal testers easily, and when they report a bug they can easily tell you "it was the April 01 nightly build" so that you can work with the same version of the source code.
You'll be sure that you have an automated way to build the code that doesn't rely on libraries / environment variables / scripts / etc. that are set up in developers' environments but hard to replicate by others who want to work with the code.
We have found the automatic VCS tagging of the exact code that produce a version very helpful in going back to a specific version to replicate an issue.
Integration is a blind spot
Integration often doesn't get any respect - "we just throw the binaries into an installer thingie". If ithis doesn't work, it's the installers fault.
Stable Build Environment
Prevents excuses such as "This error sometimes occurs when built on Joe's machine". Prevents using old dependent libraries accidentally when building on Mikes machine.
True dogfooding
You inhouse testers and users have a true customer experience. Your developers have a clear reference for reproducing errors.
My manager told us we needed to set them up for two major reasons. None were really to do with the final project but to make sure what is checked in or worked on is correct.
First to clean up DLL Hell. When someone builds on their local machine they can be pointing at any reference folder. Lots of projects were getting built with the wrong versions of dlls from someone not updating their local folder. In the build server it will always be built of the same source. All you have to do is get latest to get the latest references.
The second major thing for us was a way to support projects with little knowledge of them. Any developer can go grab the source and do a minor fix if required. They don't have to mess with hours of set up or finding references. We have an overseas team that works primarily on a project but if there is a rush fix we need to do during US hours we can grab latest and be able to build not have to worry about broken source or what didn't get checked in. Gated checkins save everyone else on your team time.

Recommended project structure for Flex builds

I'm starting a new project using Flex3 for a reasonably intricate UI getting its data from a collection of RESTful web services. I wondering what experiences others have had in structuring a moderately complex Flex project. The issues I'm thinking about include:
I want to use our FlexBuilder licenses for visual editing of layouts and debugging code on Eclipse
automated build script so that we can use a CI server
testing strategies, particularly automatable unit tests
cross-platform Linux and Windows development environments (yes, I know the Linux version of FlexBuilder doesn't do visual editing, but everything else should ideally run cross-platform)
dependency management for at least the Java code (are there library dependency managers for Flex?)
I've just burned a day trying and failing to get a maven2/flex/jetty build setup working smoothly (based on Jeff Maury's tutorial). I'm not dead-against using Maven as we go forwards, but I'm sure there must be a less painful route. The main issue I had (other than maven documentation being patchy) is that maven's "single artifact per build" rule means that you have to jump through a lot of hoops with a complex build, and I'm not enough of a maven initiate not to trip over the hoops and fall on my face!
Would Ant and Ivy be a better option than maven2? What other choices are there?
I don't know Flex development but I know CI so I'll comment on that aspect.
I work on CruiseControl, so that's what I use (when not being paid to setup something else). And there are blog entries that describe setting up Flex projects under CC for both Windows and Linux. CC has been around for a long time so there is a large community of users and lots of 3rd party tools that work with it.
But other people are likely to recommend Hudson and it would be hard to argue against them. Hudson is very easy to get up and running and has a nice web based UI. This project is very active, has lots of fans and lots of buzz and has matured very rapidly. I don't have anything bad to say about it. This blog entry describes running acceptance tests under Hudson.
I don't know enough about Maven to offer advice there but I'm working with Ivy at a client right now and I really like it. We've got a combination of Java and C++ code and we're able to get Ivy to do what we need.
Well we are using maven. With some help of a lot of different web sties I have an enterprise application being built using maven.
This article via adobe has really help a lot.
http://www.adobe.com/devnet/flex/articles/fullstack_pt1.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt2.html
http://www.adobe.com/devnet/flex/articles/fullstack_pt3.html
You really need a common configuration project that will be shared between both flex and java, and possibly your c++ code. This article explains how to set that all up.
Down side, if you are not knowledgeable with maven there is a slight learning curve.

What Tools Do You Recommend To Auto-Build Your Application? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
As recently as several years ago, the developers actually made the builds that went to clients. This was obviously a disaster for reasons too numerous to list.
Then when we started to learn the errors of our ways, we looked for a way to auto-build the entire application on a dedicated build machine. The culture at that time was very averse to bringing in outside tools, so we built our own autobuild system by writing a VB app.
This worked fine for a while, until the project's structure started to change, new projects were added, and we needed to build the application in different ways. Then then weaknesses of our hand-rolled autobuilder became apparent and, over time, increasingly onerous. This disease has progressed now to the point where QA (who owns our build process) can't even maintain the autobuilder because it requires more and more programming skill. Every time we add a project or change something in an existing project, it consumes more developer time just to make it work. There have been days when we were unable to produce a build because the system was broken.
I'm now in a position where I can change this process, and I'm looking to scrap the entire system and put something else in it's place. My goals are:
Have an autobuild system that can run with zero human interaction at a specific time every day. It should be able to gather all the source code, compile all the apps, create the setups, put the finished products on a network share, and possibly trigger the automated testing system to kick in (we use QTP).
The autobuild system should be flexible enough to easily adapt to changes in the project without rrequiring a major overhaul.
It should be simple enough so that QA can own the system and not require developer resources to make changes to how builds are made.
What are your experiences? Can you recommend an autobuild system? Should I have different goals?
I'm currently using CruiseControl integrated with Ant to control project builds. This allows flexibility of build schedules and means you can automate the entire build process fairly easily using Ant scripts. Also, during defect fixing periods you can have CruiseControl set up to watch for source control submissions instead of time periods and build when these occur. This allows developers very quick feedback on defect fixes.
I use FinalBuilder and FinalBuilder Server for nightly builds. It's a bit buggy at times, but if you think it through it's quite easy to create extensible projects that can build X project type, build it's database from change scripts and deploy it to a testing server.
It can also handle all kinds of wierd and wonderful things like ZIPing a nightly build and uploading it to an FTP or creating ISO images automatically.
Definitely look into MSBuild if you're on the Microsoft stack.
Joel is always going on and on about how great FinalBuilder is, so that might be worth a look as well.
We just migrated from a hand-rolled set of Perl scripts to a Buildbot setup. I found it because that's what Google's using for Chrome.
You can do nightlies, or it can integrate with source control to do an isolated test build whenever anybody does a checkin, or a variety of other things. It's also parallel; you can have more than one machine in the build farm, either for specialized duties or just to handle more load.
The entire system is written in Python, so it's platform-agnostic, which is important if you need to do builds on more than one platform. It can do anything you can do from the command line; we have it calling MSBuild for user-mode components, a DDK build for kernel-mode pieces, and running products for unit test builds.
Out of the box it supports most OSS source control tools, but if you're using TFS or something else you may need to modify the package that you install on the slave machines.
I think you are on the right track here.
Whoever looks after your automated build process needs to have a fundamental understanding of how your solution fits together. This doesn't necessarily mean knowing how to write code or architect solutions, but they will require a solid understanding of how the solution compiles, packages itself etc.
You might need to share responsibility for builds between people or teams to accomplish this. I'd say that a daily build is a "team responsibility".
I'd look at establishing a baseline build configuration which can be extended for "special use" builds (besides just building a release version), e.g. internationalized releases, fxCop/Quality Tools config, build + run Unit Tests, continuous integration builds, a build config to run on developer workstations, etc.
Instead, I'd aim to achieve the following:
Automatic versioning, signing etc
Ability to produce verbose output (logging) to help debug build breaks
On that point - it should handle errors properly, capture as much information and log it properly
Consistency - It should work the same way each time to produce repeatable outcomes
Run in a clean, limited access environment
Well commented/documented so that it can be understood by new staff, etc.
Option to generate release notes, compile metrics, produce reports (if this option is available)
Ability to deploy to multiple environments
Support different ways to obtain source code from source control, e.g. by changeset, label, date, etc
As for tool recommendations, I've used FinalBuilder, Visual Build Pro, MSBuild/Team Build, nAnt, CruiseControl and CIFactory plus and good old fashioned batch files.
Each has its pros and cons, I'm not going to make a recommendation except to say that the products with decent UI support were a little bit easier to work with, but at times were far less powerful. If you're working with VIsual Studio, MSBuild is very powerful, but has a somewhat steep learning curve.
As of tools delivered with MS Visual Studio you might want to use MSBuild. Additional Community toolsets for MSBuild will even give you the possibility to checkout code from Subversion and zip output.
We're using it successfully in our company. Projects consists of several solutions with 100+ subprojects. Works like a charm.
Visual Build Pro is nice, if your build machines are Windows. I think this would fill the requirement you have about QA owning the system. But don't get me wrong, it's pretty powerful.
We use CruiseControl.NET and UppercuT (which uses NAnt) to do this. UppercuT uses conventions for building so it makes it really easy for someone to get started by answering three questions (What is the solution named? What is the path to source control? What is your company's name?) and you are building.
http://code.google.com/p/uppercut/
Some good explanations here: UppercuT
We use the Hudson buildbot for for big Java web app building from ant build scripts. Hudson is pretty sweet for our purposes. It has a master/slave setup so builds can be done concurrently (on a timer or on-demand). Slave nodes can be any OS/hardware combo provided it has the needed build tools already on it and is on the network (and won't crash every 10 min).
Full web-based interface including live console output, change logs, artifacts from the build are available across the network including previous builds (if successful). Awesomesauce!

Resources