unit testing - Get QUnit Results Using MSTest/MSUnit -


i'd load browser page static html test harness page running qunit tests.

i'd values success/failure <span>s , test those.

how can load page , interrogate elements on using mstest/msunit?

if don't mind starting actual browser, , don't want put dependency on seleniumrc (which required c#), can use watin. below little example watin.

[test]  public void searchforwatinongoogle() {   using (var browser = new ie("http://www.google.com"))   {     browser.textfield(find.byname("q")).typetext("watin");     browser.button(find.byname("btng")).click();      assert.istrue(browser.containstext("watin"));   } } 

or if don't want start real browser on machine can try selenium, , htmlunit. selenium start htmlunit, tell load given page, , read need via xpath. example example selenium documentation how similar:

using openqa.selenium; using openqa.selenium.remote;  class example {     static void main(string[] args)     {          icapabilities desiredcapabilities = desiredcapabilities.htmlunit();         iwebdriver driver = new remotewebdriver(desiredcapabilities);          driver.navigate().gotourl("http://google.ca/");          iwebelement element = driver.findelement(by.name("q"));         element.sendkeys("cheese!");         element.submit();         system.console.writeline("page title is: " + driver.title);         driver.quit();         system.console.readline();     } }   

btw selenium can use real browser also.

on other hand if page results local file, read file , filter data need.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -