Code Monkey home page Code Monkey logo

windowsphonetestframework's Introduction

#WindowsPhoneTestFramework

There is an introduction video on http://bit.ly/wp7-test

There are some Wiki Pages now on https://github.com/Expensify/WindowsPhoneTestFramework/wiki

##General setup

Before you try the general steps, consider using NuGet!

For adding BDD to a class library project, see https://github.com/Expensify/WindowsPhoneTestFramework/wiki/Writing-a-new-SpecFlow-test-project-for-WindowsPhoneTestFramework

For adding the test client to a WP7 project, see https://github.com/Expensify/WindowsPhoneTestFramework/wiki/Adding-testing-to-an-application

##NuGet setup - wp7 app

Use the "App - Windows Phone Test Framework" installer on nuget.org/List/Packages/WP7TestClient

Once you have installed from NuGet into your WP7 App, then:

  1. in the App.xaml.cs constructor, add

            #if DEBUG
            WindowsPhoneTestFramework.AutomationClient.Automation.Instance.Initialise();
            #endif // DEBUG
    

##NuGet setup - Class Library test project (BDD)

Use the "BDD - Windows Phone Test Framework" installer on nuget.org/List/Packages/WP7Test

Once you have installed from NuGet into your test class library, then:

  1. Change the project Build from "Any CPU" to "x86" only

  2. Edit app.config to provide the necessary configuration values for your app

    • Be especially careful about the paths

    • For finding the ProductId, see the WMAppManifest.xml file.

  3. Add a new feature:

    Feature: App Test
    	In order to test my app
    	As a WP7 Developer
    	I want to see it start and take a picture of it
    
    Scenario: Start the app
    	Given my app is uninstalled
    	And my app is installed
    	And my app is running
    	Then I wait 5 seconds
    	Then take a picture
    
  4. Run the tests

#Prerequisites

To get this to work, you need to install:

  • wp7 7.1 mango dev tools - so far not tested on the free Express versions

  • nunit

  • specflow

#Some possible problems:

  • For non-English setups (outside of US, UK, AU, etc) you may find you are not able to create the emulator - this is due to internationalised emulator device names (currently I'm looking for a list).

    • There is now some code to help work around this - but if the emulator does not start in your SDK, then please get in touch.

    • If you want to try fixing this yourselves, take a look at the device name in DriverBase.cs and EmulatorDriver.cs

  • For some script runners, then you may need to change script runner to have the 32-big flag set - try to find a 32-bit alternative (e.g. nunit-console-x86.exe) - or (at worst) use CorFlags.exe to change your test-runner.

     	"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\CorFlags.exe" "your target.exe" /32BIT+
    
  • The server part of the code opens a WCF service on http://localhost:8085 - it needs permission to do this - use:

     	 netsh http add urlacl url=http://+:8085/ user=<domain>\<user>
    

#Source code build

To start:

  1. Open and build the whole solution - Debug configuration

  2. Open a command prompt and run "cscript runspec.js" inside the Example directory - this will run all the specflow features

  3. Try running the emuHost command line tool, then try commands like:

        help
    	install
    	launch
    	click Go!
    	setText TextBoxInput=hello world
    	getText TextBoxOutput
    	doSwipe LeftToRight
    

#Source code - using the test platform

To work out how to use the test platform in your own apps:

  1. Try looking at the code for ExampleApp - there's only one line that's added to enable testing - Automation.Instance.Initialise(); in App.xaml.cs

  2. Try looking at the gherkin code in the ExampleApp.Spec features

#Questions

Please ask them on http://www.stackoverflow.com

#Contributing

Please do dive on in and help :)

windowsphonetestframework's People

Contributors

slodge avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.