regression tests code example

Example 1: what is regression testing

Regression testing is testing existing 
software applications to make sure that
a change or addition hasn’t broken any 
existing functionality. Its purpose is 
to catch bugs that may have been accidentally
introduced into a new build or release candidate, 
and to ensure that previously eradicated 
bugs continue to stay dead.

Example 2: regression functions

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
import seaborn as sns

from sklearn.preprocessing import StandardScaler

from sklearn.neighbors import KNeighborsRegressor
from sklearn.svm import SVR
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Lasso
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import AdaBoostRegressor
from xgboost import XGBRegressor

from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score

from sklearn.externals import joblib

Example 3: how many test case in your regression

It depends on the project.
In my current project out of 1200 test cases 
in regression suite around %70 is automation.
We use 6 vm to perform parallelexecution it takes
3 hours to execute depends on the test data.

Example 4: regression test

Regression Test
To check if the new functionality works with the old ones.
Regression testing is testing existing 
software applications to make sure that
a change or addition hasn’t broken any 
existing functionality.
Regression also happens when there is a major bug fix.
Around 300 feature files and 700 scenarios. 
Regression tests are kicked off by Jenkins. 
Tests are executed on the Jenkins server (VM). 
The latest run took more than 5 hours. 
The maven command includes that tag name: 
mvn test -D cucumber.options =--tags @Regression”. 
At the end of the execution, jenkins generates 
HTML report with detailed tests steps and screenshots

Example 5: effective regression test

The regression tests should be wide and 
detailed enough to allow catching defects.
You can also eliminate duplicate test
cases, merge test cases and automated tests as feasible.