Use reflection for User Interface testing

G

Guest

I'm having difficulties getting a test application to work. The application
being tested runs on Pocket PC 2003 and uses the dotNet Compact Framework 2.0.

To be able to test our application we wrote a test application based on
information in an MSDN Magazine article that used reflection for User
Interface testing. See
http://msdn.microsoft.com/msdnmag/issues/05/01/TestRun/. In our case the
application being tested is somewhat more complex. To successfully run the
application the Main method must be executed.

When using the suggested Assembly.CreateInstance the application will raise
an exception. This because the CreateInstance method will run the
constructor. However, to run the application, the main method must be
executed.

While looking for other solutions I came across a method that I was looking
for. I am able to run the application in a separate thread and run the Main
method. This makes use of the AppDomain.ExecuteAssembly method. The problem
is that I need an object handle for the application.

I also tried to invoke the Main method after creating an instance of the
application. This causes an exception as well because the constructor will be
executed twice.

I think the best solution would be to use the ExecuteAssembly method and get
an object handle. But I cannot find a way to do that.

Solutions or alternatives are muchly appreciated…
 
G

Guest

mathijsuitmegen said:
I'm having difficulties getting a test application to work. The application
being tested runs on Pocket PC 2003 and uses the dotNet Compact Framework 2.0.

To be able to test our application we wrote a test application based on
information in an MSDN Magazine article that used reflection for User
Interface testing. See
http://msdn.microsoft.com/msdnmag/issues/05/01/TestRun/. In our case the
application being tested is somewhat more complex. To successfully run the
application the Main method must be executed.

When using the suggested Assembly.CreateInstance the application will raise
an exception. This because the CreateInstance method will run the
constructor. However, to run the application, the main method must be
executed.

To be able to test the application I decided to amend the application. I
wrote a new function that returns an object handle and does not run the home
form yet.

The way in which the test is being executed at the moment:
1 Create a new instance of the application in a new thread.
2 Run the "new" function (gets the object handle).
Note: if I would run the Main method at this point the application would
crash.
3 Run the home form to start the application.
4 Conduct the test.

This is not a proper way of testing, because the application does not run
like it would normally run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top