none
VS2017 Coded Web Test From Scratch Not Executing RRS feed

  • Question

  • Hello,

    I am having an odd issue where if I create a coded web test from scratch and not via the generate coded script from the webtest and try to execute the test it tries to run every other test other than the one I want. 

    I feel like I am missing something which is causing the test not to be recongnised. Below is a sample test I created but can't execute.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    
    namespace Betway
    {
        class test : WebTest
        {
            public override IEnumerator<WebTestRequest> GetRequestEnumerator()
            {
                var request = new WebTestRequest("https://google.com");
                yield return request;
                request = null;
            }
        }
    }
    



    Tuesday, September 19, 2017 10:05 AM

Answers

  • I suggest you let Visual Studio create a Coded Web Test from a ".webtest" and then compare that to your hand coded file. The most obvious differences are that

    1. Your class is not "public".
    2. There is no constructor for the class.

    Regards

    Adrian

    • Marked as answer by Pir.Rab Tuesday, September 19, 2017 10:43 AM
    Tuesday, September 19, 2017 10:19 AM

All replies

  • I suggest you let Visual Studio create a Coded Web Test from a ".webtest" and then compare that to your hand coded file. The most obvious differences are that

    1. Your class is not "public".
    2. There is no constructor for the class.

    Regards

    Adrian

    • Marked as answer by Pir.Rab Tuesday, September 19, 2017 10:43 AM
    Tuesday, September 19, 2017 10:19 AM
  • Thank you Adrian!!!

    It was those two things I missed out! The most basic of things! Now the test is working oh silly me. 

    Kind Regards

    Tuesday, September 19, 2017 10:44 AM