Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Go in Practice question on CI, deployment and testing  RSS feed

 
Author
Posts: 18
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations on the book! It looks like a very practical and helpful book for Go developers.

From the contents, I see there is a section on testing. What kinds of tools does the go community have to build generated test reports? Will the build of a go project fail if a test fails or can the developer force that behavior?

Is there a common or best practice for integrating go applications in a CI solution like Jenkins? It seems that if the Jenkins build server has the correct version of go installed that integration with Jenkins should be pretty easy. Is this a common practice in the go community?

Thanks,

Lloyd
 
Author
Posts: 14
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Go toolchain, which includes the compiler, also includes testing and reporting tools. Testing is a first class citizen.

Test files are those that end in _test.go. Files with this ending are skipped when building but included when running the test suite. Test files live alongside application source files.

Tests use the testing package from the standard library. Tests start with Test. For example...



Normal language functionality is used in the tests. In addition to tests like this there are benchmarks, example, and more.

Then there are feature like the code coverage reports. You can read about them in this blog post. This has now been moved into the toolchain and requires no additional feature be installed. There coverage reports can be viewed in HTML or exported to other services like https://coveralls.io/.

It's really common to integrate Go into testing systems. For example, Travis CI has Go support as a first class language. If you have Go installed on a Jenkins server you can test with it. Or, if you want to test against multiple versions you can even use the Docker plugin for Jenkins and use differing versions of the golang image as a base.

Does this help?
 
Lloyd Meinholz
Author
Posts: 18
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That answer is very helpful, thanks for the response. Coming from a Java background, it is interesting (and a great idea) to have so much testing support in the language proper vs. adding on tools.

I like the idea of using golang docker images to be more flexible with go versions.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!