D E V M A T E

Loading

Create your first Test

You are here:
Estimated reading time: 1 min

Let us create a simple example solution that demonstrates how to use devmate. For a more detailed example that actually shows the strengths of Equivalence Partitioning please refer to Chapter 3. We start by creating a .Net Core library project:

Let’s call the solution and the new library project “Hello World”

Then we add a unit tests project to the solution:

It is important that you select the “NUnit Test Project” since devmate currently only supports NUnit3. After adding the test-project your solution tree should look like this:

Now let us add a static method string Greet(string whom) to our library project:

namespace HelloWorld
{
        public static class Example
        {
            public static string Greet(string whom)
            {
                return $"Hello {whom}";
            }      
    }
}

To create a test model for this method just right-click inside the method and select “Test with Equivalence Class Method” from the context menu:

A file dialog will ask you where to store the newly created model. Store it somewhere in your test project:

Now the Equivalence Class Editor opens:

Let us add one valid equivalence class to the input factor “whom”:

  1. Click on the menu next to “whom: string”
  2. Select “Add Equivalence Class”

Then we add a representative and set its value to “World”:

Now we are ready to generate test cases: Just click on “Generate Test Cases”. A single test with input factor “whom” set to “World” is created. Next set the expected value to “Hello World”. Your test model should look like this:

Finally you are set to generate unit tests. Click on “Generate Test Code” and store the test in your test-project:

That’s it. You just created your first unit test using devmate:

The full source code of this example is available on Github.

Was this article helpful?
Dislike 0
Views: 58

Continue reading

Previous: License
Next: Setup

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

GetResponse, Google Analytics

We use Google Analytics for marketing purposes. You can disable these cookies.
  • __utmz
  • __utma
  • _ga
  • _gat

We use GetResponse for marketing purposes. This service cannot be disabled, otherwise the website functions will be limited.

Decline all Services
Accept all Services
Get Free Access Now to
9 eBooks!
All about Automated Software Testing
Proven experts
Learn to save up to 75% of your test efforts
Get Free Access Now!
Get Access Now! & Save 50%
Personal Trainer FREE Nutrition Custom Workout App
Get Access Now!
eBook Download
Enter your details to get your free ebook!
All about Automated Software Testing
Download Free Ebook
SUBSCRIBE
MY WEB
NEWSLETTERS
Lorem ipsum dolor sit amet, consectetur adipiscing