DevOps Filling In Octane Analysis (Ex 1) - admpresales/oscillating GitHub Wiki

Goal

These exercises are meant to bring your attention to how areas of the Octane Pipeline Analysis screen relates to activities people would be doing through out the process of creating and executing tests along with code changes.

By the end of the exercises, you may not feel like an expert but you should be able to walk away with some confidence on the steps you can do to populate the Octane Pipeline Analysis screen for a custom demo.

For these exercises, you will need the following containers:

  • AutoPass
  • DevOps
  • IntelliJ
  • Octane

Create a Business Rule to Automatically Assign Tests to the Quality Module

How to add test to devops container

🍀 If you can connect to www.github.com from your devops container, then from a terminal window on NimbusServer with the devops container up, run the following command:

docker exec devops bash -c "su -s /bin/bash -c 'git clone --mirror https://github.com/admpresales/oscillating.git /gitrepo/oscillating' apache"

If your container can not connect to the internet, then use these from your terminal window

git clone --mirror https://github.com/admpresales/oscillating.git oscillating
docker cp oscillating devops:/gitrepo
docker exec devops bash -c 'chown -R apache:apache /gitrepo/oscillating'

You would of course replace the url and name to the git project you wish to use in the above steps

Steps you will need to perform to accomplish this task

  1. Create a job called “Corndog” in Jenkins
  2. Restrict your job to run on NimbusServer
  3. Using “http://nimbusserver:8091/git/oscillating” tests
  4. Build using Maven with the following goals “clean test -Dtest=LoginTests,StableTests”
  5. Add Post-build to publish Junit Tests using “**/TEST-*”
    1. Take a look in the jobs workspace target/surefire-reports folder to see why ”TEST-*” was used (Hint: take a look in the "target/surefire-reports" folder to figure it out. Formatting questions can be answered by pressing the ? in the "Post-build Actions" of Jenkins")
  6. Go to the Quality Module and filter based on “01 map to application model” tag
  7. Right on the tests and create a business rule to assign the StableTests to Search and the LoginTests to Security
  8. Add a new test to StableTests class and re-run the pipeline. What happens? Where are the tests?

1. Create a job called “Corndog” in Jenkins

1.1.10.jenkins-job.png


2. Restrict to nimbusserver

1.2.10.jenkins-job.png


3. Using “http://nimbusserver:8091/git/oscillating” tests and "http://nimbusserver:8091//gitweb/?p=oscillating" for "gitweb" for Repository Browser

create-job-01.2.png


4. Build using Maven with the following goals “clean test -Dtest=LoginTests,StableTests” and select the other items as shown below under the "Advanced" button

create-job-01.3.png

Useful Tidbits

  • If the above does not make sense, review your pre-work on Maven Surefire Plugin - Running a Single Test
  • You may try using the above with a newly created LeanFT project and it will fail.
    • Reason is the effective pom uses an older version of the Surfire Plugin and you need 2.19+.
      • You will notice in the pom file of the oscillating project, the maven-surefire-plugin is set to use version 2.20.1.
    • How can you know what the version in effect is? Run mvn effective-pom from your project to see the version of the maven-surefire-plugin.
  • You may also be wondering why all the test classes (LoginTests, PayPalTest, StableTests, UnstableTest) have a form of "Test" in the class name. Why didn't you just call it Corndog or Pronto Pup? 😁
    • By default, Maven Inclusions and Exclusions of Tests uses some form of "Test", which is case sensitive, to identify the classes it is to run as a test. You can modify this if you wish by following the instructions with link provided in this line. This is also why the LeanFT test has a class name of "LeanFtTest" to start.

4. Add Post-build to publish Junit Tests using “**/TEST-*”

create-job-01.4.png

Create and run Run your pipeline in Octane

1.4.10.octane-pipeline.png

1.4.20.octane-pipeline.png

Why is there a skipped test?

  • Hint: Take a look at the StableTests class in IntelliJ

Why was TEST-* used when creating the job in Jenkins?

  • Take a look in the jobs workspace target/surefire-reports folder to see why TEST-* was used (Hint: take a look in the "target/surefire-reports" folder to figure it out.
  • Formatting questions can be answered by pressing the '?' in the "Post-build Actions" of Jenkins)

5. Go to the Quality Module and filter Tests based on “Corndog” tag

1.5.10.octane-quality-module.png


6. Right on the tests and create a business rule to assign the StableTests to Search

  1. Select the "StableTests", then right click and "Assign to Application Module"

1.5.20.octane-quality-module.png

  1. Select the "Application Online Store" module and then select Assignment Rule

1.5.30.octane-quality-module.png

  1. Give it a rule name. (notice the screen tells you how many tests your rule will affect based on your filter)

Repeat for LoginTests and assign them to "Application Mobile Store"


7. Add a new test to StableTests class, commit, push and re-run the pipeline.

  1. Open the the oscillating test in IntelliJ and add a new test.

modify-StableTests-class.png

You can copy/paste following if you wish:

@Test
public void myNewTest() {
}
  1. Commit and push the changes. Then run the pipeline again.

Where did the new test appear in Octane?

Why does it appear here?

1.7.20.octane-quality-module.png

Continue on to Exercise 2 👉