Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
N notebook
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mark Stevens
  • notebook
  • Wiki
  • unit testing

unit testing · Changes

Page history
mstevens created page: unit testing authored Nov 01, 2017 by Mark Stevens's avatar Mark Stevens
Show whitespace changes
Inline Side-by-side
Showing with 48 additions and 2 deletions
+48 -2
  • unit-testing.md unit-testing.md +48 -2
  • No files found.
unit-testing.md
View page @ c333e678
......@@ -81,6 +81,7 @@ class MockHttpServer extends NanoHTTPD {
}
```
### Unit test setup
```java
public class HttpUrlConnectionNetworkTests extends AndroidTestCase {
......@@ -108,6 +109,53 @@ public class HttpUrlConnectionNetworkTests extends AndroidTestCase {
}
```
### serving assets with NanoHttp
Passing in the TestContext allows you to isolate assets to the androidTest apk.
```
mstevens@lt-mstevens-mac2:bztsitecore$ cd src/androidTest/
mstevens@lt-mstevens-mac2:androidTest$ tree
..
|-- assets
| |-- soap_GetSiteConfigurationRequest.xml
| |-- soap_GetSiteConfigurationResponse.xml
| |-- soap_GetSiteInfoRequest.xml
| |-- soap_GetSiteInfoResponse.xml
| |-- soap_GetTabletConfigurationRequest.xml
| |-- soap_GetTabletConfigurationResponse.xml
| |-- soap_GetTabletSiteDeviceListRequest.xml
| |-- soap_GetTabletSiteDeviceListResponse.xml
| |-- w3_xml_to_json.xml
| |-- xml_to_json.xml
| |-- xml_to_json2.xml
| |-- xslt_identity.xml
| |-- xslt_outline.xml
| `-- xslt_strip_comments.xml
`-- java
`-- com
`-- buzztime
|-- net
| `-- volley
| |-- BTNetVolleyDefaultStackTests.java
| |-- BTNetVolleyTests.java
| |-- HttpUrlConnectionNetworkTests.java
| |-- MockHttpServer.java
| `-- SoapRequestTests.java
|-- site
| `-- core
| |-- ApplicationTest.java
| |-- BTSiteContentProviderTests.java
| |-- BTSiteDBHelperTests.java
| |-- BTSiteRoutesTests.java
| `-- services
| `-- BtStartupServiceTests.java
`-- test
|-- Repeat.java
`-- RepeatRule.java
```
### Simple synchronous network call
```java
public void testSimpleEcho() throws Exception {
......@@ -135,8 +183,6 @@ The pattern is to initialize the Semaphore with no permits.
after the async call.. wait with tryAcquire() for a timeout period
When the listener is called, it releases a permit and tryAcquire() will return.
```java
public void testStringRequest() throws Exception {
final Semaphore semaphore = new Semaphore(0);
......
Clone repository
  • branch code plan
  • build and test configuration
  • build artifact versioning
  • build server instrumented testing
  • build server move
  • bzt16wifi02 releases
  • bzt18uxa02 releases
  • configuration settings and permissions
  • create a repo from cli in gitlab
  • engineering status
  • feature deployment
  • gitlab installation instructions
  • Home
  • ota update and deployment
  • qbert implementation
View All Pages