Coder Social home page Coder Social logo

coreyt / testura.code.unittestgenerator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from testura/testura.code.unittestgenerator

0.0 2.0 0.0 877 KB

A simple framework/software that inspect your assembly and generate unit tests for you

C# 100.00%

testura.code.unittestgenerator's Introduction

Testura Logo

Testura.Code.UnitTestGenerator is a simple framework/tool to inspect assemblies and generate unit tests from exported types. It's created as a simple example on how you can use Testura.Code

Client

https://github.com/Testura/Testura.Code.UnitTestGenerator/releases

Basic info

Supported test frameworks

  • MsTest
  • NUnit

Supported mock frameworks

  • Moq

Will generate

  • A unit test file for all types that are exported and isn't static or abstract
  • A setUp that initialize the type under test (TuT) by looking at it's first constructor.
  • All required parameters will either be mocked, initialized or set to some default value.
  • Will generate fields for TuT and required parameters
  • All files created will follw your assembly namespace/directory strcture.

Example usage from api

var unitTestGenerator = new UnitTestGenerator();
unitTestGenerator.GenerateUnitTests(DllPath, TestFrameworks.NUnit, MockFrameworks.Moq, OutputDirectory);

GUI

Gui

Example of generation

Type under test

namespace Testura.Android.Device.Services.Default
{
    public class UiService
    {
        public UiService(IScreenDumper screenDumper, SomeClass someClass, string myString, int number)
        {
        }
    }
 }

Generated unit test

namespace Testura.Android.Tests.Device.Services.Default
{
    [TestFixture]
    public class UiServiceTest
    {
        private Mock<IScreenDumper> screenDumperMock; 
        private SomeClass someClass; 
        private UIService uiService; 
    
        [SetUp]
        public SetUp()
        {
            screenDumperMock = new Mock<IScreenDumper>(); 
            uiService = new UiService(screenDumperMock.Object, someClass, string.Empty, 0)
        }
    }
 }

testura.code.unittestgenerator's People

Contributors

millebo avatar

Watchers

Corey Thompson avatar James Cloos 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.