Referencing my answer from http://robotics.stackexchange.com/a/12086/15014https://robotics.stackexchange.com/a/12086/15014 ,
There are multiple possibilities for the flip of quadrotor.
It can be because of incorrect prop directions (in X or + configuration, the diagonally opposite props must have same rotational direction and adjacent props must have opposite rotational direction; This is all about compensation of angular momentum).
It can be because of a faulty ESC or improperly tuned ESC. There are several ways to tune ESCs properly. (Like this: https://librepilot.atlassian.net/wiki/display/LPDOC/ESC+Calibration )
It can be an issue of PID tuning. (http://myfirstdrone.com/tutorials/how-to-tune-a-quadcopter/ https://oscarliang.com/quadcopter-pid-explained-tuning/ )
IMU may not be calibrated properly and the EKF estimates may be wrong. (https://fpv-flightclub.com/quadcopter-flips-takeoff/ Accelerometer and Gyro orientation along with Compass need to be properly set up)
(Rare) GPS functionality might be malfunctioning ending that up with GPS locks for inaccurate location estimates.
BTW, there are many forums that address this issue and simple Google search is ending up with results like:
https://oscarliang.com/quadcopter-flies-unstable-flips-troubleshoot/
http://diydrones.com/forum/topics/quadcopter-flips-on-liftoff
https://www.rcgroups.com/forums/showthread.php?2284434-My-x-quadcopter-flips-on-takeoff
Please consider mentioning what you have tried and what hasn't worked (otherwise this question is 'too broad' with many Google results popping up for same).
+1 for @Chuck 's comment:
Without any data, anyone that answers will be guessing at what could be wrong. Can you provide any data? Pictures of your quadcopter, your test setup, data from the flight controller, etc.