alanchinese Posted October 7, 2010 Posted October 7, 2010 I want to write an automated testing tool in .Net. For example, i have a winform including two textboxes (input) and one label (output): 1) open up the winform application 2) type numbers in two text boxes and click "calculate" button 3) verify the result in the label. I know that my testing tool can open up the application (using process). How do I achieve #2 and #3? Quote
Administrators PlausiblyDamp Posted October 11, 2010 Administrators Posted October 11, 2010 You would probably need to use various WinAPI calls to make this work. Firstly you would need to identify the relevant text boxes (FindWindowEx is probably the one to use), then attempt to set the text of the various controls (SendMessage is the one for this) and then you would need to simulate the button click (again IIRC SendMessage can also do this). This is not going to be a trivial task however and it might be easier to see if you can find a tool that already provides this functionality. Personally I would split the actual logic out from the form itself and have the button click event simply call methods defined in a separate class(es), this class(es) could then have a set of unit tests written which are far easier to automate and require no UI interaction. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.