assertEquals("March", monthMap.get(3)); // JUnitassertThat(monthMap).containsEntry(3, "March"); // Truth
ImmutableSet<String> colors = ImmutableSet.of("red", "green", "blue", "yellow");assertTrue(colors.contains("orange")); // JUnitassertThat(colors).contains("orange"); // Truth
npm install -g protractor
webdriver-manager update & webdriver-manager start
// It is a good idea to use page objects to modularize your testing logicvar angularHomepage = { nameInput : element(by.model('yourName')), greeting : element(by.binding('yourName')), get : function() { browser.get('index.html'); }, setName : function(name) { this.nameInput.sendKeys(name); }};// Here we are using the Jasmine test framework // See http://jasmine.github.io/2.0/introduction.html for more detailsdescribe('angularjs homepage', function() { it('should greet the named user', function(){ angularHomepage.get(); angularHomepage.setName('Julie'); expect(angularHomepage.greeting.getText()). toEqual('Hello Julie!'); });});
exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['testFolder/*'], multiCapabilities: [{ 'browserName': 'chrome', // browser-specific tests specs: 'chromeTests/*' }, { 'browserName': 'firefox', // run tests in parallel shardTestFiles: true }], baseUrl: 'http://www.angularjs.org',};
protractor conf.js
1 test, 1 assertions, 0 failures
@Test public void isUserLockedOut_invalidLogin() { authenticator.authenticate(username, invalidPassword); assertFalse(authenticator.isUserLockedOut(username)); authenticator.authenticate(username, invalidPassword); assertFalse(authenticator.isUserLockedOut(username)); authenticator.authenticate(username, invalidPassword); assertTrue(authenticator.isUserLockedOut(username));}
bool WaitForCallToComeUp(content::WebContents* tab_contents) { // Apprtc will set remoteVideo.style.opacity to 1 when the call comes up. std::string javascript = "window.domAutomationController.send(remoteVideo.style.opacity)"; return test::PollingWaitUntil(javascript, "1", tab_contents);}
bool DetectRemoteVideoPlaying(content::WebContents* tab_contents) { if (!EvalInJavascriptFile(tab_contents, GetSourceDir().Append( FILE_PATH_LITERAL( "chrome/test/data/webrtc/test_functions.js")))) return false; if (!EvalInJavascriptFile(tab_contents, GetSourceDir().Append( FILE_PATH_LITERAL( "chrome/test/data/webrtc/video_detector.js")))) return false; // The remote video tag is called remoteVideo in the AppRTC code. StartDetectingVideo(tab_contents, "remoteVideo"); WaitForVideoToPlay(tab_contents); return true;}
if (!HasWebcamOnSystem()) return;