Test not running and no error message given

2 posts, 0 answers
  1. Alex
    Alex avatar
    4 posts
    Member since:
    Mar 2012

    Posted 11 Dec 2012 Link to this post

    I'm new to Test Studio and was trying to add a global variable to the test class. After adding this variable and referencing it in one of the test methods, I can no longer "Play" the test. Clicking Play does nothing. Run to step does nothing. I receive no error messages. At one point, I was unable to access the Class/Code view window for the test. I had to copy all the steps into a new test which let see the code again. Something odd seems to be happening here.

    Here's the code. I cut a portion out and removed some comments.

     

     

     

     

    namespace TestProject1
    {
      
        public class WebTest : BaseWebAiiTest
        {
            #region [ Dynamic Pages Reference ]
      
            private Pages _pages;
            public string g_sRandomUserName = "AutomationUser";
      
            public Pages Pages
            {
                get
                {
                    if (_pages == null)
                    {
                        _pages = new Pages(Manager.Current);
                    }
                    return _pages;
                }
            }
      
            #endregion
              
            // Add your test methods here...
          
            [CodedStep(@"Enter text '" + g_sRandomUserName + "' in 'MainContentTxtUsernameText'")]
            public void WebTest_CodedStep()
            {
                // Enter text 'AutomationUser' in 'MainContentTxtUsernameText'
                Actions.SetText(Pages.UserAdministrator.MainContentTxtUsernameText, g_sRandomUserName);
            }
      
         ...

     

     

     

     

     

  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 11 Dec 2012 Link to this post

    Hi,

    You're getting a compile error. If you look in the Application log you would see this:

    [12/11 17:59:34,Telerik.TestStudio.exe(12720:1),ProjectModel] CodeService.SetTestCodeFileErrors() : EXCEPTION! (see below)
         Situation: Unable to load code behind file.
         Outer Exception Type: System.NullReferenceException
         Message: Object reference not set to an instance of an object.
         HRESULT: 0x80004003 (Official ID (if app.) = E_POINTER, Error Bit = FAILED, Facility = FACILITY_NULL, Code = 16387)
         Call Stack:
              at ArtOfTest.WebAii.Design.CodeGeneration.StandaloneParsedCodedStep..ctor(MethodDeclaration codeElement, Document d, Attribute attr)
              at ArtOfTest.WebAii.Design.CodeGeneration.StandaloneParsedCodedStep.IsCodedStep(MethodDeclaration codeElement, Document d, StandaloneParsedCodedStep& cs)
              at ArtOfTest.WebAii.Design.CodeGeneration.TestCode.NotifySemanticParseComplete(Object sender, EventArgs e)
              at ActiproSoftware.SyntaxEditor.Document.OnSemanticParseDataChanged(EventArgs e)
              at ActiproSoftware.SyntaxEditor.Document.a(ISemanticParseData A_0, TextRange A_1, Boolean A_2, Object A_3)
              at ActiproSoftware.SyntaxEditor.Document.ActiproSoftware.SyntaxEditor.ISemanticParseDataTarget.NotifySemanticParseComplete(SemanticParserServiceRequest request)
              at ActiproSoftware.SyntaxEditor.SemanticParserService.a(SemanticParserServiceRequest A_0)
              at ActiproSoftware.SyntaxEditor.SemanticParserService.b(SemanticParserServiceRequest A_0)
              at ActiproSoftware.SyntaxEditor.SemanticParserService.Parse(SemanticParserServiceRequest request)
              at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.DotNetSyntaxLanguage.PerformSemanticParse(Document document, TextRange parseTextRange, SemanticParseFlags flags)
              at ActiproSoftware.SyntaxEditor.Document.Reparse()
              at ArtOfTest.WebAii.Design.CodeGeneration.TestCode.Parse()
              at ArtOfTest.WebAii.Design.CodeGeneration.TestCode.SetErrors(CompilerErrorCollection compilationErrors)
              at ArtOfTest.WebAii.Design.CodeGeneration.CodeService.SetTestCodeFileErrors(Test test, CompilerErrorCollection errors)

    What you're trying to do with the CodedStep attribute is not legal. The description of the coded step can only be static text. Variables are not permitted as you're attempting to do.

    Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top