Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. ASP.net, Unit tests and Cruise Control experiences anyone?

ASP.net, Unit tests and Cruise Control experiences anyone?

Scheduled Pinned Locked Moved The Lounge
beta-testingquestioncsharpasp-netcom
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Buckett
    wrote on last edited by
    #1

    Hello all, I've been looking for a while now for something that I can use to do unit testing on my asp.net UI projects (as opposed to the class libraries, for which I use NUnit). Specifically, I want to test the UI, eg, if I click this button, that text appears. So far, I seem to have found 2 things that may fit the bill: Selenium[^] (specifically the RC version) and WebAii[^] which is still in beta and looks fairly new. One problem with both of them seems to be that they launch a browser to run the tests. I think this means that I wouldn't be able to use them on my CruiseControl.net server as it runs without being logged in. :( Does anyone have any experience with either of these two products (or have any other suggestions) before I commit to one or the other? PS: - this isn't a programming question - it's a "test" / "your experiences" question :) Cheers,

    ChrisB ChrisDoesDev[^]

    R P 2 Replies Last reply
    0
    • C Chris Buckett

      Hello all, I've been looking for a while now for something that I can use to do unit testing on my asp.net UI projects (as opposed to the class libraries, for which I use NUnit). Specifically, I want to test the UI, eg, if I click this button, that text appears. So far, I seem to have found 2 things that may fit the bill: Selenium[^] (specifically the RC version) and WebAii[^] which is still in beta and looks fairly new. One problem with both of them seems to be that they launch a browser to run the tests. I think this means that I wouldn't be able to use them on my CruiseControl.net server as it runs without being logged in. :( Does anyone have any experience with either of these two products (or have any other suggestions) before I commit to one or the other? PS: - this isn't a programming question - it's a "test" / "your experiences" question :) Cheers,

      ChrisB ChrisDoesDev[^]

      R Offline
      R Offline
      Ryan Roberts
      wrote on last edited by
      #2

      Chris Buckett wrote:

      One problem with both of them seems to be that they launch a browser to run the tests. I think this means that I wouldn't be able to use them on my CruiseControl.net server as it runs without being logged in.

      You can drive the tests using selenium RC without having a logged in user. You can convert the selenium tests to nunit/mbunit tests using the selenium IDE. [TestFixture] public class NewTest { private ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:4444"); selenium.Start(); verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheNewTest() { selenium.Open("/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&channel=s&hl=en&q=resharper+beta&meta=&btnG=Google+Search"); selenium.Click("link=Download - JetBrains.net"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=ReSharper 3.0 Changes"); selenium.WaitForPageToLoad("30000"); try { Assert.AreEqual("Introduce field", selenium.GetText("//li[4]/ul/li[4]")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } } } You can then run those happily on your build server. It would be nice to be able to use a stub nunit test to pull in the html table tests and generate the code at test time so you can also use the HTML tests without maintaining the manual conversion process, but I don't think anybody has implemented that yet.

      C 1 Reply Last reply
      0
      • R Ryan Roberts

        Chris Buckett wrote:

        One problem with both of them seems to be that they launch a browser to run the tests. I think this means that I wouldn't be able to use them on my CruiseControl.net server as it runs without being logged in.

        You can drive the tests using selenium RC without having a logged in user. You can convert the selenium tests to nunit/mbunit tests using the selenium IDE. [TestFixture] public class NewTest { private ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:4444"); selenium.Start(); verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheNewTest() { selenium.Open("/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&channel=s&hl=en&q=resharper+beta&meta=&btnG=Google+Search"); selenium.Click("link=Download - JetBrains.net"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=ReSharper 3.0 Changes"); selenium.WaitForPageToLoad("30000"); try { Assert.AreEqual("Introduce field", selenium.GetText("//li[4]/ul/li[4]")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } } } You can then run those happily on your build server. It would be nice to be able to use a stub nunit test to pull in the html table tests and generate the code at test time so you can also use the HTML tests without maintaining the manual conversion process, but I don't think anybody has implemented that yet.

        C Offline
        C Offline
        Chris Buckett
        wrote on last edited by
        #3

        Cheers for the code snippet (although it's made the post look like a programming question!) Thanks for clearing that up - I'd read somewhere previously that the CruiseControl server had to be logged in.

        ChrisB ChrisDoesDev[^]

        1 Reply Last reply
        0
        • C Chris Buckett

          Hello all, I've been looking for a while now for something that I can use to do unit testing on my asp.net UI projects (as opposed to the class libraries, for which I use NUnit). Specifically, I want to test the UI, eg, if I click this button, that text appears. So far, I seem to have found 2 things that may fit the bill: Selenium[^] (specifically the RC version) and WebAii[^] which is still in beta and looks fairly new. One problem with both of them seems to be that they launch a browser to run the tests. I think this means that I wouldn't be able to use them on my CruiseControl.net server as it runs without being logged in. :( Does anyone have any experience with either of these two products (or have any other suggestions) before I commit to one or the other? PS: - this isn't a programming question - it's a "test" / "your experiences" question :) Cheers,

          ChrisB ChrisDoesDev[^]

          P Offline
          P Offline
          Paul Watson
          wrote on last edited by
          #4

          We run Selenium on a build server and it has no problems. We've used the Java RC and Selenium on Rails.

          regards, Paul Watson Ireland & South Africa

          Shog9 wrote:

          And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

          C 1 Reply Last reply
          0
          • P Paul Watson

            We run Selenium on a build server and it has no problems. We've used the Java RC and Selenium on Rails.

            regards, Paul Watson Ireland & South Africa

            Shog9 wrote:

            And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

            C Offline
            C Offline
            Chris Buckett
            wrote on last edited by
            #5

            Cool, Cheers for that. Selenuim looks like the way to go.

            ChrisB ChrisDoesDev[^]

            F 1 Reply Last reply
            0
            • C Chris Buckett

              Cool, Cheers for that. Selenuim looks like the way to go.

              ChrisB ChrisDoesDev[^]

              F Offline
              F Offline
              fariss
              wrote on last edited by
              #6

              Hi - You can also run WebAii in non-interactive mode. (I think that is what you are asking for?). WebAii is also integrating the Plasma server http://www.codeplex.com/plasma in next couple of weeks so if you are doing ASP.NET testing you will be able to do testing with no need for a browser or any webserver. All running inproc. Hope that helps.

              C 1 Reply Last reply
              0
              • F fariss

                Hi - You can also run WebAii in non-interactive mode. (I think that is what you are asking for?). WebAii is also integrating the Plasma server http://www.codeplex.com/plasma in next couple of weeks so if you are doing ASP.NET testing you will be able to do testing with no need for a browser or any webserver. All running inproc. Hope that helps.

                C Offline
                C Offline
                Chris Buckett
                wrote on last edited by
                #7

                Sounds good, perhaps I'll take another look at that.

                ChrisB ChrisDoesDev[^]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups