Test in Production
Table of Contents
This post is used in my test suite for this app.
Test suites are sweet. With a good test suite you can upgrade or modify different parts of the app, and check that each of the tests are passing. This app currently has 322 tests. Having good tests gives you confidence to make changes.
On this app the most important experience is yours. I check that the app works on different browsers. It works in light and dark mode. It works on mobile or desktop. Tests run ensuring the accessibility(WCAG 2.2 AA - shout out to Axe!) and performance testing with lighthouse. There are tests to check the ‘Copy code’ button works and doesn’t also pull the line numbers out with it. If you want to copy and run the code you probably don’t want to bring the line numbers with you, so I remove those for you. Thoughtfulness and care. Each test a want. A decision. A preference. Tested. Codified, so that going forward we can maintain that level and standard as the app changes over time.
This is a test running in production. Enjoy.
Go code with highlights
1package main
2
3import "fmt"
4
5func main() {
6 for i := 0; i < 3; i++ {
7 fmt.Println("Value of i:", i)
8 }
9}
Copy to clipboard variants
Plain code - no line numbers, no highlighting
package main
import "fmt"
func main() {
for i := 0; i < 3; i++ {
fmt.Println("Value of i:", i)
}
}
Code with highlighting
package main
import "fmt"
func main() {
for i := 0; i < 3; i++ {
fmt.Println("Value of i:", i)
}
}
Code with line numbers
1package main
2
3import "fmt"
4
5func main() {
6 for i := 0; i < 3; i++ {
7 fmt.Println("Value of i:", i)
8 }
9}
Code with line numbers and highlighting
1package main
2
3import "fmt"
4
5func main() {
6 for i := 0; i < 3; i++ {
7 fmt.Println("Value of i:", i)
8 }
9}
Jenkins Pipeline Script
1pipeline {
2 agent any
3 stages {
4 stage('Build') {
5 steps {
6 //
7 }
8 }
9 stage('Test') {
10 steps {
11 // This long line extends off to the right. We've added some extra space on the end for your comfort while you read here.
12 }
13 }
14 stage('Deploy') {
15 steps {
16 //
17 }
18 }
19 }
20}
Green means go. Build confidence in your tests.