locked
Test opening itself again before finishing RRS feed

  • Question

  • I'm writing a coded ui test for an application (".appref-ms" in case anyone is curious) and my testmethod looks like this:

    [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\\r_t\\n_p.csv", "n_p#csv", DataAccessMethod.Sequential), DeploymentItem("n_p.csv"), TestMethod]
            public void CodedUITestRS()
            {
                Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;
                Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled;
                Playback.PlaybackSettings.ShouldSearchFailFast = false;
                Playback.PlaybackSettings.DelayBetweenActions = 500;
                Process.Start(GlobalVariables.Route);
    
    
                this.UIMap.Login();
                this.UIMap.SelectRP();
    
                this.UIMap.UIJUJuCoWindow1.UIItemCustom1.UIProtGroup.UINPEdit.Text = TestContext.DataRow["prot"].ToString();
                this.UIMap.InsertNP();
                TestContext.WriteLine("Got beyond num");
                this.UIMap.Save();
            }

    The playback instructions are there so the tool can find the control ( otherwise it takes around 12 min to find them ) but now my problem is with the test being re-opened halfway as soon as I get to the TestContext.DataRow line.

    Could someone shed a light ?

    Wednesday, November 18, 2015 3:51 PM

All replies

  • Hi S1deswipe,

    >> but now my problem is with the test being re-opened halfway as soon as I get to the TestContext.DataRow line.

    Could you share us the screen shots about this issue? So we could understand it better. Do you mean that the test was re-running before the previous one was not finished?

        A        this.UIMap.Login();
        B      this.UIMap.SelectRP();

        C       this.UIMap.UIJUJuCoWindow1.UIItemCustom1.UIProtGroup.UINPEdit.Text = TestContext.DataRow["prot"].ToString();
        D        this.UIMap.InsertNP();

    Based on your above methods in your UIMap, how did you create the data driving coded UI test in your side? Maybe you could share us the detailed UIMap files.

    If you mean that it re-runs A and B again before it runs C, how about removing C? Does it work normally? Whether your test results were normally even if it re-open halfway? Did you get any error message? I doubt that the real issue is related to steps which you really create the data driving test in your side.

    Like this sample which provides us a data driving coded UI test sample:

    https://msdn.microsoft.com/en-us/library/ee624082.aspx

    So you could check that whether you use the correct way with the database.

    Since we couldn't see the detailed coded UI test code and the UI in your side, if possible, you could share us a simple sample using one drive, at least, we could really repro and run it in our side.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, November 22, 2015 5:33 AM
  • I can't really provide much details ( sorry =/ ) but the whole test method block re-runs itself before it finishes.. I'll try to give an example:

    A. Open Browser

    B. Go to "microsoft.com"

    C. Login

    When the test starts , it goes to B and before C it goes to A again ( It opens a new instance of a browser and forgets about the first test)

    Did that make it clearer?

    Tuesday, November 24, 2015 2:55 PM
  • Hi S1deswipe,

    Thanks for your friendly response.

    The issue is clear now, but it is hard for us to get the reason directly without the sample/detailed code.

    Just to make this issue clearly, if you don't use the data source, how about the result if you playback it? Do you just have one test in your test explorer window?

    For example, if you need to visit the page, how about opening it using the custom code like the following code?

    BrowserWindow window = new BrowserWindow(); window = BrowserWindow.Launch(new Uri(https://login.live.com/)); this.UIMap.RecordedMethod2(); this.UIMap.RecordedMethod3();

    window.CloseOnPlaybackCleanup = false;

    Maybe you could use the "CloseOnPlaybackCleanup" method to test it again if there are several tests.

    http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/08/using-same-applicationundertest-browserwindow-across-multiple-tests.aspx

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 25, 2015 10:12 AM