Automated testing for an MFC based user interface - visual-c++

I am looking to run a load of automated functionality tests on a user interface application of mine and was wondering what is the best software out there to carry out these tests. Preferably the software will be able to intergrate with Visuall C++ 2005. I have googled various software however there is so much out there I'm not sure what is best for what I need. Any help would be awesome, thanks.

for automated software unit tests I would recommend google test. There is a very good q&a on this platform, which you can find here.
Additionally, there is CPPUnitLite, which is developed by the author of "Working Effectively with Legacy Code", Michael Feathers.
I used AutoIt Scripts for testing a MFC application just a little bit, but it was not that easy to maintain them properly and build an effective logging system for failed tests.
However, the unit tests depend heavily on the architecture of your program and the structure of your class - especially the dependencies to other components / classes. So if you already have an existing MFC application, which was not built with unit tests in mind, you probably have to refactor a lot of things. Therefore, I would recommend the mentioned book. You can also use the classic "Refactoring" by Martin Fowler.

Did you take a look at AutoIt? It's a generic GUI scripting language which can also be used from C++/C#. I'm using it to automate parts of testing a Visual Studio addin.

Related

Haxe for enterprise application development

Is there anything available for Haxe which would be suitable for real-life enterprise application development? (i.e. A professional high level UI component framework.)
Just a note - I know we all love our tools of choice, but please try to keep it objective.. don't just recommend Haxe for something without thinking about whether it's really an effective tool for business requirements.
On one hand, as Jason suggested in his comment, there is missing a haxe-based native UI framework.
On the other hand, we don't really need a haxe-based UI framework, but using the UI framework available to the target platform is enough. Unlike building a library, which is better to be target independent, building a "real-life enterprise application" only requires targeting a specific platform. Since UI is highly dependent on the target platform, it means that we should use a target-specific UI framework. For example, the best UI solutions to an web app are probably jQuery, ReactJS, AngularJS etc., which all can be used in Haxe (jQueryExtern, react.hx, angular.haxe). For Flash/Java/C#, we can simply use any "native" libs by -swf-lib path/to/lib.swc, -java-lib path/to/lib.jar, and -net-lib path/to/lib.dll. For C++, however, although there is continuous improvement (watch the wwx2014 talk), it is still somewhat hard to use native libs.
We are making games in haxe + OpenFL + StablexUI. Not sure if it suitable to post their urls, so that you could see the quality. But it helps if you need your custom ui not native (iOS, Android).

How to do TDD using Pex for SharePoint based application

I am working on creating an application which is based on SharePoint Foundation 2010. I'm looking for a way to take advantage of the TDD methodology. While reseacrhing for TDD I read about Pex and Moles. Can anyone advice on what is the best approach to implement TDD for a SharePoint based custom solution. Please provide links to relevant articles or videos which can help.
It is not possible to use PEX for TDD. TDD requires you to write a failing test first, then write code to make the test pass. PEX requires you to write code first, then it generates tests for you. Something like NUnit is more suitable for TDD on .NET. Sorry, I don't know enough about SharePoint to comment on anything specific that it requires.

How well would MvvmCross and CSLA.net work together in a multi-platform strategy (ASP.NET MVC, WP, WPF, WinRT, Win8, Android, iOS)

Long time lurker, first time questioner here :)
I have been looking into our company's next software system architecture. We have been using CSLA.net, to some extent, as our business object framework and are thinking of building our new architecture around it. CSLA.net has support for the platforms mentioned in the title and we are looking for mvvm framework that would work well with it.
At the moment we only support windows environments but are also looking to support at least Android and iOS (also mono in general is under consideration). We are looking to share as much of the code as possible between the platforms and MvvmCross seems like really nice piece of mvvm (+) framework, especially in that context. I have watched few n+1 videos and what I have seen so far has been very impressive. I also like the Stuart's style of introducing the framework and concepts around it.
Has anyone tried to build a cross platform application that uses both of these frameworks (CSLA.net and MvvmCross)? If yes, what have been your experiences like? Also if Stuart could comment on the issue of how to merg the viewmodels of the two frameworks. I remember Rocky (Rockford Lhotka) recommending, as a general tip when working with mvvm frameworks, to inherit CSLA.net viewmodelbase(not viewmodel) and implement also mvvm framework's requirements into that class. You can find source of the viewmodelbase from https://github.com/MarimerLLC/csla/blob/master/Source/Csla.Xaml/ViewModelBase.cs.
Any input would be much appreciated.
Regards,
Harri
ps. I think, that this would make a great n+ video. Wouldn't it ;)
I've personally never used CSLA, but I have talked with it's original author, Rocky, both by email and in person.
CSLA presents itself as a business model object layer and that it can very successfully interoperate with independent Mvvm frameworks - see Rocky's post on CSLA+Mvvm
MvvmCross provides the more application and UI level support - and leaves application authors free to choose how they write their business services and models.
Because of this, yes I think it should be possible and even straight-forward to use both of the frameworks together if you want to. To get started, it might be useful to write some prototypes - and perhaps to look at the way other integration has been done - e.g. CSLA+Caliburn integration
ps. I think, that this would make a great n+ video.
I'd much rather see this type of article from someone who understands and uses CSLA. I would encourage all members of the MvvmCross community to contribute their own blog posts, articles, videos and github samples.
One caveat to this advice: I don't know if CSLA support Portable Class Libraries - if it doesn't then you'll probably need to use file-linking rather than PCLs in your app
Yes, you can use a multitude of MVVM frameworks; I've used CaliburnMicro and our own custom MVVM with success. If you haven't checked out Rocky's eBook series, you should definitely do so. One of the big gotchas is the limitations on reflection in Silverlight, hence also in WP8 and WinRT, so some reading up on that is well-advised.
Regarding Portable Class Libraries, you can't those for CSLA business objects (they require more stuff than is available in PCLs), so you do have to do the project linking. Typically, write the complete class in the .NET libary w/ pre-compiler directives, such as
#if !SILVERLIGHT
around code that can't be complied for Silverlight/WP8. I do use PCLs for some basic stuff, like enums and constants, but not for the business classes.
Xamarin have just released some updates that mean the latest framework 4.5 with async features can shortly be implemented...

HTML5 canvas and BDD - Cucumber

I was learning about Behavior driven development (BDD) recently, i see that its good for CRUD web application.
Is BDD tools such as Cucumber suitable for games, specifically are they good for HTML5 Canvas games?
Is there any other BDD tools for HTML5 canvas games? Or Is BDD only for CRUD applications?
I've just recently been experimenting with BDD and Games Development. But I'm building on the .NET & XNA Frameworks with C#. I'm using Visual Studio as my IDE and testing with SpecFlow and NUnit.
SpecFlow is the BDD/Gherkin tool - and as a group we've been talking about the game and fleshing out some requirements and documenting them in Gherkin... and going from there. The key is designing the game to be testable.
We've abstracted the game engine away from main "game loop" implementation that XNA requires so we are able to load it up and inject all of the dependencies it requires. We then run the tests on the engine and make asserts on the code afterwards to make sure that it is behaving correctly.
We decided early on that Graphics/Drawing/Sound/etc were out of scope of the testing... if they were broken in the end product, it would be very obvious. The test suite we've managed to build up just gives us the confidence that the mechanics of the game itself are working as intended (i.e. is game object A in the right location? does game object B die when hit with projectile C? etc. etc.).
So far it has been quite a good experience.
The question is: can you think of ways to interact with the canvas-based game in JavaScript?
Practically, could you open the JS console and interact with the game from there? Can you fire clicks at the right coordinates, can you press keys and most importantly, can you make assertions on what's being output by the game?
If the answer is yes, then you are able to automate the game in JavaScript and either Cucumber or Cucumber.js can definitely be used on top of that.
If the answer is no and you can't figure out a way to automate the canvas content in a similar fashion than what described above, then I'm afraid no automation tool could do the job.
To answer your second question: BDD has absolutely nothing to do with "CRUD" applications. It's about describing behaviours and automating examples that illustrate those behaviours. You can therefore take a BDD approach on virtually any types of application.
Shouldn't you find a way to automate your application, you could still consider writing scenarios to document the (expected) behaviour of your app. The automation phase is not mandatory, contrary to common beliefs :)

Which development platform should I use for desktop Windows application?

After doing web development for quite a while, I am faced with a new client who wants a simple database application to run outside the interweb.
He is quite adamant about using Microsoft products. "We don't want no steenking open sources" was his stance.
It's been quite a while since I actually did desktop development, and most of my tools are rusty, out of licence, or just plain lost. I have been concentrating lately on L.A.M.P. applications, but that doesn't quite transfer back to the desktop environment.
Some options:
database: MySql (my fav), Access, MSSql
language: C++, VB, PHP, Java, C#
I have been gravitating towards Access/VisualBasic, not because I like it very much, but because it is simple to set up and deploy. A database server (MySql, MsSql) would probably be too hard to deploy/maintain for the novice computer user. Even though from a purist point of view, C++ is the better language, it would take too much effort to bootstrap an application (IMHO). Java is too cumbersome (again IMHO).
The other consideration is cost. Although I can convince him to acquire proper software runtime licences, I probably won't be able to get him to purchase necessary development tools, and certainly the project isn't paying enough to justify substantial purchases which will probably not be used again.
I would appreciate your input on platform selection, development tools and application frameworks, thanx muchly.
Edit 23-May-09
Thank you everyone for your excellent advice.
I have settled on C# Express. So far, I've avoided learning C#, but what's another language?; and I have a whole week to get up to speed.
I am waffling on whether to go with Access or MSSql (Express) database. With Access, I can deploy the database as a stand-alone file, but MSSql requires that the database server be installed. (AFAIK)
The client requires that the application be installed in multiple locations, some of which are mobile and not connected to the interweb. The dicey part is reconciling all the copies of the database, and determining which is the connonical version.
I'd go with the Express editions of C# and MSSQL. Free and easy to use/set up/deploy. Here's a deeper link to some general material specifically about using VS Express editions for Windows applications.
I suggest: Just use Access. It works for small, simple, single user databases. It's not "just a database" it's also a "database application" and "database application development environment" in it's own right. That is: It's ridiculously quick and easy to throw together a db, CRUD forms, and simple reports; and the built-in VBA is handles most business logic, and you can allways call-out to C# dll's if you need to do anything "interesting".
Just tell the customer they need to loan you the production box for the duration of development (fair enough), and that Access (no need to mention which version) is about $200.00.
Customers who don't pay get they get what they ask for, not what they need.
C# + MSAccess/MSSql(express) = Profit.
I don't know exactly your requirements, but I would suggest the following:
If you had the budget:
Visual Studio Professional
MS SQL or Access
DevExpress Components for forms and
database persistence.
If you don't have the budget
Visual Studio Express
MySql
NHibernate or Linq2Entities
WPF or Windows Forms
I don't know why you think another database engine would be easier to administer than MS SQL. There's a free-as-in-beer edition of MS SQL called 'Express' that might suit. It supports all the same DDL and SQL features as the full database engine: in case you need them; it's just limited in size and number of CPUs.
Likewise there are free/express edition of the developer tools, which aren't missing much functionality (most notably perhaps the ability to write an installation program, but there are other free ways to do that). I don't know PHP or Java but if I were given a choice between C++ and C# (I'm familiar with both), I'd say that C# is virtually as capable for most applications except perhaps soft-real-time, and is quite a bit easier and more pleasant.
My preference would be C# with MSSQL Express. You can use the visual studio express edition for your development environment.
Have you considered Delphi or C++Builder there are free versions available.
Microsoft Visual Studio has express editions which are either cheap or free. That said, the choice is obvious: Winforms with C# or Visual Basic .Net (it's just a syntax question) talking to a MySql backend (for cost issues).
Microsoft Winforms is awesome but limited to Windows (Mono notwithstanding). Enjoy the project. It's way more fun than LAMP in my opinion, but not nearly as universal.
Edit: If you have the extra time and patience (of course you would have to eat the hours and not bill the learning time), though C# is brilliant and very mature (even in .Net 1.1 it was :), you may want to write the app in one of the Python variants for .Net. That's what I would do... Python has a huge following and will probably come up sometime in your non-Microsoft future. C# on the other hand... well, if you Mono it could come up, but otherwise, it's like learning Italian: good in Italy, but useless otherwise. (I should know, I'm writing this from my place in Venice...)
C# or VB.Net with SQLite.Net for the database. Pretty much cross platform across the board.
If you need a database local, one file (.dat) or the suggested from one's IDE (berkeleydb) or Sphinxsearch() Relevance sort order with pivot tables are often what users want and no database required only i/o according to document or graphics type.
If you are developing application on desktop. I would say
Scripting Language:ASP.NET(C#)
Database: MS SQL 2005
Server: Windows Server 2003 with IIS 6

Resources