Finds and Facts for Coded UI Test/C#

Shared Project

  • Shared Project does not produce a reusable assembly, therefore it can only be consumed within a solution;
  • Shared Project cannot have dependencies on third-party libraries;
  • Shared Project cannot be referenced by Test projects (Unit Test, Coded UI Test, etc.);
  • Conclusion: We cannot use Shared Project for CUIT.

Test Projects

  • Test Project can only reference .dll, NOT source code,
  • therefore Shared Project is not for Test Projects.

Data Source

  • Read only, there is no way to modify data source file in run time;
  • zero base for data row, header row is not considered for index;
  • Each Data Source data row corresponds one iteration, which includes [TestInitialize], [TestCleanup] and [TestMethod] with [DataSource];
  • workaround  to write/update Data Source.

WIP – code reuse

Class Library

  • Class Library can be referenced within solution as .dll, it will re-compile if there are changes.
  • Can Class library be referenced outside of a solution?
    • should a class library be added in a solution?
    • should a class library be referenced to a project outside of its original solution without being added to the solution?
  • Considering to put Class Library in a separate Git Repository from the Test solution?

Extension Methods

  • What is an Extension Method?
    Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.
    An extension method is a special kind of static method, but they are called as if they were instance methods on the extended type.
  • How to use extension methods?
    An extension method is a static method of a static class, where the “this” modifier is applied to the first parameter. The type of the first parameter will be the type that is extended.
    Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.
  • What is the difference between an Extension Method and a regular class library method?
  • extension methods must be public static? – Static yes, public?
  • What should the ExcelReadWrite class be, regular class library or extension method?
    • not even necessary for a regular class library, but still can be think of.

Functional Library



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s