Possible solution for testing the UI


Author
Message
Scott Bressette
Scott Bressette
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 17, Visits: 53
I think I found something really great but I want to make sure that it isn’t a bad idea. My situation is that I want to use Strataframe for my windows development but we use Test Driven Development (TDD) in VB6. Microsoft has made testing the UI impossible with the build-in Unit Tests, so one is only left with the Active Accessibility Architecture which was never meant to be used for testing.



I was quite disappointed by all of this, but I think Strataframe can help me. The issue for .Net Unit Tests is that the build-in tester is blocking (or is block by) the thread running the windows app and the properties of a form is only initialized on the load of the form (hence the InitializeComponent(); in every contructor). Ultimately, this means you can’t test that your UI actually hooks to anything and you can never automate passing your user tests.



So, I tried initializing my test like this:

[ClassInitialize()]

public static void MyClassInitialize(TestContext testContext)

{



Globals.MainStart();



}

My Globals.MainStart() mimics the “Main” start up function in the app and it is “Global” because all of my unit tests initialize the app using this static class.



Then in the Globals class I have my ShowGateway method that Strataframe will call when I call “StrataFrameApplication.RunApplication()” at the end of the MainStart() method.



private static void ShowGateway(ShowGatewayEventArgs e)

{

e.ShowGatewayAfterMainFormClose = false;

e.ExitApplication = true;

}



The key thing is that I tell Strataframe to “e.ExitApplication = true;”. It appears Strataframe “handles” the blocking thread of my test and now all of my unit tests fire before the app actually closes. So, I can write tests to make sure that max field lengths are set, localization keys are used, or test any property of a control that otherwise would be impossible (or at least really hard) to test.



So, my question is, is it ok to set e.ExitApplication and expect the process to still be active to test data bound screens? I hope so because this solves a big problem for me!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search