Skip to content

Commit 36ca935

Browse files
committed
remove: outdated section of workshop 7
- The section of workshop 7 on ant+jacoco no longer works as-is - it relies on GitPod, which no longer provides a free tier or works without registration.
1 parent 64adab1 commit 36ca935

File tree

4 files changed

+26
-361
lines changed

4 files changed

+26
-361
lines changed

assets/workshops/workshop07-solutions.html

Lines changed: 9 additions & 87 deletions
Large diffs are not rendered by default.

assets/workshops/workshop07-solutions.md

Lines changed: 4 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: |
88
It is strongly suggested you complete the recommended readings for weeks 1-7
99
*before* attempting this lab/workshop.
1010

11-
## A. Code review
11+
## 1. Code review
1212

1313
*Code review* is careful, systematic study of source code by people who are not
1414
the original author of the code. It's analogous to having someone proofread
@@ -46,7 +46,7 @@ to code review.
4646

4747
[code-review-stack]: https://codereview.stackexchange.com
4848

49-
## B. Exercise
49+
## 2. Exercise
5050

5151

5252
<!--
@@ -308,7 +308,7 @@ probably aren't necessary (but Javadoc documentation still is).
308308
309309
310310
311-
## C. Linters and formatters
311+
## 3. Linters and formatters
312312
313313
In general, it's expensive to spend the time of humans doing
314314
something a computer could do equally well -- like formatting code
@@ -350,120 +350,9 @@ problems they can flag.
350350

351351
\newpage
352352

353-
## D. Ant build files and code coverage tools
354353

355-
This exercise is to get you familiar with code coverage tools and some of their weaknesses.
356354

357-
A repository with Java code is provided at
358-
<https://github.com/cits5501/week-8-lab-coverage-example> which contains a simple class
359-
for detecting whether a Java string is a palindrome (`Palindrome.java`), and tests for
360-
this class using JUnit.
361-
362-
You can use [GitPod](https://www.gitpod.io) to work with this code online. You will need a GitHub account; once you
363-
have one set up, follow the link below:
364-
365-
&nbsp; <https://gitpod.io/new/#https://github.com/cits5501/week-8-lab-coverage-example>
366-
367-
and select "New workspace".
368-
369-
After a minute or two, you should get access to an online version of the VS Code editor in which
370-
the source code for the repository is available. Take a look at the `build.xml` file; this file
371-
is used by the [Apache Ant][ant] build automation tool. It defines
372-
several "targets" representing tasks that can be run using the build
373-
file:
374-
375-
[ant]: https://en.wikipedia.org/wiki/Apache_Ant
376-
377-
- init
378-
- compile
379-
- compileTest
380-
- test, and
381-
- report.
382-
383-
(Some of these tasks you can also do just using VS Code. For instance,
384-
open `PalindromeTest.java`, expand the "outline" and "java projects"
385-
panes, and wait for the background tasks to finish.
386-
A green triangle should appear next to the start of the `PalindromeTest`
387-
class, indicating that it can be clicked to run the JUnit tests it
388-
contains.)
389-
390-
Click the "Terminal" pane, and type `ant test` to run the JUnit tests.
391-
The messages should indicate that four tests were run with no failures.
392-
393-
Now run `ant report`, and not only will the tests be run, but the paths
394-
they take through the code of `PalindromeTest` will be recorded by a
395-
tool called [JaCoCo][jacoco], and a report produced.
396-
397-
[jacoco]: https://www.jacoco.org/jacoco/
398-
399-
You can view this by clicking "Go Live" in the VS Code taskbar (towards
400-
the right). This serves up the contents of the repository directory via
401-
HTTP, so it can be viewed in the browser. Click "report", and by
402-
clicking through, you should be able to see a coverage report for our
403-
tests.
404-
405-
406-
![](jacoco-coverage-rep.png){ width="20cm" }
407-
408-
409-
Read the JaCoco documentation on "Coverage Counters", [here][cov],
410-
for more information about exactly what is being measured.
411-
412-
[cov]: https://www.eclemma.org/jacoco/trunk/doc/counters.html
413-
414-
**Exercises**
415-
416-
- Comment out one of the assert statements (e.g. the one containing
417-
`p.isPalindrome("redivider")`) and replace it with the bare call to
418-
`p.isPalindrome()`.
419-
420-
Does the coverage report change at all? Try doing the same for all
421-
tests, and check again. What weakness of coverage tools does this
422-
suggest?
423-
424-
- Comment out all but one of the tests. Again, does the coverage report
425-
change?
426-
427-
- Applying the ideas from ISP (but without necessarily doing a detailed
428-
analysis) -- can you spot any test cases that are missing from the
429-
test suite?
430-
431-
432-
<div class="solutions">
433-
434-
\solbox
435-
436-
**Solution**
437-
438-
The coverage report doesn't change in any of the above
439-
cases.
440-
441-
This suggests we could have a very weak test suite, consisting
442-
of just one test case -- say, an empty string (`""`) -- and with no
443-
assertions, and full coverage would still be reported.
444-
445-
If changes are made to the code, we could easily introduce errors that
446-
aren't picked up by the test suite.
447-
448-
When we look at mutation testing, we will see ways of assessing the
449-
quality of our tests which do not depend on measuring coverage as
450-
reported by tools like JaCoCo.
451-
452-
As for a missing test case: an empty string (a degenerate or "border"
453-
case) would be a good thing to test for, as would single-letter strings,
454-
but this is not done.
455-
456-
457-
</div>
458-
\endsolbox
459-
460-
461-
\newpage
462-
463-
464-
465-
466-
## E. Summary
355+
## 4. Summary
467356

468357
Code review is a widely-used technique for improving software quality by
469358
human inspection. Code review can detect many kinds of problems in code,

assets/workshops/workshop07.html

Lines changed: 9 additions & 72 deletions
Large diffs are not rendered by default.

assets/workshops/workshop07.md

Lines changed: 4 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: |
88
It is strongly suggested you complete the recommended readings for weeks 1-7
99
*before* attempting this lab/workshop.
1010

11-
## A. Code review
11+
## 1. Code review
1212

1313
*Code review* is careful, systematic study of source code by people who are not
1414
the original author of the code. It's analogous to having someone proofread
@@ -46,7 +46,7 @@ to code review.
4646

4747
[code-review-stack]: https://codereview.stackexchange.com
4848

49-
## B. Exercise
49+
## 2. Exercise
5050

5151

5252
<!--
@@ -147,7 +147,7 @@ public static boolean leap(int y) {
147147

148148

149149

150-
## C. Linters and formatters
150+
## 3. Linters and formatters
151151

152152
In general, it's expensive to spend the time of humans doing
153153
something a computer could do equally well -- like formatting code
@@ -189,92 +189,9 @@ problems they can flag.
189189

190190
\newpage
191191

192-
## D. Ant build files and code coverage tools
193192

194-
This exercise is to get you familiar with code coverage tools and some of their weaknesses.
195193

196-
A repository with Java code is provided at
197-
<https://github.com/cits5501/week-8-lab-coverage-example> which contains a simple class
198-
for detecting whether a Java string is a palindrome (`Palindrome.java`), and tests for
199-
this class using JUnit.
200-
201-
You can use [GitPod](https://www.gitpod.io) to work with this code online. You will need a GitHub account; once you
202-
have one set up, follow the link below:
203-
204-
&nbsp; <https://gitpod.io/new/#https://github.com/cits5501/week-8-lab-coverage-example>
205-
206-
and select "New workspace".
207-
208-
After a minute or two, you should get access to an online version of the VS Code editor in which
209-
the source code for the repository is available. Take a look at the `build.xml` file; this file
210-
is used by the [Apache Ant][ant] build automation tool. It defines
211-
several "targets" representing tasks that can be run using the build
212-
file:
213-
214-
[ant]: https://en.wikipedia.org/wiki/Apache_Ant
215-
216-
- init
217-
- compile
218-
- compileTest
219-
- test, and
220-
- report.
221-
222-
(Some of these tasks you can also do just using VS Code. For instance,
223-
open `PalindromeTest.java`, expand the "outline" and "java projects"
224-
panes, and wait for the background tasks to finish.
225-
A green triangle should appear next to the start of the `PalindromeTest`
226-
class, indicating that it can be clicked to run the JUnit tests it
227-
contains.)
228-
229-
Click the "Terminal" pane, and type `ant test` to run the JUnit tests.
230-
The messages should indicate that four tests were run with no failures.
231-
232-
Now run `ant report`, and not only will the tests be run, but the paths
233-
they take through the code of `PalindromeTest` will be recorded by a
234-
tool called [JaCoCo][jacoco], and a report produced.
235-
236-
[jacoco]: https://www.jacoco.org/jacoco/
237-
238-
You can view this by clicking "Go Live" in the VS Code taskbar (towards
239-
the right). This serves up the contents of the repository directory via
240-
HTTP, so it can be viewed in the browser. Click "report", and by
241-
clicking through, you should be able to see a coverage report for our
242-
tests.
243-
244-
245-
![](jacoco-coverage-rep.png){ width="20cm" }
246-
247-
248-
Read the JaCoco documentation on "Coverage Counters", [here][cov],
249-
for more information about exactly what is being measured.
250-
251-
[cov]: https://www.eclemma.org/jacoco/trunk/doc/counters.html
252-
253-
**Exercises**
254-
255-
- Comment out one of the assert statements (e.g. the one containing
256-
`p.isPalindrome("redivider")`) and replace it with the bare call to
257-
`p.isPalindrome()`.
258-
259-
Does the coverage report change at all? Try doing the same for all
260-
tests, and check again. What weakness of coverage tools does this
261-
suggest?
262-
263-
- Comment out all but one of the tests. Again, does the coverage report
264-
change?
265-
266-
- Applying the ideas from ISP (but without necessarily doing a detailed
267-
analysis) -- can you spot any test cases that are missing from the
268-
test suite?
269-
270-
271-
272-
\newpage
273-
274-
275-
276-
277-
## E. Summary
194+
## 4. Summary
278195

279196
Code review is a widely-used technique for improving software quality by
280197
human inspection. Code review can detect many kinds of problems in code,

0 commit comments

Comments
 (0)