SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

All unit test are discover able in Sharpdevelop Testexplorer.

Last post 08-08-2017 7:35 AM by Bhwn_mahawar. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-31-2017 10:06 AM

    All unit test are discover able in Sharpdevelop Testexplorer.

    Hi,

    I am able to see all the nunit test case in visual studio in test explorer but wen i use sharp develop i can see only one test case.

    is there any solution for it?

  • 08-06-2017 9:26 PM In reply to

    Re: All unit test are discover able in Sharpdevelop Testexplorer.

    Have you decorated each of your test classes with [TestFixtureAttribute] and each of your test methods with [TestAttribute]? Are your test classes all public and non-abstract? Are your test methods all public, returning void and have no parameters?

    If you post an example of a class and method which should show up in the unit test pad but doesn't then we might be able to suggest why it's not appearing.

    Simon

  • 08-07-2017 8:15 AM In reply to

    Re: All unit test are discover able in Sharpdevelop Testexplorer.

    namespace TableViewAutomation
    {
        [TestFixture]
        public class TestExecution
        {
            ITestCaseService testCaseService = Factory.UnicornServices.GetTestCaseService();

            [ClassInitialize()]
            public void ClassInitialize()
            {
                // MSTest runs this code once before any of your tests
            }

            [ClassCleanup()]
            public void ClassCleanUp()
            {
                // Runs this code once after all your tests are finished.
            }

            [Test]
            [Category("All")]
            [TestCaseSource("GetTestCases")]
            public void ExecuteTestCases(Tuple<String, longlong> testCase)
            {
                Tuple<UnicornEnums.TestStatus, string> result;

                try
                {
                    result = testCaseService.ExecuteTestCase(testCase.Item1, testCase.Item2, testCase.Item3);

    ......................................

     

    I do have this kind of one Textexecution class which fetches all the Test cases from data base during build in visual studio and display in test explorer.

    The same code when tried thorough sharpdevelop, Only one test show up in test explorer.

  • 08-07-2017 8:45 PM In reply to

    Re: All unit test are discover able in Sharpdevelop Testexplorer.

    Ah, this is a feature of NUnit I've never used before, but I think I see what you mean now. When you open this in SharpDevelop, what you see in the unit test pad is a hierachy of project names -> namespaces -> class names -> test methods.

    When I open the same project in the NUnit UI, I see the same hierachy (minus the project name at the top), but there's another level beneath the test method, with a node for each of the elements in the GetTestCases array referenced by your TestCaseSource attribute, and I guess Visual Studio is also showing you this extra level of detail?

    SharpDevelop will still run all the test cases defined in your GetTestCases array, and will report any cases which fail individually in the errors pad (actually I think SharpDevelop delegates the running of the tests to the NUnit console app, and SharpDevelop just reports any failures which the console app reports to it), but because the unit test pad doesn't look for this extra level of detail within your tests, the unit test pad doesn't show red/green blobs for the test cases, only for the test method, and you won't be able to run test cases individually, only the whole test method (with all the test cases that TestCaseSource fetches for it).

    In short, this is a feature which hasn't been implemented in SharpDevelop's unit test pad. There are other things it doesn't do, for example, if a test class is derived from a base class and the base class has test methods, those base class methods show in the unit test pad and are run along with the other tests (I've tried it, sometimes they fail and the failures are all reported) but their blobs just stay grey, they don't go red or green for a visual indication of the test outcome. But on the whole I think the convenience of being able to run the unit tests and get a code coverage report all within the one IDE window outweighs the annoyance of the missing features. And for other times, there's always the NUnit UI.

    Simon

  • 08-08-2017 7:35 AM In reply to

    Re: All unit test are discover able in Sharpdevelop Testexplorer.

    ok Thanks Simon.

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.