Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low test coverage #228

Open
inancgumus opened this issue Feb 9, 2022 · 2 comments
Open

Low test coverage #228

inancgumus opened this issue Feb 9, 2022 · 2 comments
Labels
good first issue Good for newcomers hacktoberfest Suitable for Hacktoberfest 🎉 tests

Comments

@inancgumus
Copy link
Member

inancgumus commented Feb 9, 2022

We need to improve our test coverage while working on making code refactorable. At this current stage, there are a lot of dependencies that make testing and finding bugs harder.

Currently, we have a lot of integration tests rather than unit tests. Integration tests allow us to check whether our code is functioning correctly, but it doesn't provide us with whether our code is healthy. This is a part of the job of unit tests, but we don't have enough of them and can't have them easily due to the architectural restrictions of the current codebase.

As of today (Feb. 13, 2022), here is our test coverage:

github.com/grafana/xk6-browser/tests	22.545s	coverage: 53.8% of statements
github.com/grafana/xk6-browser/common	0.478s	coverage: 10.8% of statements
github.com/grafana/xk6-browser/chromium	0.214s	coverage: 0.6% of statements

So, our average test coverage is around 22%. However, if we only count the common package our coverage becomes a staggering ~10%. The common package is a critical package that owns almost every logic. So I argue that our current coverage is ~10%.

Heatmaps

All tests

all-tests

Unit tests

unit-tests

Here's our test coverage by functions:

/chromium/allocator.go:112:		findExecPath					100.0%
/chromium/allocator.go:148:		readOutput					70.0%
/chromium/allocator.go:185:		Allocate					72.1%
/chromium/allocator.go:55:		NewAllocator					100.0%
/chromium/allocator.go:66:		buildCmdArgs					86.4%
/chromium/browser_type.go:119:		LaunchPersistentContext				0.0%
/chromium/browser_type.go:125:		Name						0.0%
/chromium/browser_type.go:129:		flags						100.0%
/chromium/browser_type.go:181:		makeLogger					55.6%
/chromium/browser_type.go:203:		setFlagsFromArgs				100.0%
/chromium/browser_type.go:215:		setFlagsFromK6Options				100.0%
/chromium/browser_type.go:51:		NewBrowserType					100.0%
/chromium/browser_type.go:70:		Connect						0.0%
/chromium/browser_type.go:75:		ExecutablePath					0.0%
/chromium/browser_type.go:80:		Launch						75.0%
/common/barrier.go:35:			NewBarrier					100.0%
/common/barrier.go:43:			AddFrameNavigation				81.8%
/common/barrier.go:62:			Wait						33.3%
/common/browser.go:100:			newBrowser					100.0%
/common/browser.go:115:			connect						91.7%
/common/browser.go:136:			disposeContext					87.5%
/common/browser.go:151:			getPages					0.0%
/common/browser.go:161:			initEvents					92.9%
/common/browser.go:213:			onAttachedToTarget				55.2%
/common/browser.go:317:			onDetachedFromTarget				100.0%
/common/browser.go:341:			newPageInContext				100.0%
/common/browser.go:395:			Close						63.6%
/common/browser.go:420:			Contexts					100.0%
/common/browser.go:432:			IsConnected					0.0%
/common/browser.go:440:			NewContext					84.6%
/common/browser.go:462:			NewPage						100.0%
/common/browser.go:468:			UserAgent					80.0%
/common/browser.go:478:			Version						75.0%
/common/browser.go:91:			NewBrowser					75.0%
/common/browser_context.go:115:		Browser						0.0%
/common/browser_context.go:120:		ClearCookies					0.0%
/common/browser_context.go:130:		ClearPermissions				0.0%
/common/browser_context.go:140:		Close						60.0%
/common/browser_context.go:151:		Cookies						0.0%
/common/browser_context.go:156:		ExposeBinding					0.0%
/common/browser_context.go:160:		ExposeFunction					0.0%
/common/browser_context.go:165:		GrantPermissions				0.0%
/common/browser_context.go:210:		NewCDPSession					0.0%
/common/browser_context.go:216:		NewPage						90.9%
/common/browser_context.go:240:		Pages						0.0%
/common/browser_context.go:248:		Route						0.0%
/common/browser_context.go:253:		SetDefaultNavigationTimeout			0.0%
/common/browser_context.go:260:		SetDefaultTimeout				0.0%
/common/browser_context.go:266:		SetExtraHTTPHeaders				0.0%
/common/browser_context.go:271:		SetGeolocation					0.0%
/common/browser_context.go:288:		SetHTTPCredentials				0.0%
/common/browser_context.go:303:		SetOffline					0.0%
/common/browser_context.go:312:		StorageState					0.0%
/common/browser_context.go:316:		Unroute						0.0%
/common/browser_context.go:320:		WaitForEvent					0.0%
/common/browser_context.go:411:		getSession					0.0%
/common/browser_context.go:61:		NewBrowserContext				100.0%
/common/browser_context.go:74:		AddCookies					0.0%
/common/browser_context.go:79:		AddInitScript					0.0%
/common/browser_context_options.go:55:	NewBrowserContextOptions			100.0%
/common/browser_context_options.go:79:	Parse						26.7%
/common/browser_process.go:103:		AttachLogger					100.0%
/common/browser_process.go:48:		NewBrowserProcess				83.3%
/common/browser_process.go:76:		didLoseConnection				100.0%
/common/browser_process.go:81:		GracefulClose					100.0%
/common/browser_process.go:87:		Terminate					100.0%
/common/browser_process.go:93:		WsURL						100.0%
/common/browser_process.go:98:		Pid						100.0%
/common/connection.go:117:		NewConnection					90.0%
/common/connection.go:155:		closeConnection					100.0%
/common/connection.go:185:		closeSession					100.0%
/common/connection.go:195:		createSession					72.7%
/common/connection.go:212:		handleIOError					90.0%
/common/connection.go:235:		getSession					100.0%
/common/connection.go:244:		findTargetIDForLog				100.0%
/common/connection.go:255:		recvLoop					67.8%
/common/connection.go:350:		send						50.0%
/common/connection.go:413:		sendLoop					61.3%
/common/connection.go:461:		Close						80.0%
/common/connection.go:471:		Execute						92.3%
/common/connection.go:56:			Do						0.0%
/common/context.go:33:			WithHooks					100.0%
/common/context.go:37:			GetHooks					75.0%
/common/context.go:45:			WithLaunchOptions				100.0%
/common/context.go:49:			GetLaunchOptions				75.0%
/common/context.go:58:			WithProcessID					100.0%
/common/context.go:63:			GetProcessID					100.0%
/common/context.go:70:			contextWithDoneChan				100.0%
/common/device.go:30:			GetDevices					0.0%
/common/element_handle.go:1016:		InnerHTML					0.0%
/common/element_handle.go:1031:		InnerText					0.0%
/common/element_handle.go:1045:		InputValue					81.8%
/common/element_handle.go:1063:		IsChecked					75.0%
/common/element_handle.go:1072:		IsDisabled					0.0%
/common/element_handle.go:1081:		IsEditable					0.0%
/common/element_handle.go:1090:		IsEnabled					0.0%
/common/element_handle.go:1099:		IsHidden					0.0%
/common/element_handle.go:1108:		IsVisible					0.0%
/common/element_handle.go:110:		getElementHandlePointerActionFn			68.2%
/common/element_handle.go:1117:		OwnerFrame					0.0%
/common/element_handle.go:1153:		Press						0.0%
/common/element_handle.go:1171:		Query						68.8%
/common/element_handle.go:1207:		QueryAll					81.0%
/common/element_handle.go:1245:		Screenshot					77.8%
/common/element_handle.go:1260:		ScrollIntoViewIfNeeded				0.0%
/common/element_handle.go:1272:		SelectOption					0.0%
/common/element_handle.go:1294:		SelectText					0.0%
/common/element_handle.go:1311:		SetChecked					0.0%
/common/element_handle.go:1329:		SetInputFiles					0.0%
/common/element_handle.go:1334:		Tap						0.0%
/common/element_handle.go:1352:		TextContent					0.0%
/common/element_handle.go:1367:		Type						80.0%
/common/element_handle.go:1384:		Uncheck						0.0%
/common/element_handle.go:1388:		WaitForElementState				0.0%
/common/element_handle.go:1400:		WaitForSelector					71.4%
/common/element_handle.go:1416:		evalWithScript					80.0%
/common/element_handle.go:1429:		eval						88.9%
/common/element_handle.go:1447:		errorFromDOMError				100.0%
/common/element_handle.go:204:		boundingBox					100.0%
/common/element_handle.go:222:		checkHitTargetAt				76.2%
/common/element_handle.go:262:		checkElementState				75.0%
/common/element_handle.go:289:		click						100.0%
/common/element_handle.go:293:		clickablePoint					88.4%
/common/element_handle.go:375:		dblClick					100.0%
/common/element_handle.go:379:		defaultTimeout					100.0%
/common/element_handle.go:383:		dispatchEvent					100.0%
/common/element_handle.go:397:		fill						66.7%
/common/element_handle.go:420:		focus						66.7%
/common/element_handle.go:443:		getAttribute					100.0%
/common/element_handle.go:456:		hover						100.0%
/common/element_handle.go:460:		innerHTML					0.0%
/common/element_handle.go:473:		innerText					0.0%
/common/element_handle.go:486:		inputValue					100.0%
/common/element_handle.go:502:		isChecked					100.0%
/common/element_handle.go:506:		isDisabled					0.0%
/common/element_handle.go:510:		isEditable					0.0%
/common/element_handle.go:514:		isEnabled					0.0%
/common/element_handle.go:518:		isHidden					0.0%
/common/element_handle.go:522:		isVisible					0.0%
/common/element_handle.go:526:		offsetPosition					0.0%
/common/element_handle.go:570:		ownerFrame					45.5%
/common/element_handle.go:588:		scrollRectIntoViewIfNeeded			44.4%
/common/element_handle.go:603:		press						71.4%
/common/element_handle.go:615:		selectOption					30.2%
/common/element_handle.go:66:		getElementHandleActionFn			73.7%
/common/element_handle.go:713:		selectText					0.0%
/common/element_handle.go:736:		setChecked					64.3%
/common/element_handle.go:761:		tap						0.0%
/common/element_handle.go:765:		textContent					0.0%
/common/element_handle.go:778:		typ						71.4%
/common/element_handle.go:790:		waitAndScrollIntoViewIfNeeded			88.9%
/common/element_handle.go:812:		waitForElementState				75.0%
/common/element_handle.go:840:		waitForSelector					72.7%
/common/element_handle.go:871:		AsElement					100.0%
/common/element_handle.go:876:		BoundingBox					100.0%
/common/element_handle.go:885:		Check						0.0%
/common/element_handle.go:891:		Click						90.0%
/common/element_handle.go:907:		ContentFrame					71.4%
/common/element_handle.go:923:		Dblclick					0.0%
/common/element_handle.go:939:		DispatchEvent					0.0%
/common/element_handle.go:952:		Fill						80.0%
/common/element_handle.go:970:		Focus						0.0%
/common/element_handle.go:984:		GetAttribute					88.9%
/common/element_handle.go:999:		Hover						0.0%
/common/element_handle_options.go:102:	NewElementHandleBaseOptions			100.0%
/common/element_handle_options.go:110:	Parse						77.8%
/common/element_handle_options.go:128:	NewElementHandleBasePointerOptions		100.0%
/common/element_handle_options.go:136:	Parse						50.0%
/common/element_handle_options.go:160:	NewElementHandleCheckOptions			0.0%
/common/element_handle_options.go:166:	Parse						0.0%
/common/element_handle_options.go:170:	NewElementHandleClickOptions			100.0%
/common/element_handle_options.go:180:	Parse						46.7%
/common/element_handle_options.go:207:	ToMouseClickOptions				100.0%
/common/element_handle_options.go:215:	NewElementHandleDblclickOptions			100.0%
/common/element_handle_options.go:224:	Parse						28.6%
/common/element_handle_options.go:249:	ToMouseClickOptions				100.0%
/common/element_handle_options.go:257:	NewElementHandleHoverOptions			100.0%
/common/element_handle_options.go:264:	Parse						33.3%
/common/element_handle_options.go:285:	NewElementHandlePressOptions			100.0%
/common/element_handle_options.go:293:	Parse						33.3%
/common/element_handle_options.go:311:	ToBaseOptions					0.0%
/common/element_handle_options.go:319:	NewElementHandleScreenshotOptions		100.0%
/common/element_handle_options.go:329:	Parse						17.6%
/common/element_handle_options.go:362:	NewElementHandleSetCheckedOptions		0.0%
/common/element_handle_options.go:369:	Parse						0.0%
/common/element_handle_options.go:388:	NewElementHandleTapOptions			0.0%
/common/element_handle_options.go:395:	Parse						0.0%
/common/element_handle_options.go:416:	NewElementHandleTypeOptions			100.0%
/common/element_handle_options.go:424:	Parse						33.3%
/common/element_handle_options.go:442:	ToBaseOptions					0.0%
/common/element_handle_options.go:450:	NewElementHandleWaitForElementStateOptions	0.0%
/common/element_handle_options.go:456:	Parse						0.0%
/common/errors.go:33:			Error						100.0%
/common/errors.go:54:			Error						0.0%
/common/errors.go:59:			Is						0.0%
/common/errors.go:68:			Unwrap						0.0%
/common/errors.go:77:			Error						0.0%
/common/event_emitter.go:120:		NewBaseEventEmitter				100.0%
/common/event_emitter.go:134:		syncAll						100.0%
/common/event_emitter.go:148:		sync						100.0%
/common/event_emitter.go:162:		emit						100.0%
/common/event_emitter.go:191:		on						100.0%
/common/event_emitter.go:205:		onAll						100.0%
/common/execution_context.go:110:		adoptBackendNodeID				83.3%
/common/execution_context.go:133:		adoptElementHandle				0.0%
/common/execution_context.go:169:		eval						75.0%
/common/execution_context.go:283:		getInjectedScript				81.2%
/common/execution_context.go:324:		Eval						100.0%
/common/execution_context.go:336:		EvalHandle					80.0%
/common/execution_context.go:352:		Frame						100.0%
/common/execution_context.go:357:		ID						100.0%
/common/execution_context.go:51:		valid						100.0%
/common/execution_context.go:59:		String						100.0%
/common/execution_context.go:80:		NewExecutionContext				100.0%
/common/field_name_mapper.go:41:		NewFieldNameMapper				100.0%
/common/field_name_mapper.go:49:		FieldName					100.0%
/common/field_name_mapper.go:55:		MethodName					100.0%
/common/frame.go:1005:			IsEditable					0.0%
/common/frame.go:1031:			IsEnabled					0.0%
/common/frame.go:1057:			IsHidden					0.0%
/common/frame.go:1083:			IsVisible					0.0%
/common/frame.go:1110:			ID						100.0%
/common/frame.go:1118:			LoaderID					0.0%
/common/frame.go:1126:			Name						100.0%
/common/frame.go:1135:			Query						77.8%
/common/frame.go:1150:			QueryAll					77.8%
/common/frame.go:1166:			Page						0.0%
/common/frame.go:1171:			ParentFrame					0.0%
/common/frame.go:1175:			Press						83.3%
/common/frame.go:1196:			SelectOption					86.4%
/common/frame.go:122:			addChildFrame					100.0%
/common/frame.go:1231:			SetContent					81.8%
/common/frame.go:1260:			SetInputFiles					0.0%
/common/frame.go:1266:			Tap						0.0%
/common/frame.go:1288:			TextContent					0.0%
/common/frame.go:1310:			Title						0.0%
/common/frame.go:1317:			Type						83.3%
/common/frame.go:1338:			Uncheck						84.6%
/common/frame.go:133:			addRequest					100.0%
/common/frame.go:1361:			URL						80.0%
/common/frame.go:1373:			setURL						0.0%
/common/frame.go:1381:			WaitForFunction					0.0%
/common/frame.go:1402:			WaitForLoadState				0.0%
/common/frame.go:142:			deleteRequest					100.0%
/common/frame.go:1433:			WaitForNavigation				100.0%
/common/frame.go:1438:			WaitForSelector					0.0%
/common/frame.go:1452:			WaitForTimeout					0.0%
/common/frame.go:1464:			adoptBackendNodeID				85.7%
/common/frame.go:1477:			evaluate					80.0%
/common/frame.go:151:			inflightRequestsLen				100.0%
/common/frame.go:1542:			frameActionFn					69.2%
/common/frame.go:1570:			framePointerActionFn				69.2%
/common/frame.go:158:			clearLifecycle					95.0%
/common/frame.go:197:			recalculateLifecycle				97.5%
/common/frame.go:269:			stopNetworkIdleTimer				100.0%
/common/frame.go:278:			startNetworkIdleTimer				100.0%
/common/frame.go:297:			detach						0.0%
/common/frame.go:311:			defaultTimeout					100.0%
/common/frame.go:315:			document					92.3%
/common/frame.go:341:			hasContext					100.0%
/common/frame.go:348:			hasLifecycleEventFired				100.0%
/common/frame.go:355:			hasSubtreeLifecycleEventFired			100.0%
/common/frame.go:362:			navigated					100.0%
/common/frame.go:373:			nullContext					100.0%
/common/frame.go:389:			onLifecycleEvent				100.0%
/common/frame.go:401:			onLoadingStarted				100.0%
/common/frame.go:407:			onLoadingStopped				100.0%
/common/frame.go:418:			position					50.0%
/common/frame.go:431:			removeChildFrame				0.0%
/common/frame.go:441:			requestByID					0.0%
/common/frame.go:449:			setContext					63.6%
/common/frame.go:472:			setID						0.0%
/common/frame.go:479:			waitForExecutionContext				87.5%
/common/frame.go:497:			waitForFunction					0.0%
/common/frame.go:551:			waitForSelector					63.2%
/common/frame.go:587:			AddScriptTag					0.0%
/common/frame.go:593:			AddStyleTag					0.0%
/common/frame.go:600:			Check						84.6%
/common/frame.go:623:			ChildFrames					83.3%
/common/frame.go:635:			Click						84.6%
/common/frame.go:658:			Content						0.0%
/common/frame.go:674:			Dblclick					84.6%
/common/frame.go:696:			DispatchEvent					83.3%
/common/frame.go:718:			Evaluate					88.9%
/common/frame.go:740:			EvaluateHandle					86.7%
/common/frame.go:765:			Fill						83.3%
/common/frame.go:787:			Focus						83.3%
/common/frame.go:808:			FrameElement					83.3%
/common/frame.go:819:			GetAttribute					0.0%
/common/frame.go:842:			Goto						100.0%
/common/frame.go:849:			Hover						84.6%
/common/frame.go:871:			InnerHTML					0.0%
/common/frame.go:893:			InnerText					0.0%
/common/frame.go:915:			InputValue					84.6%
/common/frame.go:91:			NewFrame					88.9%
/common/frame.go:937:			IsChecked					87.5%
/common/frame.go:964:			IsDetached					100.0%
/common/frame.go:972:			setDetached					0.0%
/common/frame.go:979:			IsDisabled					0.0%
/common/frame_manager.go:102:		removeBarrier					100.0%
/common/frame_manager.go:117:		dispose						0.0%
/common/frame_manager.go:127:		frameAbortedNavigation				83.3%
/common/frame_manager.go:157:		frameAttached					83.3%
/common/frame_manager.go:184:		frameDetached					0.0%
/common/frame_manager.go:201:		frameLifecycleEvent				100.0%
/common/frame_manager.go:213:		frameLoadingStarted				100.0%
/common/frame_manager.go:223:		frameLoadingStopped				100.0%
/common/frame_manager.go:233:		frameNavigated					77.5%
/common/frame_manager.go:335:		frameNavigatedWithinDocument			0.0%
/common/frame_manager.go:357:		frameRequestedNavigation			0.0%
/common/frame_manager.go:399:		getFrameByID					100.0%
/common/frame_manager.go:405:		removeChildFramesRecursively			0.0%
/common/frame_manager.go:411:		removeFramesRecursively				0.0%
/common/frame_manager.go:439:		requestFailed					60.0%
/common/frame_manager.go:477:		requestFinished					80.0%
/common/frame_manager.go:503:		requestReceivedResponse				100.0%
/common/frame_manager.go:509:		requestStarted					86.7%
/common/frame_manager.go:535:		Frames						100.0%
/common/frame_manager.go:546:		MainFrame					100.0%
/common/frame_manager.go:554:		setMainFrame					100.0%
/common/frame_manager.go:566:		NavigateFrame					78.2%
/common/frame_manager.go:685:		Page						0.0%
/common/frame_manager.go:693:		WaitForFrameNavigation				47.6%
/common/frame_manager.go:71:		NewFrameManager					100.0%
/common/frame_manager.go:742:		ID						100.0%
/common/frame_manager.go:94:		addBarrier					100.0%
/common/frame_options.go:162:		NewFrameBaseOptions				100.0%
/common/frame_options.go:169:		Parse						37.5%
/common/frame_options.go:185:		NewFrameCheckOptions				100.0%
/common/frame_options.go:192:		Parse						44.4%
/common/frame_options.go:209:		NewFrameClickOptions				100.0%
/common/frame_options.go:216:		Parse						44.4%
/common/frame_options.go:233:		NewFrameDblClickOptions				100.0%
/common/frame_options.go:240:		Parse						44.4%
/common/frame_options.go:257:		NewFrameFillOptions				100.0%
/common/frame_options.go:264:		Parse						44.4%
/common/frame_options.go:281:		NewFrameGotoOptions				100.0%
/common/frame_options.go:289:		Parse						75.0%
/common/frame_options.go:312:		NewFrameHoverOptions				100.0%
/common/frame_options.go:319:		Parse						44.4%
/common/frame_options.go:336:		NewFrameInnerHTMLOptions			0.0%
/common/frame_options.go:342:		Parse						0.0%
/common/frame_options.go:349:		NewFrameInnerTextOptions			0.0%
/common/frame_options.go:355:		Parse						0.0%
/common/frame_options.go:362:		NewFrameInputValueOptions			100.0%
/common/frame_options.go:368:		Parse						66.7%
/common/frame_options.go:375:		NewFrameIsCheckedOptions			100.0%
/common/frame_options.go:381:		Parse						66.7%
/common/frame_options.go:388:		NewFrameIsDisabledOptions			0.0%
/common/frame_options.go:394:		Parse						0.0%
/common/frame_options.go:401:		NewFrameIsEditableOptions			0.0%
/common/frame_options.go:407:		Parse						0.0%
/common/frame_options.go:414:		NewFrameIsEnabledOptions			0.0%
/common/frame_options.go:420:		Parse						0.0%
/common/frame_options.go:427:		NewFrameIsHiddenOptions				0.0%
/common/frame_options.go:433:		Parse						0.0%
/common/frame_options.go:440:		NewFrameIsVisibleOptions			0.0%
/common/frame_options.go:446:		Parse						0.0%
/common/frame_options.go:453:		NewFramePressOptions				100.0%
/common/frame_options.go:460:		ToKeyboardOptions				100.0%
/common/frame_options.go:466:		NewFrameSelectOptionOptions			100.0%
/common/frame_options.go:473:		Parse						44.4%
/common/frame_options.go:490:		NewFrameSetContentOptions			100.0%
/common/frame_options.go:497:		Parse						27.3%
/common/frame_options.go:520:		NewFrameTapOptions				0.0%
/common/frame_options.go:528:		Parse						0.0%
/common/frame_options.go:551:		NewFrameTextContentOptions			0.0%
/common/frame_options.go:557:		Parse						0.0%
/common/frame_options.go:564:		NewFrameTypeOptions				100.0%
/common/frame_options.go:571:		ToKeyboardOptions				100.0%
/common/frame_options.go:577:		NewFrameUncheckOptions				100.0%
/common/frame_options.go:584:		Parse						44.4%
/common/frame_options.go:601:		NewFrameWaitForFunctionOptions			0.0%
/common/frame_options.go:609:		Parse						0.0%
/common/frame_options.go:633:		NewFrameWaitForLoadStateOptions			0.0%
/common/frame_options.go:639:		Parse						0.0%
/common/frame_options.go:653:		NewFrameWaitForNavigationOptions		100.0%
/common/frame_options.go:661:		Parse						25.0%
/common/frame_options.go:684:		NewFrameWaitForSelectorOptions			100.0%
/common/frame_options.go:692:		Parse						58.3%
/common/frame_session.go:1002:		updateViewport					77.3%
/common/frame_session.go:174:		emulateLocale					83.3%
/common/frame_session.go:185:		emulateTimezone					0.0%
/common/frame_session.go:196:		getNetworkManager				100.0%
/common/frame_session.go:200:		initDomains					80.0%
/common/frame_session.go:216:		initEvents					69.7%
/common/frame_session.go:288:		initFrameTree					84.6%
/common/frame_session.go:317:		initIsolatedWorld				73.7%
/common/frame_session.go:365:		initOptions					72.5%
/common/frame_session.go:448:		initRendererEvents				100.0%
/common/frame_session.go:475:		isMainFrame					100.0%
/common/frame_session.go:479:		handleFrameTree					62.5%
/common/frame_session.go:495:		navigateFrame					83.3%
/common/frame_session.go:508:		onConsoleAPICalled				0.0%
/common/frame_session.go:540:		onExceptionThrown				0.0%
/common/frame_session.go:544:		onExecutionContextCreated			95.0%
/common/frame_session.go:582:		onExecutionContextDestroyed			88.9%
/common/frame_session.go:599:		onExecutionContextsCleared			100.0%
/common/frame_session.go:616:		onFrameAttached					100.0%
/common/frame_session.go:625:		onFrameDetached					0.0%
/common/frame_session.go:633:		onFrameNavigated				75.0%
/common/frame_session.go:644:		onFrameRequestedNavigation			0.0%
/common/frame_session.go:657:		onFrameStartedLoading				100.0%
/common/frame_session.go:665:		onFrameStoppedLoading				100.0%
/common/frame_session.go:673:		onLogEntryAdded					0.0%
/common/frame_session.go:695:		onPageLifecycle					100.0%
/common/frame_session.go:776:		onPageNavigatedWithinDocument			0.0%
/common/frame_session.go:784:		onAttachedToTarget				0.0%
/common/frame_session.go:862:		attachIFrameToTarget				0.0%
/common/frame_session.go:88:		NewFrameSession					74.1%
/common/frame_session.go:891:		attachWorkerToTarget				0.0%
/common/frame_session.go:902:		onDetachedFromTarget				0.0%
/common/frame_session.go:910:		onTargetCrashed					0.0%
/common/frame_session.go:917:		updateEmulateMedia				92.3%
/common/frame_session.go:947:		updateExtraHTTPHeaders				100.0%
/common/frame_session.go:963:		updateGeolocation				57.1%
/common/frame_session.go:979:		updateHttpCredentials				75.0%
/common/frame_session.go:988:		updateOffline					75.0%
/common/frame_session.go:997:		updateRequestInterception			100.0%
/common/helpers.go:124:			stringSliceContains				75.0%
/common/helpers.go:133:			createWaitForEventHandler			94.1%
/common/helpers.go:173:			waitForEvent					66.7%
/common/helpers.go:191:			k6Throw						75.0%
/common/helpers.go:220:			TrimQuotes					100.0%
/common/helpers.go:37:			convertBaseJSHandleTypes			88.9%
/common/helpers.go:55:			convertArgument					90.9%
/common/helpers.go:97:			callApiWithTimeout				85.7%
/common/hooks.go:42:			applySlowMo					80.0%
/common/hooks.go:52:			defaultSlowMo					75.0%
/common/hooks.go:63:			NewHooks					100.0%
/common/hooks.go:71:			registerDefaultHooks				100.0%
/common/hooks.go:75:			Get						100.0%
/common/hooks.go:81:			Register					100.0%
/common/js_handle.go:107:			EvaluateHandle					0.0%
/common/js_handle.go:118:			GetProperties					91.7%
/common/js_handle.go:142:			GetProperty					0.0%
/common/js_handle.go:147:			JSONValue					33.3%
/common/js_handle.go:49:			NewJSHandle					100.0%
/common/js_handle.go:73:			AsElement					0.0%
/common/js_handle.go:78:			Dispose						77.8%
/common/js_handle.go:96:			Evaluate					83.3%
/common/keyboard.go:107:			Type						0.0%
/common/keyboard.go:117:			down						80.0%
/common/keyboard.go:151:			up						80.0%
/common/keyboard.go:174:			insertText					75.0%
/common/keyboard.go:182:			keyDefinitionFromKey				92.6%
/common/keyboard.go:228:			modifierBitFromKeyName				33.3%
/common/keyboard.go:242:			press						42.9%
/common/keyboard.go:257:			typ						64.3%
/common/keyboard.go:58:			NewKeyboard					100.0%
/common/keyboard.go:69:			Down						0.0%
/common/keyboard.go:76:			Up						0.0%
/common/keyboard.go:85:			Press						0.0%
/common/keyboard.go:96:			InsertText					0.0%
/common/keyboard_options.go:34:		NewKeyboardOptions				100.0%
/common/keyboard_options.go:40:		Parse						0.0%
/common/launch.go:61:			NewLaunchOptions				100.0%
/common/launch.go:72:			Parse						41.2%
/common/logger.go:126:			SetLevel					0.0%
/common/logger.go:136:			DebugMode					100.0%
/common/logger.go:141:			ReportCaller					0.0%
/common/logger.go:156:			goRoutineID					85.7%
/common/logger.go:173:			Format						100.0%
/common/logger.go:48:			NullLogger					100.0%
/common/logger.go:54:			NewNullLogger					100.0%
/common/logger.go:58:			NewLogger					100.0%
/common/logger.go:67:			Tracef						100.0%
/common/logger.go:71:			Debugf						100.0%
/common/logger.go:75:			Errorf						100.0%
/common/logger.go:79:			Infof						0.0%
/common/logger.go:83:			Warnf						100.0%
/common/logger.go:87:			Logf						71.4%
/common/mouse.go:112:			down						80.0%
/common/mouse.go:124:			move						90.9%
/common/mouse.go:142:			up						85.7%
/common/mouse.go:157:			Click						0.0%
/common/mouse.go:168:			DblClick					0.0%
/common/mouse.go:180:			Down						0.0%
/common/mouse.go:192:			Move						0.0%
/common/mouse.go:204:			Up						0.0%
/common/mouse.go:52:			NewMouse					100.0%
/common/mouse.go:66:			click						50.0%
/common/mouse.go:88:			dblClick					0.0%
/common/mouse_options.go:106:		ToMouseDownUpOptions				0.0%
/common/mouse_options.go:112:		NewMouseDownUpOptions				100.0%
/common/mouse_options.go:119:		Parse						0.0%
/common/mouse_options.go:135:		NewMouseMoveOptions				100.0%
/common/mouse_options.go:141:		Parse						0.0%
/common/mouse_options.go:50:		NewMouseClickOptions				100.0%
/common/mouse_options.go:58:		Parse						0.0%
/common/mouse_options.go:76:		ToMouseDownUpOptions				100.0%
/common/mouse_options.go:83:		NewMouseDblClickOptions				0.0%
/common/mouse_options.go:90:		Parse						0.0%
/common/network_manager.go:120:		newResolver					90.0%
/common/network_manager.go:140:		parseTTL					80.0%
/common/network_manager.go:161:		deleteRequestByID				100.0%
/common/network_manager.go:167:		emitRequestMetrics				100.0%
/common/network_manager.go:194:		emitResponseMetrics				93.9%
/common/network_manager.go:308:		handleRequestRedirect				0.0%
/common/network_manager.go:324:		initDomains					85.7%
/common/network_manager.go:342:		initEvents					100.0%
/common/network_manager.go:359:		handleEvents					83.3%
/common/network_manager.go:387:		onLoadingFailed					100.0%
/common/network_manager.go:399:		onLoadingFinished				52.9%
/common/network_manager.go:429:		isInternalURL					100.0%
/common/network_manager.go:433:		onRequest					69.2%
/common/network_manager.go:475:		onRequestPaused					93.1%
/common/network_manager.go:533:		checkBlockedHosts				100.0%
/common/network_manager.go:543:		checkBlockedIPs					100.0%
/common/network_manager.go:554:		onRequestServedFromCache			0.0%
/common/network_manager.go:561:		onResponseReceived				100.0%
/common/network_manager.go:571:		requestFromID					100.0%
/common/network_manager.go:577:		setRequestInterception				100.0%
/common/network_manager.go:582:		updateProtocolCacheDisabled			0.0%
/common/network_manager.go:590:		updateProtocolRequestInterception		64.3%
/common/network_manager.go:625:		Authenticate					0.0%
/common/network_manager.go:634:		ExtraHTTPHeaders				0.0%
/common/network_manager.go:640:		SetExtraHTTPHeaders				75.0%
/common/network_manager.go:649:		SetOfflineMode					0.0%
/common/network_manager.go:663:		SetUserAgent					0.0%
/common/network_manager.go:672:		SetCacheEnabled					0.0%
/common/network_manager.go:80:		NewNetworkManager				88.9%
/common/page.go:149:			closeWorker					0.0%
/common/page.go:158:			defaultTimeout					100.0%
/common/page.go:162:			didClose					100.0%
/common/page.go:174:			didCrash					0.0%
/common/page.go:181:			evaluateOnNewDocument				0.0%
/common/page.go:185:			getFrameElement					64.7%
/common/page.go:215:			getOwnerFrame					61.5%
/common/page.go:266:			attachFrameSession				0.0%
/common/page.go:271:			getFrameSession					100.0%
/common/page.go:277:			hasRoutes					100.0%
/common/page.go:281:			resetViewport					0.0%
/common/page.go:288:			setEmulatedSize					100.0%
/common/page.go:295:			setViewportSize					100.0%
/common/page.go:310:			updateExtraHTTPHeaders				100.0%
/common/page.go:318:			updateGeolocation				0.0%
/common/page.go:337:			updateOffline					0.0%
/common/page.go:345:			updateHttpCredentials				0.0%
/common/page.go:353:			viewportSize					100.0%
/common/page.go:361:			AddInitScript					0.0%
/common/page.go:366:			AddScriptTag					0.0%
/common/page.go:371:			AddStyleTag					0.0%
/common/page.go:377:			BringToFront					0.0%
/common/page.go:388:			Check						100.0%
/common/page.go:395:			Click						100.0%
/common/page.go:402:			Close						100.0%
/common/page.go:409:			Content						0.0%
/common/page.go:416:			Context						0.0%
/common/page.go:421:			Dblclick					100.0%
/common/page.go:427:			DispatchEvent					100.0%
/common/page.go:433:			DragAndDrop					0.0%
/common/page.go:438:			EmulateMedia					83.3%
/common/page.go:461:			EmulateVisionDeficiency				0.0%
/common/page.go:487:			Evaluate					100.0%
/common/page.go:493:			EvaluateHandle					100.0%
/common/page.go:499:			ExposeBinding					0.0%
/common/page.go:504:			ExposeFunction					0.0%
/common/page.go:509:			Fill						100.0%
/common/page.go:515:			Focus						100.0%
/common/page.go:521:			Frame						0.0%
/common/page.go:528:			Frames						0.0%
/common/page.go:532:			GetAttribute					0.0%
/common/page.go:539:			GoBack						0.0%
/common/page.go:545:			GoForward					0.0%
/common/page.go:552:			Goto						100.0%
/common/page.go:558:			Hover						100.0%
/common/page.go:564:			InnerHTML					0.0%
/common/page.go:570:			InnerText					0.0%
/common/page.go:576:			InputValue					100.0%
/common/page.go:582:			IsChecked					100.0%
/common/page.go:588:			IsClosed					0.0%
/common/page.go:595:			IsDisabled					0.0%
/common/page.go:601:			IsEditable					0.0%
/common/page.go:607:			IsEnabled					0.0%
/common/page.go:613:			IsHidden					0.0%
/common/page.go:619:			IsVisible					0.0%
/common/page.go:626:			MainFrame					80.0%
/common/page.go:641:			Opener						0.0%
/common/page.go:645:			Pause						0.0%
/common/page.go:650:			Pdf						0.0%
/common/page.go:656:			Press						100.0%
/common/page.go:662:			Query						100.0%
/common/page.go:668:			QueryAll					100.0%
/common/page.go:675:			Reload						80.0%
/common/page.go:720:			Route						0.0%
/common/page.go:726:			Screenshot					77.8%
/common/page.go:740:			SelectOption					100.0%
/common/page.go:746:			SetContent					100.0%
/common/page.go:753:			SetDefaultNavigationTimeout			0.0%
/common/page.go:760:			SetDefaultTimeout				0.0%
/common/page.go:767:			SetExtraHTTPHeaders				100.0%
/common/page.go:774:			SetInputFiles					0.0%
/common/page.go:781:			SetViewportSize					75.0%
/common/page.go:795:			Tap						0.0%
/common/page.go:801:			TextContent					0.0%
/common/page.go:807:			Title						100.0%
/common/page.go:815:			Type						100.0%
/common/page.go:821:			Uncheck						100.0%
/common/page.go:827:			Unroute						0.0%
/common/page.go:833:			URL						0.0%
/common/page.go:839:			Video						0.0%
/common/page.go:846:			ViewportSize					100.0%
/common/page.go:857:			WaitForEvent					0.0%
/common/page.go:864:			WaitForFunction					0.0%
/common/page.go:871:			WaitForLoadState				0.0%
/common/page.go:878:			WaitForNavigation				100.0%
/common/page.go:884:			WaitForRequest					0.0%
/common/page.go:890:			WaitForResponse					0.0%
/common/page.go:897:			WaitForSelector					0.0%
/common/page.go:89:			NewPage						94.1%
/common/page.go:906:			WaitForTimeout					0.0%
/common/page.go:913:			Workers						0.0%
/common/page.go:923:			sessionID					100.0%
/common/page_options.go:108:		NewPageScreenshotOptions			100.0%
/common/page_options.go:119:		Parse						45.0%
/common/page_options.go:54:		NewPageEmulateMediaOptions			100.0%
/common/page_options.go:62:		Parse						100.0%
/common/page_options.go:80:		NewPageReloadOptions				100.0%
/common/page_options.go:87:		Parse						27.3%
/common/remote_object.go:118:		parseRemoteObject				100.0%
/common/remote_object.go:137:		valueFromRemoteObject				100.0%
/common/remote_object.go:145:		handleParseRemoteObjectErr			0.0%
/common/remote_object.go:42:		Error						100.0%
/common/remote_object.go:53:		Error						100.0%
/common/remote_object.go:58:		Unwrap						0.0%
/common/remote_object.go:62:		parseRemoteObjectPreview			100.0%
/common/remote_object.go:81:		parseRemoteObjectValue				94.7%
/common/request.go:113:			getFrame					100.0%
/common/request.go:117:			getID						100.0%
/common/request.go:121:			getDocumentID					0.0%
/common/request.go:125:			headersSize					100.0%
/common/request.go:136:			setErrorText					100.0%
/common/request.go:140:			setLoadedFromCache				0.0%
/common/request.go:144:			AllHeaders					100.0%
/common/request.go:153:			Failure						0.0%
/common/request.go:160:			Frame						0.0%
/common/request.go:164:			HeaderValue					83.3%
/common/request.go:175:			Headers						100.0%
/common/request.go:183:			HeadersArray					100.0%
/common/request.go:194:			IsNavigationRequest				0.0%
/common/request.go:199:			Method						0.0%
/common/request.go:204:			PostData					0.0%
/common/request.go:209:			PostDataBuffer					0.0%
/common/request.go:215:			PostDataJSON					0.0%
/common/request.go:221:			RedirectedFrom					0.0%
/common/request.go:227:			RedirectedTo					0.0%
/common/request.go:234:			ResourceType					0.0%
/common/request.go:239:			Response					0.0%
/common/request.go:243:			Size						100.0%
/common/request.go:250:			Timing						0.0%
/common/request.go:267:			URL						100.0%
/common/request.go:66:			NewRequest					92.3%
/common/response.go:138:			fetchBody					92.9%
/common/response.go:159:			headersSize					100.0%
/common/response.go:171:			AllHeaders					0.0%
/common/response.go:181:			Body						75.0%
/common/response.go:195:			bodySize					85.7%
/common/response.go:212:			Finished					0.0%
/common/response.go:220:			Frame						0.0%
/common/response.go:224:			HeaderValue					0.0%
/common/response.go:234:			HeaderValues					0.0%
/common/response.go:240:			FromCache					0.0%
/common/response.go:245:			FromPrefetchCache				0.0%
/common/response.go:250:			FromServiceWorker				0.0%
/common/response.go:255:			Headers						0.0%
/common/response.go:263:			HeadersArray					0.0%
/common/response.go:274:			JSON						0.0%
/common/response.go:293:			Ok						0.0%
/common/response.go:301:			Request						0.0%
/common/response.go:305:			SecurityDetails					0.0%
/common/response.go:311:			ServerAddr					0.0%
/common/response.go:316:			Size						100.0%
/common/response.go:324:			Status						0.0%
/common/response.go:329:			StatusText					0.0%
/common/response.go:334:			Text						0.0%
/common/response.go:345:			URL						100.0%
/common/response.go:85:			NewHTTPResponse					83.3%
/common/screenshotter.go:114:		restoreViewport					66.7%
/common/screenshotter.go:121:		screenshot					54.1%
/common/screenshotter.go:207:		screenshotElement				51.2%
/common/screenshotter.go:277:		screenshotPage					54.3%
/common/screenshotter.go:355:		trimClipToSize					0.0%
/common/screenshotter.go:44:		newScreenshotter				100.0%
/common/screenshotter.go:48:		fullPageSize					80.0%
/common/screenshotter.go:86:		originalViewportSize				33.3%
/common/selectors.go:66:			NewSelector					100.0%
/common/selectors.go:76:			appendPart					42.9%
/common/selectors.go:88:			parse						32.7%
/common/session.go:129:			Execute						83.9%
/common/session.go:189:			ExecuteWithoutExpectationOnReply		68.8%
/common/session.go:56:			NewSession					100.0%
/common/session.go:73:			ID						100.0%
/common/session.go:77:			close						71.4%
/common/session.go:91:			markAsCrashed					0.0%
/common/session.go:97:			readLoop					78.6%
/common/timeout.go:31:			NewTimeoutSettings				100.0%
/common/timeout.go:40:			setDefaultTimeout				100.0%
/common/timeout.go:44:			setDefaultNavigationTimeout			100.0%
/common/timeout.go:48:			navigationTimeout				85.7%
/common/timeout.go:61:			timeout						100.0%
/common/touchscreen.go:47:		NewTouchscreen					100.0%
/common/touchscreen.go:56:		tap						0.0%
/common/touchscreen.go:71:		Tap						0.0%
/common/types.go:118:			MarshalJSON					0.0%
/common/types.go:126:			UnmarshalJSON					0.0%
/common/types.go:142:			NewEmulatedSize					100.0%
/common/types.go:155:			NewGeolocation					0.0%
/common/types.go:159:			Parse						0.0%
/common/types.go:204:			String						0.0%
/common/types.go:219:			MarshalJSON					0.0%
/common/types.go:227:			UnmarshalJSON					0.0%
/common/types.go:246:			String						100.0%
/common/types.go:263:			MarshalJSON					0.0%
/common/types.go:271:			UnmarshalJSON					0.0%
/common/types.go:297:			String						0.0%
/common/types.go:314:			MarshalJSON					0.0%
/common/types.go:322:			UnmarshalJSON					0.0%
/common/types.go:345:			enclosingIntRect				100.0%
/common/types.go:353:			toApiRect					100.0%
/common/types.go:366:			String						0.0%
/common/types.go:381:			MarshalJSON					0.0%
/common/types.go:389:			UnmarshalJSON					0.0%
/common/types.go:418:			Parse						0.0%
/common/types.go:445:			enclosingIntSize				0.0%
/common/types.go:452:			Parse						100.0%
/common/types.go:46:			String						0.0%
/common/types.go:475:			Parse						100.0%
/common/types.go:494:			calculateInset					100.0%
/common/types.go:516:			NewCredentials					0.0%
/common/types.go:520:			Parse						0.0%
/common/types.go:63:			MarshalJSON					0.0%
/common/types.go:71:			UnmarshalJSON					0.0%
/common/types.go:99:			String						100.0%
/common/worker.go:53:			NewWorker					0.0%
/common/worker.go:67:			didClose					0.0%
/common/worker.go:71:			initEvents					0.0%
/common/worker.go:86:			Evaluate					0.0%
/common/worker.go:92:			EvaluateHandle					0.0%
/common/worker.go:98:			URL						0.0%
/tests/logrus_hook.go:41:			Levels						100.0%
/tests/logrus_hook.go:46:			Fire						100.0%
/tests/logrus_hook.go:55:			contains					83.3%
/tests/logrus_hook.go:70:			attachLogCache					100.0%
/tests/test_browser.go:160:		withHandler					75.0%
/tests/test_browser.go:175:		withFileServer					100.0%
/tests/test_browser.go:187:		URL						66.7%
/tests/test_browser.go:195:		staticURL					100.0%
/tests/test_browser.go:200:		attachFrame					100.0%
/tests/test_browser.go:241:		defaultLaunchOpts				75.0%
/tests/test_browser.go:263:		withHTTPServer					100.0%
/tests/test_browser.go:279:		withFileServer					100.0%
/tests/test_browser.go:295:		withLogCache					100.0%
/tests/test_browser.go:301:		getHTTPTestModuleInstance			75.0%
/tests/test_browser.go:63:		newTestBrowser					97.1%
total:									(statements)					56.4%

Update the coverage

# All tests
go test -cover -coverpkg=./... -coverprofile=cover.out ./...

# Unit tests (without /tests)
go test -coverprofile=cover.out ./common ./chromium ./keyboardlayout .

Related: #231, #241, #233

This was referenced Feb 11, 2022
@inancgumus inancgumus pinned this issue Mar 14, 2022
@inancgumus inancgumus added hacktoberfest Suitable for Hacktoberfest 🎉 good first issue Good for newcomers labels Oct 12, 2023
@unlikelyzero
Copy link

I'd like to contribute some tests to #1127

@inancgumus
Copy link
Member Author

inancgumus commented Dec 8, 2023

Hi @unlikelyzero, you're welcome to increase test coverage for other areas since we have coverage in basic auth 🙇 Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest Suitable for Hacktoberfest 🎉 tests
Projects
None yet
Development

No branches or pull requests

2 participants